-
Notifications
You must be signed in to change notification settings - Fork 21
/
nsqd-statefulset.yaml
143 lines (143 loc) · 5.06 KB
/
nsqd-statefulset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{{- if .Values.nsqd.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "nsq.nsqd.fullname" . }}
labels:
{{- include "nsq.commonLabels" . | nindent 4 }}
spec:
replicas: {{ .Values.nsqd.replicaCount }}
podManagementPolicy: {{ .Values.nsqd.podManagementPolicy }}
serviceName: "{{ include "nsq.nsqd.fullname" . }}-headless"
selector:
matchLabels:
{{- include "nsq.nsqd.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.nsqd.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nsq.nsqd.selectorLabels" . | nindent 8 }}
spec:
{{- include "nsq.imagePullSecrets" . | nindent 6 }}
securityContext:
{{- toYaml .Values.nsqd.podSecurityContext | nindent 8 }}
priorityClassName: {{ .Values.nsqd.priorityClassName }}
containers:
- name: {{ include "nsq.nsqd.fullname" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
command:
- /nsqd
args:
- --broadcast-address=$(POD_IP)
{{ $lookupdFullName := include "nsq.nsqlookupd.fullname" . -}}
{{ range $i, $e := until (atoi (printf "%d" (int64 .Values.nsqlookupd.replicaCount))) -}}
- --lookupd-tcp-address={{ $lookupdFullName }}-{{ $i }}.{{ $lookupdFullName }}:4160
{{ end -}}
- -data-path=/data
{{- range .Values.nsqd.extraArgs }}
- {{ . }}
{{- end }}
terminationMessagePolicy: FallbackToLogsOnError
ports:
- containerPort: 4150
name: tcp
- containerPort: 4151
name: http
readinessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 10
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 10
timeoutSeconds: 5
resources:
{{- toYaml .Values.nsqd.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /data
{{- if .Values.metrics.enabled }}
- name: metrics
image: "{{ .Values.metrics.image.registry }}/{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
{{- if .Values.metrics.args }}
args: {{- include "nsq.tplvalues.render" (dict "value" .Values.metrics.args "context" $) | nindent 12 }}
{{- else }}
args:
- -web.listen=:{{ .Values.metrics.containerPort }}
- -web.path=/metrics
- -nsqd.addr=http://localhost:4151/stats
- -collect=stats.topics,stats.channels,stats.clients
{{- end }}
ports:
- name: metrics
containerPort: {{ .Values.metrics.containerPort }}
{{- if .Values.metrics.livenessProbe.enabled }}
livenessProbe: {{- include "nsq.tplvalues.render" (dict "value" (omit .Values.metrics.livenessProbe "enabled") "context" $) | nindent 10 }}
httpGet:
path: /
port: metrics
{{- end }}
{{- if .Values.metrics.readinessProbe.enabled }}
readinessProbe: {{- include "nsq.tplvalues.render" (dict "value" (omit .Values.metrics.readinessProbe "enabled") "context" $) | nindent 10 }}
httpGet:
path: /
port: metrics
{{- end }}
{{- if .Values.metrics.startupProbe.enabled }}
startupProbe: {{- include "nsq.tplvalues.render" (dict "value" (omit .Values.metrics.startupProbe "enabled") "context" $) | nindent 10 }}
tcpSocket:
port: metrics
{{- end }}
{{- if .Values.metrics.resources }}
resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
{{- end }}
{{- end }}
serviceAccountName: {{ .Values.nsqd.serviceAccountName }}
{{- with .Values.nsqd.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nsqd.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nsqd.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 5
volumes:
{{- if not .Values.nsqd.persistence.enabled }}
- name: "data"
emptyDir: {}
{{- end }}
{{- if and .Values.nsqd.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.nsqd.persistence.size | quote }}
{{- if .Values.nsqd.persistence.storageClass }}
{{- if (ne "-" .Values.nsqd.persistence.storageClass) }}
storageClassName: "{{ .Values.nsqd.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
{{- end }}