1- {{- if and .Values.async (not .Values.openfaasPro) }}
1+ {{- if and .Values.async .Values.openfaasPro }}
22apiVersion : apps/v1
33kind : Deployment
44metadata :
@@ -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