From 56aef679128cddd6d18624280a5bd48038778eed Mon Sep 17 00:00:00 2001 From: Dmitriy Pavlov Date: Mon, 28 Aug 2023 17:37:05 +0300 Subject: [PATCH] [heml] complete redesign of labels (#4788) --- k8s/charts/seaweedfs/templates/ca-cert.yaml | 5 +++ .../seaweedfs/templates/cert-caissuer.yaml | 5 +++ .../templates/cert-clusterissuer.yaml | 5 +++ .../seaweedfs/templates/client-cert.yaml | 5 +++ .../seaweedfs/templates/filer-cert.yaml | 6 +++ .../templates/filer-service-client.yaml | 11 +++-- .../seaweedfs/templates/filer-service.yaml | 11 +++-- .../templates/filer-servicemonitor.yaml | 11 +++-- .../templates/filer-statefulset.yaml | 27 ++++++----- .../{ingress.yaml => filler-ingress.yaml} | 45 +++---------------- .../seaweedfs/templates/master-cert.yaml | 6 +++ .../seaweedfs/templates/master-ingress.yaml | 42 +++++++++++++++++ .../seaweedfs/templates/master-service.yaml | 10 +++-- .../templates/master-servicemonitor.yaml | 7 ++- .../templates/master-statefulset.yaml | 26 ++++++----- .../seaweedfs/templates/s3-deployment.yaml | 24 +++++----- .../seaweedfs/templates/s3-service.yaml | 10 +++-- .../templates/s3-servicemonitor.yaml | 7 ++- .../templates/seaweedfs-s3-secret.yaml | 6 +++ .../templates/secret-seaweedfs-db.yaml | 5 +++ .../templates/security-configmap.yaml | 8 ++-- .../seaweedfs/templates/service-account.yaml | 15 +++++++ .../seaweedfs/templates/volume-cert.yaml | 6 +++ .../seaweedfs/templates/volume-service.yaml | 10 +++-- .../templates/volume-servicemonitor.yaml | 11 +++-- .../templates/volume-statefulset.yaml | 26 ++++++----- k8s/charts/seaweedfs/values.yaml | 1 - 27 files changed, 228 insertions(+), 123 deletions(-) rename k8s/charts/seaweedfs/templates/{ingress.yaml => filler-ingress.yaml} (50%) create mode 100644 k8s/charts/seaweedfs/templates/master-ingress.yaml diff --git a/k8s/charts/seaweedfs/templates/ca-cert.yaml b/k8s/charts/seaweedfs/templates/ca-cert.yaml index 9b74db0b1..c1d432d31 100644 --- a/k8s/charts/seaweedfs/templates/ca-cert.yaml +++ b/k8s/charts/seaweedfs/templates/ca-cert.yaml @@ -4,6 +4,11 @@ kind: Certificate metadata: name: {{ template "seaweedfs.name" . }}-ca-cert namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: secretName: {{ template "seaweedfs.name" . }}-ca-cert commonName: "{{ template "seaweedfs.name" . }}-root-ca" diff --git a/k8s/charts/seaweedfs/templates/cert-caissuer.yaml b/k8s/charts/seaweedfs/templates/cert-caissuer.yaml index 864652393..4c2693043 100644 --- a/k8s/charts/seaweedfs/templates/cert-caissuer.yaml +++ b/k8s/charts/seaweedfs/templates/cert-caissuer.yaml @@ -4,6 +4,11 @@ kind: Issuer metadata: name: {{ template "seaweedfs.name" . }}-ca-issuer namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: ca: secretName: {{ template "seaweedfs.name" . }}-ca-cert diff --git a/k8s/charts/seaweedfs/templates/cert-clusterissuer.yaml b/k8s/charts/seaweedfs/templates/cert-clusterissuer.yaml index 2604927db..c46aa4756 100644 --- a/k8s/charts/seaweedfs/templates/cert-clusterissuer.yaml +++ b/k8s/charts/seaweedfs/templates/cert-clusterissuer.yaml @@ -3,6 +3,11 @@ apiVersion: cert-manager.io/v1{{ if .Values.global.certificates.alphacrds }}alph kind: ClusterIssuer metadata: name: {{ template "seaweedfs.name" . }}-clusterissuer + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: selfSigned: {} {{- end }} diff --git a/k8s/charts/seaweedfs/templates/client-cert.yaml b/k8s/charts/seaweedfs/templates/client-cert.yaml index 7960c3f8d..5904a00b6 100644 --- a/k8s/charts/seaweedfs/templates/client-cert.yaml +++ b/k8s/charts/seaweedfs/templates/client-cert.yaml @@ -4,6 +4,11 @@ kind: Certificate metadata: name: {{ template "seaweedfs.name" . }}-client-cert namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: secretName: {{ template "seaweedfs.name" . }}-client-cert issuerRef: diff --git a/k8s/charts/seaweedfs/templates/filer-cert.yaml b/k8s/charts/seaweedfs/templates/filer-cert.yaml index 3c3565d33..8b5dbe257 100644 --- a/k8s/charts/seaweedfs/templates/filer-cert.yaml +++ b/k8s/charts/seaweedfs/templates/filer-cert.yaml @@ -4,6 +4,12 @@ kind: Certificate metadata: name: {{ template "seaweedfs.name" . }}-filer-cert namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: secretName: {{ template "seaweedfs.name" . }}-filer-cert issuerRef: diff --git a/k8s/charts/seaweedfs/templates/filer-service-client.yaml b/k8s/charts/seaweedfs/templates/filer-service-client.yaml index 929b6f8bc..41251c897 100644 --- a/k8s/charts/seaweedfs/templates/filer-service-client.yaml +++ b/k8s/charts/seaweedfs/templates/filer-service-client.yaml @@ -4,8 +4,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-filer-client namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer {{- if .Values.filer.metricsPort }} monitoring: "true" {{- end }} @@ -27,5 +30,5 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: filer diff --git a/k8s/charts/seaweedfs/templates/filer-service.yaml b/k8s/charts/seaweedfs/templates/filer-service.yaml index ac44fa42b..352a20676 100644 --- a/k8s/charts/seaweedfs/templates/filer-service.yaml +++ b/k8s/charts/seaweedfs/templates/filer-service.yaml @@ -6,8 +6,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-filer namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: clusterIP: None publishNotReadyAddresses: true @@ -39,5 +42,5 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: filer diff --git a/k8s/charts/seaweedfs/templates/filer-servicemonitor.yaml b/k8s/charts/seaweedfs/templates/filer-servicemonitor.yaml index 4a891463c..8035d7ffb 100644 --- a/k8s/charts/seaweedfs/templates/filer-servicemonitor.yaml +++ b/k8s/charts/seaweedfs/templates/filer-servicemonitor.yaml @@ -6,8 +6,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-filer namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: endpoints: - interval: 30s @@ -15,7 +18,7 @@ spec: scrapeTimeout: 5s selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: filer {{- end }} {{- end }} \ No newline at end of file diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml index 7a2810a71..522a7dcfa 100644 --- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml @@ -5,10 +5,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-filer namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: serviceName: {{ template "seaweedfs.name" . }}-filer podManagementPolicy: Parallel @@ -21,17 +22,17 @@ spec: {{- end }} selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer template: metadata: labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: filer + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }} {{- if .Values.filer.affinity }} @@ -180,8 +181,10 @@ spec: {{- end }} -master={{ range $index := until (.Values.master.replicas | int) }}${SEAWEEDFS_FULLNAME}-master-{{ $index }}.${SEAWEEDFS_FULLNAME}-master.{{ $.Release.Namespace }}:{{ $.Values.master.port }}{{ if lt $index (sub ($.Values.master.replicas | int) 1) }},{{ end }}{{ end }} volumeMounts: + {{- if eq .Values.filer.logs.type "hostPath" }} - name: seaweedfs-filer-log-volume mountPath: "/logs/" + {{- end }} - mountPath: /etc/sw name: config-users readOnly: true diff --git a/k8s/charts/seaweedfs/templates/ingress.yaml b/k8s/charts/seaweedfs/templates/filler-ingress.yaml similarity index 50% rename from k8s/charts/seaweedfs/templates/ingress.yaml rename to k8s/charts/seaweedfs/templates/filler-ingress.yaml index 183cf1a23..b16fd7403 100644 --- a/k8s/charts/seaweedfs/templates/ingress.yaml +++ b/k8s/charts/seaweedfs/templates/filler-ingress.yaml @@ -12,6 +12,12 @@ metadata: namespace: {{ .Release.Namespace }} annotations: {{ omit .Values.filer.ingress.annotations "kubernetes.io/ingress.class" | toYaml | nindent 4 }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: filer spec: ingressClassName: {{ .Values.filer.ingress.className | quote }} tls: @@ -35,41 +41,4 @@ spec: {{- if .Values.filer.ingress.host }} host: {{ .Values.filer.ingress.host }} {{- end }} -{{- end }} ---- -{{- if .Values.master.ingress.enabled }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: ingress-{{ template "seaweedfs.name" . }}-master - namespace: {{ .Release.Namespace }} - annotations: - {{ omit .Values.master.ingress.annotations "kubernetes.io/ingress.class" | toYaml | nindent 4 }} -spec: - ingressClassName: {{ .Values.master.ingress.className | quote }} - rules: - - http: - paths: - - path: /sw-master/?(.*) - pathType: ImplementationSpecific - backend: -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} - service: - name: {{ template "seaweedfs.name" . }}-master - port: - number: {{ .Values.master.port }} - #name: -{{- else }} - serviceName: {{ template "seaweedfs.name" . }}-master - servicePort: {{ .Values.master.port }} -{{- end }} -{{- if .Values.filer.ingress.host }} - host: {{ .Values.master.ingress.host }} -{{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/k8s/charts/seaweedfs/templates/master-cert.yaml b/k8s/charts/seaweedfs/templates/master-cert.yaml index 1377ccda4..bb935eedb 100644 --- a/k8s/charts/seaweedfs/templates/master-cert.yaml +++ b/k8s/charts/seaweedfs/templates/master-cert.yaml @@ -4,6 +4,12 @@ kind: Certificate metadata: name: {{ template "seaweedfs.name" . }}-master-cert namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: master spec: secretName: {{ template "seaweedfs.name" . }}-master-cert issuerRef: diff --git a/k8s/charts/seaweedfs/templates/master-ingress.yaml b/k8s/charts/seaweedfs/templates/master-ingress.yaml new file mode 100644 index 000000000..4522f0a06 --- /dev/null +++ b/k8s/charts/seaweedfs/templates/master-ingress.yaml @@ -0,0 +1,42 @@ +{{- if .Values.master.ingress.enabled }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: networking.k8s.io/v1beta1 +{{- else }} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: ingress-{{ template "seaweedfs.name" . }}-master + namespace: {{ .Release.Namespace }} + annotations: + {{ omit .Values.master.ingress.annotations "kubernetes.io/ingress.class" | toYaml | nindent 4 }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: master +spec: + ingressClassName: {{ .Values.master.ingress.className | quote }} + rules: + - http: + paths: + - path: /sw-master/?(.*) + pathType: ImplementationSpecific + backend: +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} + service: + name: {{ template "seaweedfs.name" . }}-master + port: + number: {{ .Values.master.port }} + #name: +{{- else }} + serviceName: {{ template "seaweedfs.name" . }}-master + servicePort: {{ .Values.master.port }} +{{- end }} +{{- if .Values.filer.ingress.host }} + host: {{ .Values.master.ingress.host }} +{{- end }} +{{- end }} diff --git a/k8s/charts/seaweedfs/templates/master-service.yaml b/k8s/charts/seaweedfs/templates/master-service.yaml index 77710220b..978f9c881 100644 --- a/k8s/charts/seaweedfs/templates/master-service.yaml +++ b/k8s/charts/seaweedfs/templates/master-service.yaml @@ -4,8 +4,10 @@ metadata: name: {{ template "seaweedfs.name" . }}-master namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: master + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: master + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" spec: @@ -27,5 +29,5 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "seaweedfs.name" . }} - component: master + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: master diff --git a/k8s/charts/seaweedfs/templates/master-servicemonitor.yaml b/k8s/charts/seaweedfs/templates/master-servicemonitor.yaml index 64ee18035..0332f756d 100644 --- a/k8s/charts/seaweedfs/templates/master-servicemonitor.yaml +++ b/k8s/charts/seaweedfs/templates/master-servicemonitor.yaml @@ -6,8 +6,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-master namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: master + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: master spec: endpoints: - interval: 30s diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml index e1b272ab4..2b4a8b5c9 100644 --- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml @@ -5,10 +5,10 @@ metadata: name: {{ template "seaweedfs.name" . }}-master namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: serviceName: {{ template "seaweedfs.name" . }}-master podManagementPolicy: Parallel @@ -21,17 +21,17 @@ spec: {{- end }} selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: master + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: master template: metadata: labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: master + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: master spec: restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }} {{- if .Values.master.affinity }} @@ -135,8 +135,10 @@ spec: volumeMounts: - name : data-{{ .Release.Namespace }} mountPath: /data + {{- if eq .Values.master.logs.type "hostPath" }} - name: seaweedfs-master-log-volume mountPath: "/logs/" + {{- end }} {{- if .Values.global.enableSecurity }} - name: security-config readOnly: true diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml index 2040e7161..a996b6ef6 100644 --- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml +++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml @@ -5,25 +5,25 @@ metadata: name: {{ template "seaweedfs.name" . }}-s3 namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: replicas: {{ .Values.s3.replicas }} selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: s3 + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: s3 template: metadata: labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: s3 + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: s3 spec: restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }} {{- if .Values.s3.tolerations }} diff --git a/k8s/charts/seaweedfs/templates/s3-service.yaml b/k8s/charts/seaweedfs/templates/s3-service.yaml index 133ce3372..32fef5d81 100644 --- a/k8s/charts/seaweedfs/templates/s3-service.yaml +++ b/k8s/charts/seaweedfs/templates/s3-service.yaml @@ -4,8 +4,10 @@ metadata: name: {{ template "seaweedfs.name" . }}-s3 namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: s3 + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: s3 + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: ports: - name: "swfs-s3" @@ -25,5 +27,5 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "seaweedfs.name" . }} - component: {{ if .Values.s3.enabled }}s3{{ else }}filer{{ end }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: {{ if .Values.s3.enabled }}s3{{ else }}filer{{ end }} diff --git a/k8s/charts/seaweedfs/templates/s3-servicemonitor.yaml b/k8s/charts/seaweedfs/templates/s3-servicemonitor.yaml index 5df537086..876f72dcd 100644 --- a/k8s/charts/seaweedfs/templates/s3-servicemonitor.yaml +++ b/k8s/charts/seaweedfs/templates/s3-servicemonitor.yaml @@ -6,8 +6,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-s3 namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: s3 + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: s3 spec: endpoints: - interval: 30s diff --git a/k8s/charts/seaweedfs/templates/seaweedfs-s3-secret.yaml b/k8s/charts/seaweedfs/templates/seaweedfs-s3-secret.yaml index 4e9189633..0f3674380 100644 --- a/k8s/charts/seaweedfs/templates/seaweedfs-s3-secret.yaml +++ b/k8s/charts/seaweedfs/templates/seaweedfs-s3-secret.yaml @@ -12,6 +12,12 @@ metadata: annotations: "helm.sh/resource-policy": keep "helm.sh/hook": "pre-install" + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: s3 stringData: admin_access_key_id: {{ $access_key_admin }} admin_secret_access_key: {{ $secret_key_admin }} diff --git a/k8s/charts/seaweedfs/templates/secret-seaweedfs-db.yaml b/k8s/charts/seaweedfs/templates/secret-seaweedfs-db.yaml index c6132c9ea..9a1aca91d 100644 --- a/k8s/charts/seaweedfs/templates/secret-seaweedfs-db.yaml +++ b/k8s/charts/seaweedfs/templates/secret-seaweedfs-db.yaml @@ -7,6 +7,11 @@ metadata: annotations: "helm.sh/resource-policy": keep "helm.sh/hook": "pre-install" + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} stringData: user: "YourSWUser" password: "HardCodedPassword" diff --git a/k8s/charts/seaweedfs/templates/security-configmap.yaml b/k8s/charts/seaweedfs/templates/security-configmap.yaml index 7d06614ec..8f82c25a9 100644 --- a/k8s/charts/seaweedfs/templates/security-configmap.yaml +++ b/k8s/charts/seaweedfs/templates/security-configmap.yaml @@ -5,10 +5,10 @@ metadata: name: {{ template "seaweedfs.name" . }}-security-config namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} data: security.toml: |- # this file is read by master, volume server, and filer diff --git a/k8s/charts/seaweedfs/templates/service-account.yaml b/k8s/charts/seaweedfs/templates/service-account.yaml index 89f531174..a0ca3f004 100644 --- a/k8s/charts/seaweedfs/templates/service-account.yaml +++ b/k8s/charts/seaweedfs/templates/service-account.yaml @@ -5,6 +5,11 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: seaweedfs-rw-cr + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} rules: - apiGroups: [""] resources: ["pods"] @@ -15,11 +20,21 @@ kind: ServiceAccount metadata: name: seaweedfs-rw-sa namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: system:serviceaccount:seaweedfs-rw-sa:default + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} subjects: - kind: ServiceAccount name: seaweedfs-rw-sa diff --git a/k8s/charts/seaweedfs/templates/volume-cert.yaml b/k8s/charts/seaweedfs/templates/volume-cert.yaml index 4167867b1..c6b333f7c 100644 --- a/k8s/charts/seaweedfs/templates/volume-cert.yaml +++ b/k8s/charts/seaweedfs/templates/volume-cert.yaml @@ -4,6 +4,12 @@ kind: Certificate metadata: name: {{ template "seaweedfs.name" . }}-volume-cert namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: volume spec: secretName: {{ template "seaweedfs.name" . }}-volume-cert issuerRef: diff --git a/k8s/charts/seaweedfs/templates/volume-service.yaml b/k8s/charts/seaweedfs/templates/volume-service.yaml index 1e07865c0..20539c5a1 100644 --- a/k8s/charts/seaweedfs/templates/volume-service.yaml +++ b/k8s/charts/seaweedfs/templates/volume-service.yaml @@ -4,8 +4,10 @@ metadata: name: {{ template "seaweedfs.name" . }}-volume namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: volume + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: volume + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: clusterIP: None ports: @@ -24,5 +26,5 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "seaweedfs.name" . }} - component: volume \ No newline at end of file + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: volume \ No newline at end of file diff --git a/k8s/charts/seaweedfs/templates/volume-servicemonitor.yaml b/k8s/charts/seaweedfs/templates/volume-servicemonitor.yaml index 2dcca5ac8..d2ee8b4c7 100644 --- a/k8s/charts/seaweedfs/templates/volume-servicemonitor.yaml +++ b/k8s/charts/seaweedfs/templates/volume-servicemonitor.yaml @@ -6,8 +6,11 @@ metadata: name: {{ template "seaweedfs.name" . }}-volume namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - component: volume + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: volume spec: endpoints: - interval: 30s @@ -15,7 +18,7 @@ spec: scrapeTimeout: 5s selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - component: volume + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + app.kubernetes.io/component: volume {{- end }} {{- end }} \ No newline at end of file diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml index 4abadb24d..18b342dca 100644 --- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml @@ -5,27 +5,27 @@ metadata: name: {{ template "seaweedfs.name" . }}-volume namespace: {{ .Release.Namespace }} labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: serviceName: {{ template "seaweedfs.name" . }}-volume replicas: {{ .Values.volume.replicas }} podManagementPolicy: Parallel selector: matchLabels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: volume + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: volume template: metadata: labels: - app: {{ template "seaweedfs.name" . }} - chart: {{ template "seaweedfs.chart" . }} - release: {{ .Release.Name }} - component: volume + app.kubernetes.io/name: {{ template "seaweedfs.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: volume spec: {{- if .Values.volume.affinity }} affinity: @@ -145,8 +145,10 @@ spec: - name: idx mountPath: "{{ .Values.volume.dir_idx }}/" {{- end }} + {{- if eq .Values.volume.logs.type "hostPath" }} - name: logs mountPath: "/logs/" + {{- end }} {{- if .Values.global.enableSecurity }} - name: security-config readOnly: true diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 165be23f3..8431047b9 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -265,7 +265,6 @@ volume: # ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ priorityClassName: "" - filer: enabled: true repository: null