From 405c08eb55d4e20deb2fec0208bd0e8ce6d55988 Mon Sep 17 00:00:00 2001 From: Xinzhao Xu Date: Tue, 13 Aug 2024 17:21:46 +0800 Subject: [PATCH] charts/karmada: remove duplicate app label config in scheduler-estimator Signed-off-by: Xinzhao Xu --- .github/workflows/lint-chart.yaml | 35 ++++++++++++++++--- .../karmada-scheduler-estimator.yaml | 8 ++--- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint-chart.yaml b/.github/workflows/lint-chart.yaml index 3747414fd..11d23b41a 100644 --- a/.github/workflows/lint-chart.yaml +++ b/.github/workflows/lint-chart.yaml @@ -3,6 +3,7 @@ name: Chart Lint env: HELM_VERSION: v3.11.2 + KUSTOMIZE_VERSION: 5.4.3 KIND_VERSION: v0.22.0 KIND_NODE_IMAGE: kindest/node:v1.29.0 K8S_VERSION: v1.29.0 @@ -39,13 +40,37 @@ jobs: with: version: ${{ env.HELM_VERSION }} + - name: Set up Kustomize + uses: syntaqx/setup-kustomize@v1 + with: + kustomize-version: ${{ env.KUSTOMIZE_VERSION }} + - name: Run chart-testing (template) run: | - helm template --set components={"search,descheduler,schedulerEstimator"} --dependency-update ./charts/karmada --debug > /dev/null - helm template --set components={"search,descheduler,schedulerEstimator"},certs.mode=custom --dependency-update ./charts/karmada --debug > /dev/null - helm template --set components={"search,descheduler,schedulerEstimator"},installMode=component --dependency-update ./charts/karmada --debug > /dev/null - helm template --set installMode=agent --dependency-update ./charts/karmada --debug > /dev/null - helm template --dependency-update ./charts/karmada-operator --debug > /dev/null + cat < post-render.sh + #!/bin/sh + # save helm stdout to file, kustomize will read this + cat > all.yaml + kustomize build + EOF + + chmod +x post-render.sh + + cat < kustomization.yaml + resources: + - all.yaml + EOF + + helm template --set components={"search,descheduler,schedulerEstimator"} --dependency-update ./charts/karmada \ + --post-renderer ./post-render.sh --debug > /dev/null + helm template --set components={"search,descheduler,schedulerEstimator"},certs.mode=custom --dependency-update \ + ./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null + helm template --set components={"search,descheduler,schedulerEstimator"},installMode=component --dependency-update \ + ./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null + helm template --set installMode=agent --dependency-update ./charts/karmada --post-renderer ./post-render.sh --debug > /dev/null + helm template --dependency-update ./charts/karmada-operator --post-renderer ./post-render.sh --debug > /dev/null + + rm post-render.sh all.yaml kustomization.yaml # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and # yamllint (https://github.com/adrienverge/yamllint) which require Python diff --git a/charts/karmada/templates/karmada-scheduler-estimator.yaml b/charts/karmada/templates/karmada-scheduler-estimator.yaml index 1fa7f18a9..10ea885ae 100644 --- a/charts/karmada/templates/karmada-scheduler-estimator.yaml +++ b/charts/karmada/templates/karmada-scheduler-estimator.yaml @@ -17,7 +17,7 @@ spec: replicas: {{ $member.replicaCount }} selector: matchLabels: - app: karmada-scheduler-estimator-{{ $clusterName }} + cluster: {{ $clusterName }} {{- include "karmada.schedulerEstimator.labels" $ | nindent 6 }} {{- with $.Values.schedulerEstimator.strategy }} strategy: @@ -30,7 +30,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - app: karmada-scheduler-estimator-{{ $clusterName }} + cluster: {{ $clusterName }} {{- include "karmada.schedulerEstimator.labels" $ | nindent 8 }} {{- include "karmada.schedulerEstimator.podLabels" $ | nindent 8 }} spec: @@ -91,7 +91,7 @@ metadata: cluster: {{ $clusterName }} spec: selector: - app: karmada-scheduler-estimator-{{ $clusterName }} + cluster: {{ $clusterName }} {{- include "karmada.schedulerEstimator.labels" $ | nindent 4 }} ports: - protocol: TCP @@ -138,7 +138,7 @@ metadata: spec: selector: matchLabels: - app: karmada-scheduler-estimator-{{ $clusterName }} + cluster: {{ $clusterName }} {{- include "karmada.schedulerEstimator.labels" $ | nindent 6 }} {{ toYaml $.Values.schedulerEstimator.podDisruptionBudget | nindent 2 }} {{- end -}}