Skip to content

Commit

Permalink
Add component label to distinguish servers from jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhpalm committed Jun 4, 2021
1 parent a5d5a68 commit 643e986
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: etcd
home: https://github.com/coreos/etcd
version: 0.1.1
version: 0.1.2
appVersion: v3.4.15
description: Distributed reliable key-value store for the most critical data of a
distributed system.
Expand Down
16 changes: 16 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ app.kubernetes.io/name: {{ include "etcd.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Server selector labels
*/}}
{{- define "etcd.server.selectorLabels" -}}
app.kubernetes.io/component: server
{{ include "etcd.selectorLabels" . }}
{{- end }}

{{/*
Snapshotter selector labels
*/}}
{{- define "etcd.snapshotter.selectorLabels" -}}
app.kubernetes.io/component: snapshotter
{{ include "etcd.selectorLabels" . }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
Expand Down
3 changes: 1 addition & 2 deletions templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ spec:
template:
metadata:
labels:
app.kubernetes.io/component: snapshotter
{{- include "etcd.selectorLabels" . | nindent 12 }}
{{- include "etcd.snapshotter.selectorLabels" . | nindent 12 }}
spec:
restartPolicy: OnFailure
serviceAccountName: {{ include "etcd.serviceAccountName" . }}
Expand Down
2 changes: 1 addition & 1 deletion templates/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ spec:
{{- toYaml .Values.podMonitor.relabelings | nindent 8 }}
selector:
matchLabels:
{{- include "etcd.selectorLabels" . | nindent 6 }}
{{- include "etcd.server.selectorLabels" . | nindent 6 }}
{{- end }}
4 changes: 2 additions & 2 deletions templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
- port: {{ .Values.clientPort }}
name: etcd-client
selector:
{{- include "etcd.selectorLabels" . | nindent 4 }}
{{- include "etcd.server.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
Expand All @@ -26,4 +26,4 @@ spec:
- port: {{ .Values.clientPort }}
name: etcd-client
selector:
{{- include "etcd.selectorLabels" . | nindent 4 }}
{{- include "etcd.server.selectorLabels" . | nindent 4 }}
4 changes: 2 additions & 2 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
{{- include "etcd.selectorLabels" . | nindent 6 }}
{{- include "etcd.server.selectorLabels" . | nindent 6 }}
serviceName: {{ template "etcd.fullname" . }}
template:
metadata:
Expand All @@ -21,7 +21,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "etcd.selectorLabels" . | nindent 8 }}
{{- include "etcd.server.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "etcd.serviceAccountName" . }}
securityContext:
Expand Down

0 comments on commit 643e986

Please sign in to comment.