From 9d3029f1b5c53e61698e51410f6b75aaabdc1dfd Mon Sep 17 00:00:00 2001 From: Slach Date: Tue, 25 Feb 2025 21:52:13 +0400 Subject: [PATCH 1/4] hotfix after merge https://github.com/Altinity/clickhouse-operator/pull/1640 --- .github/workflows/check_helm.yaml | 13 ++++++++++++- deploy/helm/clickhouse-operator/README.md | 1 + .../ServiceAccount-clickhouse-operator.yaml | 1 - deploy/helm/clickhouse-operator/values.yaml | 1 - dev/generate_helm_chart.sh | 16 ++++++++-------- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check_helm.yaml b/.github/workflows/check_helm.yaml index aa5f3248c..51eeb73f6 100644 --- a/.github/workflows/check_helm.yaml +++ b/.github/workflows/check_helm.yaml @@ -17,7 +17,17 @@ jobs: with: fetch-depth: 0 - - uses: medyagh/setup-minikube@master + - name: Set up yq + uses: frenck/action-setup-yq@v1 + + - name: Setup jq + uses: dcarbone/install-jq-action@v3 + + - name: Setup helm-docs + uses: gabe565/setup-helm-docs-action@v1 + + - name: Setup minikube + uses: medyagh/setup-minikube@master with: driver: docker container-runtime: containerd @@ -29,6 +39,7 @@ jobs: run: | set -xe minikube kubectl create ns test + ./dev/generate_helm_chart.sh helm install -n test test-operator ./deploy/helm/clickhouse-operator/ sleep 10 workflow_count=$(kubectl get all --all-namespaces | grep -c "test-operator") diff --git a/deploy/helm/clickhouse-operator/README.md b/deploy/helm/clickhouse-operator/README.md index 9f056af53..2394d38de 100644 --- a/deploy/helm/clickhouse-operator/README.md +++ b/deploy/helm/clickhouse-operator/README.md @@ -43,6 +43,7 @@ For upgrade please install CRDs separately: | metrics.image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) | | metrics.resources | object | `{}` | custom resource configuration | | nameOverride | string | `""` | override name of the chart | +| namespaceOverride | string | `""` | | | nodeSelector | object | `{}` | node for scheduler pod assignment, check `kubectl explain pod.spec.nodeSelector` for details | | operator.containerSecurityContext | object | `{}` | | | operator.env | list | `[]` | additional environment variables for the clickhouse-operator container in deployment possible format value `[{"name": "SAMPLE", "value": "text"}]` | diff --git a/deploy/helm/clickhouse-operator/templates/generated/ServiceAccount-clickhouse-operator.yaml b/deploy/helm/clickhouse-operator/templates/generated/ServiceAccount-clickhouse-operator.yaml index 6ba050570..8753db170 100644 --- a/deploy/helm/clickhouse-operator/templates/generated/ServiceAccount-clickhouse-operator.yaml +++ b/deploy/helm/clickhouse-operator/templates/generated/ServiceAccount-clickhouse-operator.yaml @@ -13,7 +13,6 @@ metadata: namespace: {{ include "altinity-clickhouse-operator.namespace" . }} labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }} annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }} - # Template Parameters: # # NAMESPACE=kube-system diff --git a/deploy/helm/clickhouse-operator/values.yaml b/deploy/helm/clickhouse-operator/values.yaml index 4b138b235..43d3e722b 100644 --- a/deploy/helm/clickhouse-operator/values.yaml +++ b/deploy/helm/clickhouse-operator/values.yaml @@ -1,5 +1,4 @@ namespaceOverride: "" - operator: image: # operator.image.repository -- image repository diff --git a/dev/generate_helm_chart.sh b/dev/generate_helm_chart.sh index 3e6315755..d0af8e075 100755 --- a/dev/generate_helm_chart.sh +++ b/dev/generate_helm_chart.sh @@ -162,7 +162,7 @@ function update_service_resource() { fi yq e -i '.metadata.name |= "{{ printf \"%s-metrics\" (include \"altinity-clickhouse-operator.fullname\" .) }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.spec.selector |= "{{ include \"altinity-clickhouse-operator.selectorLabels\" . | nindent 4 }}"' "${file}" @@ -179,7 +179,7 @@ function update_deployment_resource() { fi yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.spec.selector.matchLabels |= "{{ include \"altinity-clickhouse-operator.selectorLabels\" . | nindent 6 }}"' "${file}" @@ -252,7 +252,7 @@ function update_configmap_resource() { camel_cased_name=$(to_camel_case "${name_suffix}") yq e -i '.metadata.name |= "{{ printf \"%s-'"${name_suffix}"'\" (include \"altinity-clickhouse-operator.fullname\" .) }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.data |= "{{ include \"altinity-clickhouse-operator.configmap-data\" (list . .Values.configs.'"${camel_cased_name}"') | nindent 2 }}"' "${file}" @@ -275,10 +275,10 @@ function update_clusterrolebinding_resource() { fi yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.roleRef.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}" - yq e -i '(.subjects[] | select(.kind == "ServiceAccount")) |= with(. ; .name = "{{ include \"altinity-clickhouse-operator.serviceAccountName\" . }}" | .namespace = "{{ include "altinity-clickhouse-operator.namespace" . }}")' "${file}" + yq e -i '(.subjects[] | select(.kind == "ServiceAccount")) |= with(. ; .name = "{{ include \"altinity-clickhouse-operator.serviceAccountName\" . }}" | .namespace = "{{ include \"altinity-clickhouse-operator.namespace\" . }}")' "${file}" printf '%s\n%s\n' '{{- if .Values.rbac.create -}}' "$(cat "${file}")" >"${file}" printf '%s\n%s\n' "$(cat "${file}")" '{{- end }}' >"${file}" @@ -296,7 +296,7 @@ function update_clusterrole_resource() { fi yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '(.rules[] | select(.resourceNames | contains(["clickhouse-operator"])) | .resourceNames) = ["{{ include \"altinity-clickhouse-operator.fullname\" . }}"]' "${file}" @@ -317,7 +317,7 @@ function update_serviceaccount_resource() { fi yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.serviceAccountName\" . }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.metadata.annotations |= "{{ toYaml .Values.serviceAccount.annotations | nindent 4 }}"' "${file}" @@ -337,7 +337,7 @@ function update_secret_resource() { fi yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}" - yq e -i '.metadata.namespace |= "{{ include "altinity-clickhouse-operator.namespace" . }}"' "${file}" + yq e -i '.metadata.namespace |= "{{ include \"altinity-clickhouse-operator.namespace\" . }}"' "${file}" yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}" yq e -i '.data.username |= "{{ .Values.secret.username | b64enc }}"' "${file}" From 6c9af001f09fe1f754f62fdfdcad5a102efd51ec Mon Sep 17 00:00:00 2001 From: Slach Date: Tue, 25 Feb 2025 21:58:54 +0400 Subject: [PATCH 2/4] hotfix after merge https://github.com/Altinity/clickhouse-operator/pull/1640 --- dev/go_build_all.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/go_build_all.sh b/dev/go_build_all.sh index 5a4fa8b4e..e16f78b24 100755 --- a/dev/go_build_all.sh +++ b/dev/go_build_all.sh @@ -12,10 +12,9 @@ CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" echo "Build operator" source "${CUR_DIR}/go_build_operator.sh" -# helm builder is crushing after commit 6bcda277b752343afd814357666cc99a826fdabe -#CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -#echo "Build helm charts" -#source "${CUR_DIR}/generate_helm_chart.sh" +CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +echo "Build helm charts" +source "${CUR_DIR}/generate_helm_chart.sh" #CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" #echo "Run source checker" From 29a84606b8facdb62d62201d927ef1e44971b7d0 Mon Sep 17 00:00:00 2001 From: Slach Date: Wed, 26 Feb 2025 15:18:42 +0400 Subject: [PATCH 3/4] hotfix after merge https://github.com/Altinity/clickhouse-operator/pull/1640 --- deploy/helm/clickhouse-operator/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/helm/clickhouse-operator/values.yaml b/deploy/helm/clickhouse-operator/values.yaml index 43d3e722b..b2b030871 100644 --- a/deploy/helm/clickhouse-operator/values.yaml +++ b/deploy/helm/clickhouse-operator/values.yaml @@ -1,3 +1,4 @@ +# namespaceOverride -- override namespace where operator will install namespaceOverride: "" operator: image: From e6a2e8dde87ccd06b2c1b14b53257d8350cbc6f1 Mon Sep 17 00:00:00 2001 From: Slach Date: Wed, 26 Feb 2025 15:20:47 +0400 Subject: [PATCH 4/4] hotfix after merge https://github.com/Altinity/clickhouse-operator/pull/1640 --- deploy/helm/clickhouse-operator/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/helm/clickhouse-operator/README.md b/deploy/helm/clickhouse-operator/README.md index 2394d38de..2d236d531 100644 --- a/deploy/helm/clickhouse-operator/README.md +++ b/deploy/helm/clickhouse-operator/README.md @@ -43,7 +43,7 @@ For upgrade please install CRDs separately: | metrics.image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) | | metrics.resources | object | `{}` | custom resource configuration | | nameOverride | string | `""` | override name of the chart | -| namespaceOverride | string | `""` | | +| namespaceOverride | string | `""` | override namespace where operator will install | | nodeSelector | object | `{}` | node for scheduler pod assignment, check `kubectl explain pod.spec.nodeSelector` for details | | operator.containerSecurityContext | object | `{}` | | | operator.env | list | `[]` | additional environment variables for the clickhouse-operator container in deployment possible format value `[{"name": "SAMPLE", "value": "text"}]` |