-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Add preview cluster-wide kubectl install for the operator #46980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
53887a0
71d3f26
efe386c
7e6e15e
e308258
d9fa7f0
c328b8b
a4eebcb
5e9aac5
a46a3a0
54b611e
18c49c1
c2a4db9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,12 +190,10 @@ jobs: | |
| - name: Deploy an example Keycloak and wait for it to be ready | ||
| working-directory: operator/scripts | ||
| run: | | ||
| ./check-crd-installed.sh keycloaks.v2alpha1.k8s.keycloak.org | ||
| ./check-crd-installed.sh keycloakrealmimports.v2alpha1.k8s.keycloak.org | ||
| ./check-crd-installed.sh keycloaks.v2beta1.k8s.keycloak.org | ||
| ./check-crd-installed.sh keycloakrealmimports.v2beta1.k8s.keycloak.org | ||
| ./check-crd-installed.sh keycloakoidcclients.v2alpha1.k8s.keycloak.org | ||
| ./check-crd-installed.sh keycloaksamlclients.v2alpha1.k8s.keycloak.org | ||
| for file in ../target/kubernetes/*k8s.keycloak.org-v1.yml; do | ||
| name=$(basename "$file" -v1.yml) | ||
| ./check-crd-installed.sh ${name} | ||
| done | ||
|
shawkins marked this conversation as resolved.
|
||
| ./deploy-examples.sh | ||
|
|
||
| - name: Single namespace cleanup | ||
|
|
@@ -244,6 +242,120 @@ jobs: | |
| with: | ||
| name: oc-inspect | ||
| path: inspect.* | ||
|
|
||
| test-kustomize: | ||
| name: Test kustomize installation | ||
| runs-on: ubuntu-latest | ||
| needs: [build] | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
|
|
||
| - name: Set version | ||
| id: vars | ||
| run: echo "version_remote=0.0.1-${GITHUB_SHA::6}" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup Java | ||
| uses: ./.github/actions/java-setup | ||
|
|
||
| - name: Restore Quarkus snapshot cache | ||
| if: github.ref == 'refs/heads/quarkus-next' || github.base_ref == 'quarkus-next' | ||
| uses: ./.github/actions/quarkus-snapshot-cache | ||
|
|
||
| - name: Setup Minikube-Kubernetes | ||
| uses: manusa/actions-setup-minikube@b65276017fdec6f1e6498129fb740e34e260dc55 # v2.18.0 | ||
| with: | ||
| minikube version: ${{ env.MINIKUBE_VERSION }} | ||
| kubernetes version: ${{ env.KUBERNETES_VERSION }} | ||
| github token: ${{ secrets.GITHUB_TOKEN }} | ||
| driver: docker | ||
| start args: --memory=${{ env.MINIKUBE_MEMORY }} --addons=registry --insecure-registry=192.168.49.0/24 | ||
|
|
||
| - name: Install OPM / OC | ||
|
vmuzikar marked this conversation as resolved.
|
||
| uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1.13.1 | ||
| with: | ||
| # openshift-tools-installer is out-of-date for later opm, which started using the binary name opm-rhelX. | ||
| # we may have to do our own installation to move past this | ||
| opm: 4.16.4 | ||
| oc: 4 | ||
|
|
||
| - name: Download keycloak distribution | ||
| id: download-keycloak-dist | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: keycloak-dist | ||
| path: quarkus/container | ||
|
|
||
| - name: Build Keycloak Docker image | ||
| run: | | ||
| eval $(minikube -p minikube docker-env) | ||
| (cd quarkus/container && docker build --build-arg KEYCLOAK_DIST=$(ls keycloak-*.tar.gz) . -t keycloak:${{ env.version_remote }}) | ||
|
|
||
| - name: Arrange kustomize test installation for own namespace | ||
| run: | | ||
| kubectl create ns keycloak-own | ||
|
|
||
| eval $(minikube -p minikube docker-env) | ||
| ./mvnw install -Poperator -pl :keycloak-operator -am \ | ||
| -Dquarkus.container-image.build=true \ | ||
| -Dquarkus.kubernetes.image-pull-policy=IfNotPresent \ | ||
| -Dkc.operator.keycloak.image=keycloak:${{ env.version_remote }} \ | ||
| -Dquarkus.kubernetes.env.vars.kc-operator-keycloak-image-pull-policy=Never \ | ||
| --no-transfer-progress -DskipTests -Dkustomize.namespace=keycloak-own | ||
|
|
||
| kubectl apply -k operator/target/kubernetes | ||
|
|
||
| - name: Deploy an example Keycloak and wait for it to be ready | ||
| working-directory: operator/scripts | ||
| run: | | ||
| for file in ../target/kubernetes/*k8s.keycloak.org-v1.yml; do | ||
| name=$(basename "$file" -v1.yml) | ||
| ./check-crd-installed.sh ${name} | ||
| done | ||
|
shawkins marked this conversation as resolved.
|
||
| ./deploy-examples.sh keycloak-own | ||
| ./undeploy-examples.sh keycloak-own | ||
| kubectl delete ns keycloak-own | ||
|
|
||
| - name: Arrange kustomize test installation for all namespaces | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also test the single namespace mode?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going to leave that out as it will be eventually be removed, but it can certainly be added if you want.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd sleep better if we tested both AllNamespace and SingleNamespace. :) |
||
| run: | | ||
| kubectl create ns keycloak-operator | ||
|
|
||
| eval $(minikube -p minikube docker-env) | ||
| ./mvnw install -Poperator -Pcluster-wide -pl :keycloak-operator -am \ | ||
| -Dquarkus.container-image.build=true \ | ||
| -Dquarkus.kubernetes.image-pull-policy=IfNotPresent \ | ||
| -Dkc.operator.keycloak.image=keycloak:${{ env.version_remote }} \ | ||
| -Dquarkus.kubernetes.env.vars.kc-operator-keycloak-image-pull-policy=Never \ | ||
| --no-transfer-progress -DskipTests | ||
|
|
||
| kubectl apply -k operator/target/kubernetes | ||
|
|
||
| - name: Deploy an example Keycloak and wait for it to be ready | ||
| working-directory: operator/scripts | ||
| run: | | ||
| for file in ../target/kubernetes/*k8s.keycloak.org-v1.yml; do | ||
| name=$(basename "$file" -v1.yml) | ||
| ./check-crd-installed.sh ${name} | ||
| done | ||
|
shawkins marked this conversation as resolved.
|
||
| kubectl create ns keycloak | ||
| ./deploy-examples.sh keycloak | ||
| ./undeploy-examples.sh keycloak | ||
|
|
||
| - name: Debug Custom Resources | ||
| if: failure() | ||
| run: | | ||
| kubectl get keycloaks -A -o yaml | ||
| kubectl get keycloakrealmimports -A -o yaml | ||
|
|
||
| - name: Gather inspect report | ||
| if: failure() | ||
| run: oc adm inspect ns | ||
|
|
||
| - name: Upload inspect report | ||
| if: failure() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: oc-inspect | ||
| path: inspect.* | ||
|
|
||
| check: | ||
| name: Status Check - Keycloak Operator CI | ||
|
|
@@ -254,6 +366,7 @@ jobs: | |
| - test-local-apiserver | ||
| - test-remote | ||
| - test-olm | ||
| - test-kustomize | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,19 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| namespace: keycloak | ||
| namespace: ${kustomize.namespace} | ||
|
|
||
| resources: | ||
| - kubernetes/keycloaks.k8s.keycloak.org-v1.yml | ||
| - kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml | ||
| - kubernetes/kubernetes.yml | ||
| - ${crds} | ||
| - kubernetes.yml | ||
|
|
||
| transformers: | ||
| - |- | ||
| apiVersion: builtin | ||
| kind: NamespaceTransformer | ||
| metadata: | ||
| name: notImportantHere | ||
| setRoleBindingSubjects: allServiceAccounts | ||
| fieldSpecs: | ||
| - path: metadata/namespace | ||
| create: true | ||
|
shawkins marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove
check-crd-installed.shscript now that it's not used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still used for checking the service-monitor crd, but that could similarly be changed if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have a unified logic but we can do that as a follow-up, it's not a blocker for this PR at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think we can - the crd file name is the plural name.