Fix kubeconform check and improve it (#456)

- do "helm repo add" for the prometheus-community repo
- run checks for all k8s versions between 1.21.0-1.29.0
This commit is contained in:
Lari Hotari 2024-02-13 11:43:16 +02:00 committed by GitHub
parent 24b80c1986
commit 1f20887f09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 5 deletions

View File

@ -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"

View File

@ -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

View File

@ -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