1- {{- if and .Values.async (not .Values.openfaasPro) }}
1+ {{- if and .Values.async .Values.openfaasPro }}
22apiVersion : apps/v1
33kind : Deployment
44metadata :
@@ -18,63 +18,111 @@ 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 }}"
97+ - name : " max_reconnect"
98+ value : " {{ .Values.nats.reconnect.attempts }}"
99+ - name : " reconnect_delay"
100+ value : " {{ .Values.nats.reconnect.delay }}"
63101 - name : ack_wait
64102 value : " {{ .Values.queueWorker.ackWait }}"
65- - name : max_inflight
66- value : " {{ (.Values.queueWorker.maxInflight ) (" 1") }}"
67103
68- {{- if .Values.basic_auth }}
69- - name : secret_mount_path
70- value : " /var/secrets/gateway"
71- - name : basic_auth
72- value : " {{ .Values.basic_auth }}"
104+ - name : upstream_timeout
105+ value : " {{ .Values.gateway.upstreamTimeout }}"
106+ - name : " max_retry_attempts"
107+ value : " {{ .Values.queueWorkerPro.maxRetryAttempts }}"
108+ - name : " max_retry_wait"
109+ value : " {{ .Values.queueWorkerPro.maxRetryWait }}"
110+ - name : " initial_retry_wait"
111+ value : " {{ .Values.queueWorkerPro.initialRetryWait }}"
112+ - name : " retry_http_codes"
113+ value : " {{ .Values.queueWorkerPro.httpRetryCodes }}"
114+ - name : backoff
115+ value : " {{ .Values.queueWorkerPro.backoff }}"
116+
117+ {{- if .Values.securityContext }}
118+ securityContext :
119+ {{- toYaml .Values.securityContext | nindent 10 }}
120+ {{- end }}
121+
73122 volumeMounts :
74- - name : auth
123+ - name : license
75124 readOnly : true
76- mountPath : " /var/secrets/gateway"
77- {{- end }}
125+ mountPath : " /var/secrets/license"
78126 {{- with .Values.nodeSelector }}
79127 nodeSelector :
80128{{ toYaml . | indent 8 }}
0 commit comments