-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new CI/Test process and secret creation bug fix (#42)
fixes #34 and fixes #40 chore: update gitignore with files from VSCode test: update test script fix: ci refactor + fixes #34, fixes #40 chore: test more kube versions
- Loading branch information
1 parent
28f9ee4
commit 7264e21
Showing
29 changed files
with
377 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# | ||
# build docker image and push it to kind nodes | ||
|
||
set -o errexit | ||
|
||
DOCKER_TAG="keycloak-controller:local" | ||
|
||
echo -e "\n##### create docker image with tag $DOCKER_TAG #####\n" | ||
docker build -t "$DOCKER_TAG" ./target | ||
|
||
echo -e "\n##### push docker image to kind nodes #####\n" | ||
kind --name chart-testing load docker-image "$DOCKER_TAG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
NAMESPACE="keycloak" | ||
|
||
echo -e "\n##### install keycloak-controller examples #####\n" | ||
while IFS= read -r KEYCLOAK_EXAMPLE; do | ||
kubectl -n "$NAMESPACE" apply -f "${KEYCLOAK_EXAMPLE}" | ||
done < <(find examples -type f) | ||
|
||
echo -e "\n##### show keycloak-controller examples #####\n" | ||
kubectl -n "$NAMESPACE" get keycloaks.k8s.kiwigrid.com | ||
echo "" | ||
kubectl -n "$NAMESPACE" get keycloakrealms.k8s.kiwigrid.com | ||
echo "" | ||
kubectl -n "$NAMESPACE" get keycloakclients.k8s.kiwigrid.com | ||
echo "" | ||
kubectl -n "$NAMESPACE" get keycloakclientscopes.k8s.kiwigrid.com | ||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
echo -e "\n##### add helm repos #####\n" | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add codecentric https://codecentric.github.io/helm-charts | ||
helm repo add kiwigrid https://kiwigrid.github.io | ||
|
||
echo -e "\n##### update helm repos #####\n" | ||
helm repo update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
KEYCLOAK_CONTROLLER_CHART_VERSION="${1}" | ||
NAMESPACE="keycloak" | ||
|
||
echo -e "\n##### install keycloak-controller crds #####\n" | ||
while IFS= read -r CRD; do | ||
kubectl apply -f "${CRD}" | ||
done < <(find src/main/k8s -type f) | ||
|
||
echo -e "\n##### test controller crds #####\n" | ||
kubectl -n "$NAMESPACE" wait --for condition=established --timeout=15s crd/keycloakclients.k8s.kiwigrid.com | ||
kubectl -n "$NAMESPACE" wait --for condition=established --timeout=15s crd/keycloakclientscopes.k8s.kiwigrid.com | ||
kubectl -n "$NAMESPACE" wait --for condition=established --timeout=15s crd/keycloakrealms.k8s.kiwigrid.com | ||
kubectl -n "$NAMESPACE" wait --for condition=established --timeout=15s crd/keycloaks.k8s.kiwigrid.com | ||
|
||
echo -e "\n##### install keycloak-controller #####\n" | ||
helm upgrade -i keycloak-controller kiwigrid/keycloak-controller \ | ||
--wait \ | ||
--namespace keycloak \ | ||
--version "$KEYCLOAK_CONTROLLER_CHART_VERSION" \ | ||
--set image.repository=keycloak-controller \ | ||
--set image.tag=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
KEYCLOAK_CHART_VERSION="${1}" | ||
NAMESPACE="keycloak" | ||
|
||
echo -e "\n##### create keycloak namespace #####\n" | ||
kubectl create namespace $NAMESPACE | ||
|
||
echo -e "\n##### install keycloak #####\n" | ||
kubectl create secret generic keycloak-auth \ | ||
--namespace $NAMESPACE \ | ||
--from-literal=username=keycloak \ | ||
--from-literal=password=keycloak | ||
|
||
helm upgrade -i keycloak codecentric/keycloak \ | ||
--wait \ | ||
--namespace $NAMESPACE \ | ||
--version "${KEYCLOAK_CHART_VERSION}" \ | ||
--values .github/keycloak-values.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 | ||
|
||
mvn clean && mvn package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
HELM_VERSION="${1}" | ||
|
||
echo -e "\n##### install helm #####\n" | ||
curl --silent --show-error --fail --location --output get_helm.sh https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | ||
chmod 700 get_helm.sh | ||
./get_helm.sh --version "${HELM_VERSION}" | ||
|
||
helm version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
K8S_VERSION="${1}" | ||
|
||
echo -e "\n##### install kubectl #####\n" | ||
curl --silent --show-error --fail --location --output kubectl "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl" | ||
chmod +x ./kubectl | ||
sudo mv ./kubectl /usr/local/bin/kubectl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
echo -e "\n##### install mvn & java #####\n" | ||
sudo apt-get update && sudo apt-get install -y maven openjdk-11-jdk | ||
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 | ||
|
||
mvn --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
|
||
NAMESPACE="keycloak" | ||
|
||
echo -e "\n##### check for errors in keycloak-controller logs #####\n" | ||
sleep 60 | ||
if kubectl -n "${NAMESPACE}" logs -l app.kubernetes.io/name=keycloak-controller | grep -q ERROR; then | ||
echo "errors found in logs :(" | ||
kubectl -n "${NAMESPACE}" logs -l app.kubernetes.io/name=keycloak-controller | ||
exit 1 | ||
else | ||
echo "no errors found in logs :)" | ||
kubectl -n "${NAMESPACE}" logs -l app.kubernetes.io/name=keycloak-controller | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extraEnv: | | ||
- name: KEYCLOAK_USER_FILE | ||
value: /secrets/keycloak-auth/username | ||
- name: KEYCLOAK_PASSWORD_FILE | ||
value: /secrets/keycloak-auth/password | ||
- name: PROXY_ADDRESS_FORWARDING | ||
value: "true" | ||
extraVolumeMounts: | | ||
- name: keycloak-auth | ||
mountPath: /secrets/keycloak-auth | ||
readOnly: true | ||
extraVolumes: | | ||
- name: keycloak-auth | ||
secret: | ||
secretName: keycloak-auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
kind: Cluster | ||
apiVersion: kind.sigs.k8s.io/v1alpha3 | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
# the control plane node config | ||
- role: control-plane | ||
# the 2 workers | ||
- role: worker | ||
- role: worker | ||
- role: worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
kind create cluster --config .github/kind-config.yaml --name chart-testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# | ||
# ci for keycloak-controller | ||
# | ||
|
||
set -o errexit | ||
|
||
mvn clean && mvn package |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.