From 75cc38f5dc1f44a3c2c9a16bb7bfc8a3ea6832cd Mon Sep 17 00:00:00 2001 From: Denis Krivenko Date: Sat, 18 Jul 2026 15:40:14 +0200 Subject: [PATCH] HDDS-15905. Cleanup and format templates Signed-off-by: Denis Krivenko --- charts/ozone/templates/_helpers.tpl | 62 ++----------------- .../templates/helm/om-decommission-job.yaml | 4 +- .../helm/om-decommission-service.yaml | 2 +- .../helm/om-leader-transfer-job.yaml | 4 +- charts/ozone/templates/om/om-statefulset.yaml | 4 +- .../templates/recon/recon-deployment.yaml | 2 +- .../ozone/templates/recon/recon-service.yaml | 2 +- .../ozone/templates/s3g/s3g-statefulset.yaml | 2 +- .../ozone/templates/scm/scm-statefulset.yaml | 2 +- 9 files changed, 15 insertions(+), 69 deletions(-) diff --git a/charts/ozone/templates/_helpers.tpl b/charts/ozone/templates/_helpers.tpl index 59794b4..2510c77 100644 --- a/charts/ozone/templates/_helpers.tpl +++ b/charts/ozone/templates/_helpers.tpl @@ -31,26 +31,6 @@ app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} -{{/* List of comma separated SCM pod names */}} -{{- define "ozone.scm.pods" -}} - {{- $pods := list }} - {{- $replicas := .Values.scm.replicas | int }} - {{- range $i := until $replicas }} - {{- $pods = append $pods (printf "%s-scm-%d.%s-scm-headless" $.Release.Name $i $.Release.Name) }} - {{- end }} - {{- $pods | join "," }} -{{- end }} - -{{/* List of comma separated OM pod names */}} -{{- define "ozone.om.pods" -}} - {{- $pods := list }} - {{- $replicas := .Values.om.replicas | int }} - {{- range $i := until $replicas }} - {{- $pods = append $pods (printf "%s-om-%d.%s-om-headless" $.Release.Name $i $.Release.Name) }} - {{- end }} - {{- $pods | join "," }} -{{- end }} - {{/* List of comma separated om ids */}} {{- define "ozone.om.cluster.ids" -}} {{- $pods := list }} @@ -104,38 +84,6 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- $nodes | join ","}} {{- end }} -{{/* List of decommission scm nodes */}} -{{- define "ozone.scm.decommissioned.nodes" -}} - {{- $nodes := list }} - {{- $statefulset := lookup "apps/v1" "StatefulSet" $.Release.Namespace (printf "%s-scm" $.Release.Name) -}} - {{- if $statefulset }} - {{- $oldCount := $statefulset.spec.replicas | int -}} - {{- $newCount := .Values.scm.replicas | int }} - {{- range $i := until $oldCount }} - {{- if ge $i $newCount }} - {{- $nodes = append $nodes (printf "%s-scm-%d" $.Release.Name $i) }} - {{- end }} - {{- end }} - {{- end }} - {{- $nodes | join "," -}} -{{- end }} - -{{/* List of decommission data nodes */}} -{{- define "ozone.data.decommissioned.hosts" -}} - {{- $hosts := list }} - {{- $statefulset := lookup "apps/v1" "StatefulSet" $.Release.Namespace (printf "%s-datanode" $.Release.Name) -}} - {{- if $statefulset }} - {{- $oldCount := $statefulset.spec.replicas | int -}} - {{- $newCount := .Values.datanode.replicas | int }} - {{- range $i := until $oldCount }} - {{- if ge $i $newCount }} - {{- $hosts = append $hosts (printf "%s-datanode-%d.%s-datanode-headless.%s.svc.cluster.local" $.Release.Name $i $.Release.Name $.Release.Namespace) }} - {{- end }} - {{- end }} - {{- end }} - {{- $hosts | join "," -}} -{{- end }} - {{- define "ozone.configuration.env.common" -}} - name: OZONE-SITE.XML_hdds.datanode.dir value: /data/storage @@ -149,8 +97,6 @@ app.kubernetes.io/instance: {{ .Release.Name }} value: {{ .Values.clusterId }} - name: OZONE-SITE.XML_ozone.scm.nodes.{{ .Values.clusterId }} value: {{ include "ozone.scm.cluster.ids" . }} - {{/*- name: OZONE-SITE.XML_ozone.scm.skip.bootstrap.validation*/}} - {{/* value: {{ quote .Values.scm.skipBootstrapValidation }}*/}} {{- range $i, $val := until ( .Values.scm.replicas | int ) }} - name: {{ printf "OZONE-SITE.XML_ozone.scm.address.%s.%s-scm-%d" $.Values.clusterId $.Release.Name $i }} value: {{ printf "%s-scm-%d.%s-scm-headless.%s.svc.cluster.local" $.Release.Name $i $.Release.Name $.Release.Namespace }} @@ -178,12 +124,12 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- $bOmNodes := ternary (splitList "," (include "ozone.om.bootstrap.nodes" .)) (list) (ne "" (include "ozone.om.bootstrap.nodes" .)) }} {{- $dOmNodes := ternary (splitList "," (include "ozone.om.decommissioned.nodes" .)) (list) (ne "" (include "ozone.om.decommissioned.nodes" .)) }} {{- $activeOmNodes := ternary (splitList "," (include "ozone.om.cluster.ids" .)) (list) (ne "" (include "ozone.om.cluster.ids" .)) }} -{{ include "ozone.configuration.env.common" . }} +{{- include "ozone.configuration.env.common" . }} {{- if gt (len $dOmNodes) 0 }} {{- $decomIds := $dOmNodes | join "," }} - name: OZONE-SITE.XML_ozone.om.decommissioned.nodes.{{ .Values.clusterId }} value: {{ $decomIds }} -{{- else}} +{{- else }} - name: OZONE-SITE.XML_ozone.om.decommissioned.nodes.{{ .Values.clusterId }} value: "" {{- end }} @@ -205,7 +151,7 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- $dOmNodes := ternary (splitList "," (include "ozone.om.decommissioned.nodes" .)) (list) (ne "" (include "ozone.om.decommissioned.nodes" .)) }} {{- $activeOmNodes := ternary (splitList "," (include "ozone.om.cluster.ids" .)) (list) (ne "" (include "ozone.om.cluster.ids" .)) }} {{- $allOmNodes := concat $activeOmNodes $dOmNodes }} -{{ include "ozone.configuration.env.common" . }} +{{- include "ozone.configuration.env.common" . }} - name: OZONE-SITE.XML_ozone.om.decommissioned.nodes.{{ .Values.clusterId }} value: "" {{- range $tempId := $allOmNodes }} @@ -217,4 +163,4 @@ app.kubernetes.io/instance: {{ .Release.Name }} value: {{ $allOmNodes | join "," }} - name: "OZONE-SITE.XML_ozone.om.address.{{ .Values.clusterId }}.om-leader-transfer" value: localhost -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/helm/om-decommission-job.yaml b/charts/ozone/templates/helm/om-decommission-job.yaml index 45b2d98..beb61e5 100644 --- a/charts/ozone/templates/helm/om-decommission-job.yaml +++ b/charts/ozone/templates/helm/om-decommission-job.yaml @@ -90,7 +90,7 @@ spec: persistentVolumeClaim: claimName: {{ $.Release.Name}}-om-{{ $dnode }} - name: om-data - emptyDir: { } + emptyDir: {} - name: config projected: sources: @@ -102,4 +102,4 @@ spec: restartPolicy: Never {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/helm/om-decommission-service.yaml b/charts/ozone/templates/helm/om-decommission-service.yaml index 466c5c5..ceaa7ad 100644 --- a/charts/ozone/templates/helm/om-decommission-service.yaml +++ b/charts/ozone/templates/helm/om-decommission-service.yaml @@ -27,4 +27,4 @@ spec: type: ClusterIP {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/helm/om-leader-transfer-job.yaml b/charts/ozone/templates/helm/om-leader-transfer-job.yaml index 673b47a..05baf0d 100644 --- a/charts/ozone/templates/helm/om-leader-transfer-job.yaml +++ b/charts/ozone/templates/helm/om-leader-transfer-job.yaml @@ -69,7 +69,7 @@ spec: {{- end }} volumes: - name: om-data - emptyDir: { } + emptyDir: {} - name: config projected: sources: @@ -81,4 +81,4 @@ spec: restartPolicy: Never {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/om/om-statefulset.yaml b/charts/ozone/templates/om/om-statefulset.yaml index 75f7d89..0ea1fa0 100644 --- a/charts/ozone/templates/om/om-statefulset.yaml +++ b/charts/ozone/templates/om/om-statefulset.yaml @@ -140,7 +140,7 @@ spec: {{- end }} {{- if not .Values.om.persistence.enabled }} - name: {{ .Release.Name }}-om - emptyDir: { } + emptyDir: {} {{- end }} {{- if .Values.om.persistence.enabled }} volumeClaimTemplates: @@ -159,4 +159,4 @@ spec: {{- with .Values.om.persistence.storageClassName }} storageClassName: {{ . }} {{- end }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/ozone/templates/recon/recon-deployment.yaml b/charts/ozone/templates/recon/recon-deployment.yaml index f05caa7..907e6e8 100644 --- a/charts/ozone/templates/recon/recon-deployment.yaml +++ b/charts/ozone/templates/recon/recon-deployment.yaml @@ -97,4 +97,4 @@ spec: {{- with .Values.configuration.filesFrom }} {{- tpl (toYaml .) $ | nindent 14 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/recon/recon-service.yaml b/charts/ozone/templates/recon/recon-service.yaml index fe21f1e..4fbbd78 100644 --- a/charts/ozone/templates/recon/recon-service.yaml +++ b/charts/ozone/templates/recon/recon-service.yaml @@ -43,4 +43,4 @@ spec: selector: {{- include "ozone.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: recon -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/ozone/templates/s3g/s3g-statefulset.yaml b/charts/ozone/templates/s3g/s3g-statefulset.yaml index 51f15fb..2a5aaa6 100644 --- a/charts/ozone/templates/s3g/s3g-statefulset.yaml +++ b/charts/ozone/templates/s3g/s3g-statefulset.yaml @@ -126,4 +126,4 @@ spec: {{- with .Values.s3g.persistence.storageClassName }} storageClassName: {{ . }} {{- end }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/ozone/templates/scm/scm-statefulset.yaml b/charts/ozone/templates/scm/scm-statefulset.yaml index 6c1d144..428e000 100644 --- a/charts/ozone/templates/scm/scm-statefulset.yaml +++ b/charts/ozone/templates/scm/scm-statefulset.yaml @@ -172,4 +172,4 @@ spec: {{- with .Values.scm.persistence.storageClassName }} storageClassName: {{ . }} {{- end }} - {{- end }} \ No newline at end of file + {{- end }}