From 2eff0cf5c7422ec4704d76df74a420d3c74e7bc3 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Wed, 1 Oct 2025 14:10:56 +0200 Subject: [PATCH 1/3] Fix linting `ct lint` issue in helm chart --- helm_chart/values-multi-cluster.yaml | 4 ++++ helm_chart/values-openshift.yaml | 4 ++++ scripts/dev/lint_helm_chart.sh | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/helm_chart/values-multi-cluster.yaml b/helm_chart/values-multi-cluster.yaml index c7cd0222c..051546b55 100644 --- a/helm_chart/values-multi-cluster.yaml +++ b/helm_chart/values-multi-cluster.yaml @@ -1,6 +1,10 @@ operator: # Name that will be assigned to most internal Kubernetes objects like Deployment, ServiceAccount, Role etc. name: mongodb-kubernetes-operator-multi-cluster + vaultSecretBackend: + # set to true if you want the operator to store secrets in Vault + enabled: false + tlsSecretRef: '' multiCluster: # Specify if we want to deploy the operator in multi-cluster mode diff --git a/helm_chart/values-openshift.yaml b/helm_chart/values-openshift.yaml index 96c6699f3..24c05fd07 100644 --- a/helm_chart/values-openshift.yaml +++ b/helm_chart/values-openshift.yaml @@ -6,6 +6,10 @@ namespace: mongodb managedSecurityContext: true operator: + vaultSecretBackend: + # set to true if you want the operator to store secrets in Vault + enabled: false + tlsSecretRef: '' webhook: # registerConfiguration setting (default: true) controls if the operator should automatically register ValidatingWebhookConfiguration and if required for it cluster-wide roles should be installed. # diff --git a/scripts/dev/lint_helm_chart.sh b/scripts/dev/lint_helm_chart.sh index ebcf97fe4..59737419a 100755 --- a/scripts/dev/lint_helm_chart.sh +++ b/scripts/dev/lint_helm_chart.sh @@ -16,6 +16,11 @@ fi # the binaries yamale and yamllint required by ct are available at `${PROJECT_DIR}/venv/bin` export PATH=${PROJECT_DIR}/venv/bin:${PATH} +helm template "${PROJECT_DIR}/helm_chart/" \ + -f "${PROJECT_DIR}/helm_chart/values.yaml" \ + -f "${PROJECT_DIR}/helm_chart/values-openshift.yaml" \ + -f "${PROJECT_DIR}/helm_chart/values-multi-cluster.yaml" + ct lint --charts="${PROJECT_DIR}/helm_chart/" \ --chart-yaml-schema "${PROJECT_DIR}/helm_chart/tests/schemas/chart_schema.yaml" \ --lint-conf "${PROJECT_DIR}/helm_chart/tests/schemas/lintconf.yaml" From 4901987962d106461a291c65af188bcc465f544f Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 2 Oct 2025 12:19:18 +0200 Subject: [PATCH 2/3] Address review comments --- .githooks/pre-commit | 14 +++++++++++--- helm_chart/values-multi-cluster.yaml | 4 ---- helm_chart/values-openshift.yaml | 4 ---- scripts/dev/lint_helm_chart.sh | 5 ----- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 5ab0d1d01..9ea8a5e87 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -226,11 +226,19 @@ pre_commit() { run_job_in_background "python_formatting" run_job_in_background "check_erroneous_kubebuilder_annotations" run_job_in_background "validate_snippets" - run_job_in_background "lint_helm_chart" if wait_for_all_background_jobs; then - echo -e "${GREEN}pre-commit: All checks passed!${NO_COLOR}" - return 0 + # lint_helm_chart must be run after all the background jobs are finished because one of the BG jobs (update_jobs) + # updates the helm chart. And lint_helm_chart requires the helm chart to be updated already. + lint_helm_chart + + local lint_helm_chart_status=$? + if [ "$lint_helm_chart_status" -eq 0 ]; then + return 0 + echo -e "${GREEN}pre-commit: All checks passed!${NO_COLOR}" + else + return 1 + fi else return 1 fi diff --git a/helm_chart/values-multi-cluster.yaml b/helm_chart/values-multi-cluster.yaml index 051546b55..c7cd0222c 100644 --- a/helm_chart/values-multi-cluster.yaml +++ b/helm_chart/values-multi-cluster.yaml @@ -1,10 +1,6 @@ operator: # Name that will be assigned to most internal Kubernetes objects like Deployment, ServiceAccount, Role etc. name: mongodb-kubernetes-operator-multi-cluster - vaultSecretBackend: - # set to true if you want the operator to store secrets in Vault - enabled: false - tlsSecretRef: '' multiCluster: # Specify if we want to deploy the operator in multi-cluster mode diff --git a/helm_chart/values-openshift.yaml b/helm_chart/values-openshift.yaml index 24c05fd07..96c6699f3 100644 --- a/helm_chart/values-openshift.yaml +++ b/helm_chart/values-openshift.yaml @@ -6,10 +6,6 @@ namespace: mongodb managedSecurityContext: true operator: - vaultSecretBackend: - # set to true if you want the operator to store secrets in Vault - enabled: false - tlsSecretRef: '' webhook: # registerConfiguration setting (default: true) controls if the operator should automatically register ValidatingWebhookConfiguration and if required for it cluster-wide roles should be installed. # diff --git a/scripts/dev/lint_helm_chart.sh b/scripts/dev/lint_helm_chart.sh index 59737419a..ebcf97fe4 100755 --- a/scripts/dev/lint_helm_chart.sh +++ b/scripts/dev/lint_helm_chart.sh @@ -16,11 +16,6 @@ fi # the binaries yamale and yamllint required by ct are available at `${PROJECT_DIR}/venv/bin` export PATH=${PROJECT_DIR}/venv/bin:${PATH} -helm template "${PROJECT_DIR}/helm_chart/" \ - -f "${PROJECT_DIR}/helm_chart/values.yaml" \ - -f "${PROJECT_DIR}/helm_chart/values-openshift.yaml" \ - -f "${PROJECT_DIR}/helm_chart/values-multi-cluster.yaml" - ct lint --charts="${PROJECT_DIR}/helm_chart/" \ --chart-yaml-schema "${PROJECT_DIR}/helm_chart/tests/schemas/chart_schema.yaml" \ --lint-conf "${PROJECT_DIR}/helm_chart/tests/schemas/lintconf.yaml" From fb30b49da593a99ca47a536fbdfae3574666a210 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 2 Oct 2025 15:50:11 +0200 Subject: [PATCH 3/3] Fix review comments' --- .githooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 9ea8a5e87..a68317dea 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -234,8 +234,8 @@ pre_commit() { local lint_helm_chart_status=$? if [ "$lint_helm_chart_status" -eq 0 ]; then - return 0 echo -e "${GREEN}pre-commit: All checks passed!${NO_COLOR}" + return 0 else return 1 fi