Skip to content

Commit 28615ab

Browse files
weltekialexellis
authored andcommitted
Rename queue-worker templates
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent 837818a commit 28615ab

File tree

4 files changed

+165
-165
lines changed

4 files changed

+165
-165
lines changed

chart/openfaas/templates/jetstream-queueworker-dep.yaml

Lines changed: 0 additions & 134 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{{- if and .Values.async (not .Values.openfaasPro) }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
labels:
6+
app: {{ template "openfaas.name" . }}
7+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
8+
component: queue-worker
9+
heritage: {{ .Release.Service }}
10+
release: {{ .Release.Name }}
11+
name: queue-worker
12+
namespace: {{ .Release.Namespace | quote }}
13+
spec:
14+
replicas: {{ .Values.queueWorker.replicas }}
15+
selector:
16+
matchLabels:
17+
app: queue-worker
18+
template:
19+
metadata:
20+
annotations:
21+
prometheus.io/scrape: "false"
22+
labels:
23+
app: queue-worker
24+
spec:
25+
{{- with .Values.imagePullSecrets }}
26+
imagePullSecrets:
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
volumes:
30+
{{- if .Values.basic_auth }}
31+
- name: auth
32+
secret:
33+
secretName: basic-auth
34+
{{- end }}
35+
containers:
36+
- name: queue-worker
37+
resources:
38+
{{- .Values.queueWorker.resources | toYaml | nindent 12 }}
39+
image: {{ include "openfaas.image" (dict "image" .Values.queueWorker.image "registryPrefix" .Values.registryPrefix) }}
40+
imagePullPolicy: {{ .Values.openfaasImagePullPolicy }}
41+
env:
42+
{{- if .Values.nats.external.enabled }}
43+
- name: faas_nats_address
44+
value: "{{ .Values.nats.external.host }}"
45+
- name: faas_nats_port
46+
value: "{{ .Values.nats.external.port }}"
47+
- name: faas_nats_cluster_name
48+
value: "{{ .Values.nats.external.clusterName }}"
49+
{{- else }}
50+
- name: faas_nats_address
51+
value: "nats.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
52+
{{- end}}
53+
- name: faas_nats_channel
54+
value: "{{ .Values.nats.channel }}"
55+
- name: faas_nats_queue_group
56+
value: "{{ .Values.queueWorker.queueGroup }}"
57+
- name: faas_gateway_address
58+
value: "gateway.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
59+
{{- if .Values.functionNamespace }}
60+
- name: faas_function_suffix
61+
value: ".{{ .Values.functionNamespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
62+
{{- end }}
63+
- name: ack_wait
64+
value: "{{ .Values.queueWorker.ackWait }}"
65+
- name: max_inflight
66+
value: "{{ or (.Values.queueWorker.maxInflight ) ("1") }}"
67+
68+
{{- if .Values.basic_auth }}
69+
- name: secret_mount_path
70+
value: "/var/secrets/gateway"
71+
- name: basic_auth
72+
value: "{{ .Values.basic_auth }}"
73+
volumeMounts:
74+
- name: auth
75+
readOnly: true
76+
mountPath: "/var/secrets/gateway"
77+
{{- end }}
78+
{{- with .Values.nodeSelector }}
79+
nodeSelector:
80+
{{ toYaml . | indent 8 }}
81+
{{- end }}
82+
{{- with .Values.affinity }}
83+
affinity:
84+
{{ toYaml . | indent 8 }}
85+
{{- end }}
86+
{{- with .Values.tolerations }}
87+
tolerations:
88+
{{ toYaml . | indent 8 }}
89+
{{- end }}
90+
{{- end }}

chart/openfaas/templates/queueworker-dep.yaml

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.async (not .Values.openfaasPro) }}
1+
{{- if and .Values.async .Values.openfaasPro }}
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
@@ -18,63 +18,107 @@ spec:
1818
template:
1919
metadata:
2020
annotations:
21-
prometheus.io/scrape: "false"
21+
prometheus.io/scrape: "true"
22+
prometheus.io/port: "8081"
2223
labels:
2324
app: queue-worker
2425
spec:
2526
{{- with .Values.imagePullSecrets }}
2627
imagePullSecrets:
2728
{{- toYaml . | nindent 8 }}
2829
{{- end }}
30+
{{- if .Values.jetstreamQueueWorker.topologySpreadConstraints }}
31+
topologySpreadConstraints:
32+
{{- toYaml .Values.jetstreamQueueWorker.topologySpreadConstraints | nindent 8 }}
33+
{{- end }}
2934
volumes:
30-
{{- if .Values.basic_auth }}
31-
- name: auth
35+
- name: license
3236
secret:
33-
secretName: basic-auth
34-
{{- end }}
37+
secretName: openfaas-license
3538
containers:
36-
- name: queue-worker
39+
- name: queue-worker
3740
resources:
3841
{{- .Values.queueWorker.resources | toYaml | nindent 12 }}
39-
image: {{ include "openfaas.image" (dict "image" .Values.queueWorker.image "registryPrefix" .Values.registryPrefix) }}
42+
image: {{ include "openfaas.image" (dict "image" .Values.jetstreamQueueWorker.image "registryPrefix" .Values.registryPrefix) }}
4043
imagePullPolicy: {{ .Values.openfaasImagePullPolicy }}
44+
{{- if .Values.jetstreamQueueWorker.pprof }}
45+
ports:
46+
- name: pprof
47+
containerPort: 6060
48+
protocol: TCP
49+
{{- end }}
50+
command:
51+
- "jetstream-queue-worker"
52+
- "-license-file=/var/secrets/license/license"
53+
{{- if .Values.jetstreamQueueWorker.pprof }}
54+
- "-pprof=true"
55+
{{- end }}
4156
env:
4257
{{- if .Values.nats.external.enabled }}
43-
- name: faas_nats_address
58+
- name: nats_host
4459
value: "{{ .Values.nats.external.host }}"
45-
- name: faas_nats_port
60+
- name: nats_port
4661
value: "{{ .Values.nats.external.port }}"
47-
- name: faas_nats_cluster_name
48-
value: "{{ .Values.nats.external.clusterName }}"
4962
{{- else }}
50-
- name: faas_nats_address
63+
- name: nats_host
5164
value: "nats.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
5265
{{- end}}
53-
- name: faas_nats_channel
66+
67+
# Only required for stream migration when upgrading queue-worker from version < 0.3.47
68+
# Not used once stream has been migrated.
69+
- name: nats_stream
5470
value: "{{ .Values.nats.channel }}"
55-
- name: faas_nats_queue_group
56-
value: "{{ .Values.queueWorker.queueGroup }}"
57-
- name: faas_gateway_address
58-
value: "gateway.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
59-
{{- if .Values.functionNamespace }}
60-
- name: faas_function_suffix
61-
value: ".{{ .Values.functionNamespace }}.svc.{{ .Values.kubernetesDNSDomain }}"
71+
- name: nats_durable
72+
value: "{{ .Values.jetstreamQueueWorker.durableName }}"
73+
- name: default_function_name
74+
value: "{{ .Values.functionNamespace }}"
75+
76+
- name: max_inflight
77+
value: "{{ .Values.queueWorkerPro.maxInflight }}"
78+
- name: "scaling_mode"
79+
value: "{{ .Values.jetstreamQueueWorker.mode }}"
80+
- name: "inactive_threshold"
81+
value: "{{ .Values.jetstreamQueueWorker.consumer.inactiveThreshold }}"
82+
{{- if .Values.jetstreamQueueWorker.consumer.pullMaxMessages }}
83+
- name: "consumer_pull_max_messages"
84+
value: "{{ .Values.jetstreamQueueWorker.consumer.pullMaxMessages }}"
6285
{{- end }}
86+
- name: gateway_url
87+
value: "http://gateway.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesDNSDomain }}:8080"
88+
- name: "tls_insecure"
89+
value: "{{ .Values.queueWorkerPro.insecureTLS }}"
90+
- name: "debug"
91+
value: "{{ .Values.jetstreamQueueWorker.logs.debug }}"
92+
- name: "log_encoding"
93+
value: "{{ .Values.jetstreamQueueWorker.logs.format }}"
94+
95+
- name: nats_stream_replicas
96+
value: "{{ .Values.nats.streamReplication }}"
6397
- name: ack_wait
6498
value: "{{ .Values.queueWorker.ackWait }}"
65-
- name: max_inflight
66-
value: "{{ (.Values.queueWorker.maxInflight ) ("1") }}"
6799

68-
{{- if .Values.basic_auth }}
69-
- name: secret_mount_path
70-
value: "/var/secrets/gateway"
71-
- name: basic_auth
72-
value: "{{ .Values.basic_auth }}"
100+
- name: upstream_timeout
101+
value: "{{ .Values.gateway.upstreamTimeout }}"
102+
- name: "max_retry_attempts"
103+
value: "{{ .Values.queueWorkerPro.maxRetryAttempts }}"
104+
- name: "max_retry_wait"
105+
value: "{{ .Values.queueWorkerPro.maxRetryWait }}"
106+
- name: "initial_retry_wait"
107+
value: "{{ .Values.queueWorkerPro.initialRetryWait }}"
108+
- name: "retry_http_codes"
109+
value: "{{ .Values.queueWorkerPro.httpRetryCodes }}"
110+
- name: backoff
111+
value: "{{ .Values.queueWorkerPro.backoff }}"
112+
113+
{{- if .Values.securityContext }}
114+
securityContext:
115+
{{- toYaml .Values.securityContext | nindent 10 }}
116+
{{- end }}
117+
73118
volumeMounts:
74-
- name: auth
119+
- name: license
75120
readOnly: true
76-
mountPath: "/var/secrets/gateway"
77-
{{- end }}
121+
mountPath: "/var/secrets/license"
78122
{{- with .Values.nodeSelector }}
79123
nodeSelector:
80124
{{ toYaml . | indent 8 }}

0 commit comments

Comments
 (0)