diff options
Diffstat (limited to 'kubernetes/common')
7 files changed, 34 insertions, 57 deletions
diff --git a/kubernetes/common/etcd/templates/service.yaml b/kubernetes/common/etcd/templates/service.yaml index 1199b22447..006378f631 100644 --- a/kubernetes/common/etcd/templates/service.yaml +++ b/kubernetes/common/etcd/templates/service.yaml @@ -33,6 +33,6 @@ spec: port: {{ .Values.service.clientInternalPort }} clusterIP: None selector: - app: {{ include "common.name" . }} - release: "{{ include "common.release" . }}" + app.kubernetes.io/name: {{ include "common.name" . }} + app.kubernetes.io/instance: {{ include "common.release" . }} diff --git a/kubernetes/common/etcd/templates/statefulset.yaml b/kubernetes/common/etcd/templates/statefulset.yaml index e228e6de43..829e17b5cb 100644 --- a/kubernetes/common/etcd/templates/statefulset.yaml +++ b/kubernetes/common/etcd/templates/statefulset.yaml @@ -15,26 +15,13 @@ */}} apiVersion: apps/v1 kind: StatefulSet -metadata: - name: {{ include "common.fullname" . }} - labels: - heritage: "{{ .Release.Service }}" - release: "{{ include "common.release" . }}" - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: {{ include "common.name" . }} +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} spec: - serviceName: {{ include "common.servicename" .}} + selector: {{- include "common.selectors" . | nindent 4 }} + serviceName: {{ include "common.servicename" . }} replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ include "common.name" . }} template: - metadata: - labels: - heritage: "{{ .Release.Service }}" - release: "{{ include "common.release" . }}" - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: {{ include "common.name" . }} + metadata: {{- include "common.templateMetadata" . | nindent 6 }} spec: {{- if .Values.affinity }} affinity: diff --git a/kubernetes/common/mongo/templates/service.yaml b/kubernetes/common/mongo/templates/service.yaml index e8894c2b59..2be00a32e4 100644 --- a/kubernetes/common/mongo/templates/service.yaml +++ b/kubernetes/common/mongo/templates/service.yaml @@ -29,8 +29,8 @@ spec: - port: {{ .Values.service.internalPort }} name: {{ .Values.service.portName }} selector: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} + app.kubernetes.io/name: {{ include "common.name" . }} + app.kubernetes.io/instance: {{ include "common.release" . }} clusterIP: None --- # Client service for connecting to any Mongo instance for reads. @@ -46,8 +46,8 @@ spec: - port: {{ .Values.service.internalPort }} name: {{ .Values.service.portName }} selector: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} + app.kubernetes.io/name: {{ include "common.name" . }} + app.kubernetes.io/instance: {{ include "common.release" . }} --- {{ if .Values.geoEnabled }} apiVersion: v1 @@ -70,5 +70,5 @@ spec: type: NodePort selector: statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0 - release: {{ include "common.release" . }} + app.kubernetes.io/instance: {{ include "common.release" . }} {{ end }} diff --git a/kubernetes/common/mongo/templates/statefulset.yaml b/kubernetes/common/mongo/templates/statefulset.yaml index e156db27db..fc06663029 100644 --- a/kubernetes/common/mongo/templates/statefulset.yaml +++ b/kubernetes/common/mongo/templates/statefulset.yaml @@ -16,25 +16,13 @@ apiVersion: apps/v1 kind: StatefulSet -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ include "common.release" . }} - heritage: {{ .Release.Service }} +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} spec: - serviceName: {{ .Values.service.name }} + selector: {{- include "common.selectors" . | nindent 4 }} + serviceName: {{ include "common.servicename" . }} replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ include "common.name" . }} template: - metadata: - labels: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} + metadata: {{- include "common.templateMetadata" . | nindent 6 }} spec: {{ include "common.podSecurityContext" . | indent 6 }} imagePullSecrets: @@ -69,6 +57,7 @@ spec: value: "{{ .Values.config.dbName }}" ports: - containerPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName }} # disable liveness probe when breakpoints set in debugger # so K8s doesn't restart unresponsive container {{- if eq .Values.liveness.enabled true }} diff --git a/kubernetes/common/network-name-gen/templates/deployment.yaml b/kubernetes/common/network-name-gen/templates/deployment.yaml index 47f76a375f..71b7846dc9 100644 --- a/kubernetes/common/network-name-gen/templates/deployment.yaml +++ b/kubernetes/common/network-name-gen/templates/deployment.yaml @@ -16,24 +16,12 @@ apiVersion: apps/v1 kind: Deployment -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ include "common.release" . }} - heritage: {{ .Release.Service }} +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} spec: + selector: {{- include "common.selectors" . | nindent 4 }} replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ include "common.name" . }} template: - metadata: - labels: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} + metadata: {{- include "common.templateMetadata" . | nindent 6 }} spec: initContainers: - name: {{ include "common.name" . }}-readiness diff --git a/kubernetes/common/network-name-gen/templates/service.yaml b/kubernetes/common/network-name-gen/templates/service.yaml index 753448c5b7..aac71f7eb3 100644 --- a/kubernetes/common/network-name-gen/templates/service.yaml +++ b/kubernetes/common/network-name-gen/templates/service.yaml @@ -38,5 +38,6 @@ spec: name: {{ .Values.service.portName }} {{- end}} selector: - app: {{ include "common.name" . }} - release: {{ include "common.release" . }} + app.kubernetes.io/name: {{ include "common.name" . }} + app.kubernetes.io/instance: {{ include "common.release" . }} + diff --git a/kubernetes/common/postgres/templates/_deployment.tpl b/kubernetes/common/postgres/templates/_deployment.tpl index a4eb1107a5..fa25a42158 100644 --- a/kubernetes/common/postgres/templates/_deployment.tpl +++ b/kubernetes/common/postgres/templates/_deployment.tpl @@ -27,6 +27,12 @@ metadata: namespace: {{ include "common.namespace" $dot }} labels: app: {{ include "common.name" $dot }}-{{ $pgMode }} + app.kubernetes.io/name: {{ include "common.name" $dot }}-{{ $pgMode }} + {{- if $dot.Chart.AppVersion }} + version: "{{ $dot.Chart.AppVersion | replace "+" "_" }}" + {{- else }} + version: "{{ $dot.Chart.Version | replace "+" "_" }}" + {{- end }} chart: {{ $dot.Chart.Name }}-{{ $dot.Chart.Version | replace "+" "_" }} release: {{ include "common.release" $dot }} heritage: {{ $dot.Release.Service }} @@ -42,6 +48,12 @@ spec: metadata: labels: app: {{ include "common.name" $dot }}-{{ $pgMode }} + app.kubernetes.io/name: {{ include "common.name" $dot }}-{{ $pgMode }} + {{- if $dot.Chart.AppVersion }} + version: "{{ $dot.Chart.AppVersion | replace "+" "_" }}" + {{- else }} + version: "{{ $dot.Chart.Version | replace "+" "_" }}" + {{- end }} release: {{ include "common.release" $dot }} name: "{{ index $dot.Values "container" "name" $pgMode }}" spec: |