diff --git a/.github/actions/setup-kind-cluster-for-helm-chart-testing/action.yaml b/.github/actions/setup-kind-cluster-for-helm-chart-testing/action.yaml new file mode 100644 index 00000000..5de80753 --- /dev/null +++ b/.github/actions/setup-kind-cluster-for-helm-chart-testing/action.yaml @@ -0,0 +1,168 @@ +name: 'Setup Kind Cluster for Helm Chart Testing' +description: 'Setup Kind cluster for testing Helm Charts that expect to run with OLM and ingress' +inputs: + # renovate: datasource=github-releases depName=helm/helm + helm-version: + description: helm version to install + required: true + default: 'v3.16.3' + + # renovate: datasource=github-tags depName=python/cpython + python-version: + description: python version to install + required: true + default: 'v3.13.0' + + # renovate: datasource=github-releases depName=kubernetes-sigs/kind + kind-version: + description: kind version to install + required: true + default: 'v0.25.0' + + # renovate: datasource=github-releases depName=operator-framework/operator-lifecycle-manager + olm-version: + description: olm version to install + required: true + default: 'v0.30.0' + + local-registry-enabled: + description: whether to enable local authenticated registry + required: true + type: boolean + default: false + + local-registry-user: + description: local authenticated registry username + required: false + default: 'registryuser1' + + local-registry-password: + description: local authenticated registry password + required: false + default: 'registrypassword1' + + local-registry-uri: + description: local authenticated registry uri + required: false + default: 'registry.localhost' + + local-registry-images: + description: space separated list of remote container images to seed into the local private registry + required: false + default: '' + +runs: + using: "composite" + steps: + - name: Setup Helm 🧰 + uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4 + with: + version: ${{ inputs.helm-version }} + + - name: Setup Python 🐍 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Setup kind cluster 🧰 + uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0 + with: + version: ${{ inputs.kind-version }} + config: _test/kind-config.yaml + + # for helm charts we are testing that require installing operators + - name: Setup kind cluster - Install OLM 🧰 + env: + OLM_VERSION: ${{ inputs.olm-version }} + shell: bash + run: | + curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh -o install.sh + chmod +x install.sh + ./install.sh ${OLM_VERSION} + + # for helm charts we are testing that require ingress + - name: Setup kind cluster - Install ingress controller 🧰 + shell: bash + run: | + helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts + helm install haproxy-ingress haproxy-ingress/haproxy-ingress \ + --create-namespace --namespace=ingress-controller \ + --set controller.hostNetwork=true + kubectl apply -f - <> $GITHUB_OUTPUT fi - - - name: Setup kind cluster 🧰 - uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0 - with: - version: ${{ env.KIND_VERSION }} - if: steps.changed-charts.outputs.changed == 'true' - - # for helm charts we are testing that require installing operators - - name: Setup kind cluster - Install OLM 🧰 - run: | - curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh -o install.sh - chmod +x install.sh - ./install.sh ${OLM_VERSION} - if: steps.changed-charts.outputs.changed == 'true' - - # for helm charts we are testing that require ingress - - name: Setup kind cluster - Install ingress controller 🧰 - run: | - helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts - helm install haproxy-ingress haproxy-ingress/haproxy-ingress \ - --create-namespace --namespace=ingress-controller \ - --set controller.hostNetwork=true - kubectl apply -f - <