Skip to content

Commit

Permalink
Fix kubeconform check and improve it
Browse files Browse the repository at this point in the history
- do "helm repo add" for the prometheus-community repo
- run checks for all k8s versions between 1.21.0-1.29.0
  • Loading branch information
lhotari committed Feb 13, 2024
1 parent 24b80c1 commit da4f7fe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .ci/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions .ci/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/pulsar-helm-chart-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,28 @@ 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
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
Expand Down

0 comments on commit da4f7fe

Please sign in to comment.