diff --git a/.github/actions/kind-cluster/action.yml b/.github/actions/kind-cluster/action.yml new file mode 100644 index 000000000..e3ca70e14 --- /dev/null +++ b/.github/actions/kind-cluster/action.yml @@ -0,0 +1,102 @@ +name: 'Install and configure Kind cluster' +description: 'Customized Kind-action' + +inputs: + config: + description: 'Kind config' + required: true + olm: + description: 'install olm' + required: true + default: 'false' + keycloak: + description: 'install keycloak' + required: true + default: 'false' + prometheus: + description: 'install prometheus' + required: true + default: 'false' + +outputs: + oidc_url: + value: keycloak_url + description: 'Keycloak OIDC url' + +runs: + using: 'composite' + steps: + - name: Install Cluster + uses: container-tools/kind-action@v2.0.1 + with: + version: v0.20.0 + node_image: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb + cpu: 3 + registry: false + config: ${{ inputs.config }} + + - name: Configure ingress + shell: bash + run: | + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml + kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s + - name: Install prometheus + if: ${{ inputs.prometheus == 'true'}} + shell: bash + run: | + #install Prometheus + LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name) + curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f - + kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default + + - name: Install olm + if: ${{ inputs.olm == 'true'}} + shell: bash + run: | + #install OLM + kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/crds.yaml + # wait for a while to be sure CRDs are installed + sleep 1 + kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml + + - name: Install keycloak + if: ${{ inputs.keycloak == 'true'}} + shell: bash + run: | + kubectl create --kustomize ci/keycloak/operator/overlay/kind + until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ] + do + echo "Waiting for keycloak operator. Pods in keycloak-system namespace:" + kubectl get pods -n keycloak-system + sleep 10 + done + kubectl create --kustomize ci/keycloak/resources/overlay/kind + until [[ $( kubectl get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]] + do + printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(kubectl get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system) + sleep 10 + done + + # HACK - expose keycloak under the same name as the internal SVC has so it will be accessible: + # - within the cluster (where the localhost does not work) + # - outside the cluster (resolved from /etc/hosts and redirect to the localhost) + kubectl create -n keycloak-system -f - <> $GITHUB_OUTPUT diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d722903c..2360955bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -205,24 +205,12 @@ jobs: run: podman load -i /tmp/operator-oci.tar - name: Install Cluster - uses: container-tools/kind-action@v2.0.4 + uses: ./.github/actions/kind-cluster with: - version: v0.24.0 - node_image: kindest/node:v1.27.17@sha256:3fd82731af34efe19cd54ea5c25e882985bafa2c9baefe14f8deab1737d9fabe - cpu: 3 - registry: false config: ./ci/config.yaml - - - name: Install Ingress - run: | - kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml - kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s - - - name: Install prometheus - run: | - LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name) - curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f - - kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default + prometheus: 'true' + keycloak: 'true' + olm: 'true' - name: Deploy operator container env: @@ -233,51 +221,6 @@ jobs: run: | kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator - - name: Install Keycloak - run: | - #install OLM - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/crds.yaml - # wait for a while to be sure CRDs are installed - sleep 1 - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml - - kubectl create --kustomize ci/keycloak/operator/overlay/kind - until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ] - do - echo "Waiting for keycloak operator. Pods in keycloak-system namespace:" - kubectl get pods -n keycloak-system - sleep 10 - done - kubectl create --kustomize ci/keycloak/resources/overlay/kind - until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]] - do - printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system) - sleep 10 - done - - # HACK - expose keycloak under the same name as the internal SVC has so it will be accessible: - # - within the cluster (where the localhost does not work) - # - outside the cluster (resolved from /etc/hosts and redirect to the localhost) - kubectl create -n keycloak-system -f - </dev/null)" ] - do - echo "Waiting for keycloak operator. Pods in keycloak-system namespace:" - kubectl get pods -n keycloak-system - sleep 10 - done - kubectl create --kustomize ci/keycloak/resources/overlay/kind - until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]] - do - printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system) - sleep 10 - done - - # HACK - expose keycloak under the same name as the internal SVC has so it will be accessible: - # - within the cluster (where the localhost does not work) - # - outside the cluster (resolved from /etc/hosts and redirect to the localhost) - kubectl create -n keycloak-system -f - <