From 6d2ae7523f687a555f1db6e1a0a89e50e62a53d2 Mon Sep 17 00:00:00 2001 From: chengshiwen Date: Mon, 8 Mar 2021 17:58:24 +0800 Subject: [PATCH] [Improvement][K8s] Optimize metadata name --- docker/kubernetes/dolphinscheduler/README.md | 2 +- docker/kubernetes/dolphinscheduler/templates/_helpers.tpl | 8 -------- .../templates/deployment-dolphinscheduler-alert.yaml | 6 +++--- .../templates/deployment-dolphinscheduler-api.yaml | 8 ++++---- ...rnal-postgresql.yaml => secret-external-database.yaml} | 6 +++--- .../templates/secret-external-fs-s3a.yaml | 2 +- .../templates/statefulset-dolphinscheduler-master.yaml | 6 +++--- .../templates/statefulset-dolphinscheduler-worker.yaml | 8 ++++---- .../templates/svc-dolphinscheduler-master-headless.yaml | 2 +- .../templates/svc-dolphinscheduler-worker-headless.yaml | 2 +- docker/kubernetes/dolphinscheduler/values.yaml | 2 -- 11 files changed, 21 insertions(+), 31 deletions(-) rename docker/kubernetes/dolphinscheduler/templates/{secret-external-postgresql.yaml => secret-external-database.yaml} (86%) diff --git a/docker/kubernetes/dolphinscheduler/README.md b/docker/kubernetes/dolphinscheduler/README.md index 3c15044fb5..addb297abb 100644 --- a/docker/kubernetes/dolphinscheduler/README.md +++ b/docker/kubernetes/dolphinscheduler/README.md @@ -78,8 +78,8 @@ The Configuration file is `values.yaml`, and the following tables lists the conf | Parameter | Description | Default | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | -| `fullname` | Fullname for DolphinScheduler to override the default release name | `nil` | | `timezone` | World time and date for cities in all time zones | `Asia/Shanghai` | +| | | | | `image.repository` | Docker image repository for the DolphinScheduler | `apache/dolphinscheduler` | | `image.tag` | Docker image version for the DolphinScheduler | `latest` | | `image.pullPolicy` | Image pull policy. One of Always, Never, IfNotPresent | `IfNotPresent` | diff --git a/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl b/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl index 7fe5b68567..21ee92e067 100644 --- a/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl +++ b/docker/kubernetes/dolphinscheduler/templates/_helpers.tpl @@ -23,15 +23,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this If release name contains chart name it will be used as a full name. */}} {{- define "dolphinscheduler.fullname" -}} -{{- if .Values.fullname -}} -{{- .Values.fullname | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- if contains .Chart.Name .Release.Name -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} {{- end -}} {{/* diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml index 19aba58a37..35e2e4a073 100644 --- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml @@ -63,7 +63,7 @@ spec: {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-alert - image: {{ include "dolphinscheduler.image.fullname" . | quote }} + image: {{ include "dolphinscheduler.image.fullname" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "alert-server" @@ -120,8 +120,8 @@ spec: name: {{ template "dolphinscheduler.postgresql.fullname" . }} key: postgresql-password {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password + name: {{ include "dolphinscheduler.fullname" . }}-externaldb + key: database-password {{- end }} - name: DATABASE_DATABASE {{- if .Values.postgresql.enabled }} diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml index 23dc9ff2a3..1dbc513d99 100644 --- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml @@ -63,7 +63,7 @@ spec: {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-api - image: {{ include "dolphinscheduler.image.fullname" . | quote }} + image: {{ include "dolphinscheduler.image.fullname" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "api-server" @@ -115,8 +115,8 @@ spec: name: {{ template "dolphinscheduler.postgresql.fullname" . }} key: postgresql-password {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password + name: {{ include "dolphinscheduler.fullname" . }}-externaldb + key: database-password {{- end }} - name: DATABASE_DATABASE {{- if .Values.postgresql.enabled }} @@ -172,7 +172,7 @@ spec: valueFrom: secretKeyRef: key: fs-s3a-secret-key - name: {{ printf "%s-%s" .Release.Name "fs-s3a" }} + name: {{ include "dolphinscheduler.fullname" . }}-fs-s3a {{- end }} {{- if .Values.api.resources }} resources: diff --git a/docker/kubernetes/dolphinscheduler/templates/secret-external-postgresql.yaml b/docker/kubernetes/dolphinscheduler/templates/secret-external-database.yaml similarity index 86% rename from docker/kubernetes/dolphinscheduler/templates/secret-external-postgresql.yaml rename to docker/kubernetes/dolphinscheduler/templates/secret-external-database.yaml index 16d026afc6..c15ef14ffc 100644 --- a/docker/kubernetes/dolphinscheduler/templates/secret-external-postgresql.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/secret-external-database.yaml @@ -18,12 +18,12 @@ apiVersion: v1 kind: Secret metadata: - name: {{ printf "%s-%s" .Release.Name "externaldb" }} + name: {{ include "dolphinscheduler.fullname" . }}-externaldb labels: - app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-postgresql + app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-externaldb app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque data: - db-password: {{ .Values.externalDatabase.password | b64enc | quote }} + database-password: {{ .Values.externalDatabase.password | b64enc | quote }} {{- end }} \ No newline at end of file diff --git a/docker/kubernetes/dolphinscheduler/templates/secret-external-fs-s3a.yaml b/docker/kubernetes/dolphinscheduler/templates/secret-external-fs-s3a.yaml index 78e7440392..722d31fd2d 100644 --- a/docker/kubernetes/dolphinscheduler/templates/secret-external-fs-s3a.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/secret-external-fs-s3a.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ printf "%s-%s" .Release.Name "fs-s3a" }} + name: {{ include "dolphinscheduler.fullname" . }}-fs-s3a labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-fs-s3a app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml index b1ec5cc947..72b69f19e9 100644 --- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml @@ -60,7 +60,7 @@ spec: {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-master - image: {{ include "dolphinscheduler.image.fullname" . | quote }} + image: {{ include "dolphinscheduler.image.fullname" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "master-server" @@ -157,8 +157,8 @@ spec: name: {{ template "dolphinscheduler.postgresql.fullname" . }} key: postgresql-password {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password + name: {{ include "dolphinscheduler.fullname" . }}-externaldb + key: database-password {{- end }} - name: DATABASE_DATABASE {{- if .Values.postgresql.enabled }} diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml index cd2ba5e0af..271aaa10c7 100644 --- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml @@ -60,7 +60,7 @@ spec: {{- end }} containers: - name: {{ include "dolphinscheduler.fullname" . }}-worker - image: {{ include "dolphinscheduler.image.fullname" . | quote }} + image: {{ include "dolphinscheduler.image.fullname" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "worker-server" @@ -156,8 +156,8 @@ spec: name: {{ template "dolphinscheduler.postgresql.fullname" . }} key: postgresql-password {{- else }} - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password + name: {{ include "dolphinscheduler.fullname" . }}-externaldb + key: database-password {{- end }} - name: DATABASE_DATABASE {{- if .Values.postgresql.enabled }} @@ -213,7 +213,7 @@ spec: valueFrom: secretKeyRef: key: fs-s3a-secret-key - name: {{ printf "%s-%s" .Release.Name "fs-s3a" }} + name: {{ include "dolphinscheduler.fullname" . }}-fs-s3a {{- end }} {{- if .Values.worker.resources }} resources: diff --git a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-master-headless.yaml b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-master-headless.yaml index 7f82cff31e..0df9d01725 100644 --- a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-master-headless.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-master-headless.yaml @@ -20,7 +20,7 @@ metadata: name: {{ include "dolphinscheduler.fullname" . }}-master-headless labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-master-headless - app.kubernetes.io/instance: {{ .Release.Name }}-master-headless + app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: clusterIP: "None" diff --git a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-worker-headless.yaml b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-worker-headless.yaml index 5c4e75436f..5dd5478e26 100644 --- a/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-worker-headless.yaml +++ b/docker/kubernetes/dolphinscheduler/templates/svc-dolphinscheduler-worker-headless.yaml @@ -20,7 +20,7 @@ metadata: name: {{ include "dolphinscheduler.fullname" . }}-worker-headless labels: app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-worker-headless - app.kubernetes.io/instance: {{ .Release.Name }}-worker-headless + app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} spec: clusterIP: "None" diff --git a/docker/kubernetes/dolphinscheduler/values.yaml b/docker/kubernetes/dolphinscheduler/values.yaml index 24b5759281..a8902593f8 100644 --- a/docker/kubernetes/dolphinscheduler/values.yaml +++ b/docker/kubernetes/dolphinscheduler/values.yaml @@ -19,8 +19,6 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -## Fullname for Dolphinscheduler, by default, the release name is used -fullname: "" timezone: "Asia/Shanghai" image: