diff --git a/.ci/chart_test.sh b/.ci/chart_test.sh index cf70be3e..624b1ec9 100755 --- a/.ci/chart_test.sh +++ b/.ci/chart_test.sh @@ -33,6 +33,8 @@ source ${PULSAR_HOME}/.ci/helm.sh # create cluster ci::create_cluster +ci::helm_repo_add + extra_opts="" if [[ "x${SYMMETRIC}" == "xtrue" ]]; then extra_opts="-s" diff --git a/.ci/helm.sh b/.ci/helm.sh index ffc0e507..8289a82a 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -81,6 +81,13 @@ function ci::install_cert_manager() { echo "Successfully installed the cert manager." } +function ci::helm_repo_add() { + echo "Adding the helm repo ..." + ${HELM} repo add prometheus-community https://prometheus-community.github.io/helm-charts + ${HELM} repo update + echo "Successfully added the helm repo." +} + function ci::print_pod_logs() { echo "Logs for all pulsar containers:" for k8sobject in $(${KUBECTL} get pods,jobs -n ${NAMESPACE} -l app=pulsar -o=name); do diff --git a/.github/workflows/pulsar-helm-chart-ci.yaml b/.github/workflows/pulsar-helm-chart-ci.yaml index 8e96fec5..1a1f86ab 100644 --- a/.github/workflows/pulsar-helm-chart-ci.yaml +++ b/.github/workflows/pulsar-helm-chart-ci.yaml @@ -127,23 +127,29 @@ jobs: --validate-maintainers=false \ --target-branch ${{ github.event.repository.default_branch }} - - name: Run kubeconform check + - name: Run kubeconform check for helm template with every major k8s version 1.21.0-1.29.0 if: ${{ steps.check_changes.outputs.docs_only != 'true' }} run: | PULSAR_CHART_HOME=$(pwd) source ${PULSAR_CHART_HOME}/hack/common.sh + source ${PULSAR_CHART_HOME}/.ci/helm.sh + hack::ensure_kubectl + hack::ensure_helm hack::ensure_kubeconform + ci::helm_repo_add + helm dependency build charts/pulsar validate_helm_template_with_k8s_version() { local kube_version=$1 echo "Validating helm template with kubeconform for k8s version $kube_version" helm template charts/pulsar --set kube-prometheus-stack.enabled=false --set components.pulsar_manager=true --kube-version $kube_version | \ kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' -strict -kubernetes-version $kube_version -summary } - helm dependency build charts/pulsar set -o pipefail - validate_helm_template_with_k8s_version 1.21.0 - validate_helm_template_with_k8s_version 1.27.0 - + for k8s_version_part in {21..29}; do + k8s_version="1.${k8s_version_part}.0" + echo "Validating helm template with kubeconform for k8s version $k8s_version" + validate_helm_template_with_k8s_version $k8s_version + done - name: Wait for ssh connection when build fails # ssh access is enabled for builds in own forks uses: ./.github/actions/ssh-access