-
Notifications
You must be signed in to change notification settings - Fork 418
/
cost-analyzer-deployment-template.yaml
1193 lines (1191 loc) · 49.9 KB
/
cost-analyzer-deployment-template.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{{- if and (not .Values.agent) (not .Values.cloudAgent) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "cost-analyzer.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- with .Values.global.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if and .Values.kubecostDeployment .Values.kubecostDeployment.labels }}
{{- toYaml .Values.kubecostDeployment.labels | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.global.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if and .Values.kubecostDeployment .Values.kubecostDeployment.annotations }}
{{- toYaml .Values.kubecostDeployment.annotations | nindent 4 }}
{{- end }}
spec:
{{- if .Values.kubecostDeployment }}
replicas: {{ .Values.kubecostDeployment.replicas | default 1 }}
{{- end }}
selector:
matchLabels:
{{- include "cost-analyzer.selectorLabels" . | nindent 8}}
{{- if .Values.kubecostDeployment }}
{{- if .Values.kubecostDeployment.deploymentStrategy }}
{{- with .Values.kubecostDeployment.deploymentStrategy }}
strategy: {{ toYaml . | nindent 4 }}
{{- end }}
{{- else }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
{{- end }}
{{- end }}
template:
metadata:
labels:
{{- include "cost-analyzer.selectorLabels" . | nindent 8 }}
{{- if .Values.global.additionalLabels }}
{{ toYaml .Values.global.additionalLabels | nindent 8 }}
{{- end }}
{{- if and .Values.kubecostDeployment .Values.kubecostDeployment.labels }}
{{- toYaml .Values.kubecostDeployment.labels | nindent 8 }}
{{- end }}
annotations:
{{- with .Values.global.podAnnotations}}
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/configs: {{ include "configsChecksum" . }}
spec:
{{- if .Values.global.platforms.openshift.enabled }}
securityContext:
{{- toYaml .Values.global.platforms.openshift.securityContext | nindent 8 }}
{{- else if .Values.global.securityContext }}
securityContext:
{{- toYaml .Values.global.securityContext | nindent 8 }}
{{- else }}
securityContext:
runAsUser: 1001
runAsGroup: 1001
fsGroup: 1001
{{- end }}
restartPolicy: Always
serviceAccountName: {{ template "cost-analyzer.serviceAccountName" . }}
volumes:
{{- if .Values.kubecostModel.plugins.enabled }}
- name: plugins-dir
emptyDir: {}
{{- if and (not .Values.kubecostModel.plugins.existingCustomSecret.enabled) .Values.kubecostModel.plugins.secretName }}
- name: plugins-config
secret:
secretName: {{ .Values.kubecostModel.plugins.secretName }}
items:
{{- range $key, $config := .Values.kubecostModel.plugins.enabledPlugins}}
- key: {{ $config }}_config.json
path: {{ $config }}_config.json
{{- end }}
{{- end }}
{{- if .Values.kubecostModel.plugins.existingCustomSecret.enabled }}
- name: plugins-config
secret:
secretName: {{ .Values.kubecostModel.plugins.existingCustomSecret.name }}
items:
{{- range $key, $config := .Values.kubecostModel.plugins.enabledPlugins }}
- key: {{ $config }}_config.json
path: {{ $config }}_config.json
{{- end }}
{{- end }}
{{- if .Values.kubecostModel.plugins.install.enabled}}
- name: install-script
configMap:
name: {{ template "cost-analyzer.fullname" . }}-install-plugins
{{- end }}
{{- end }}
{{- if .Values.global.gcpstore.enabled }}
- name: ubbagent-config
configMap:
name: ubbagent-config
{{- end }}
- name: tmp
emptyDir: {}
{{- if and .Values.kubecostFrontend.enabled (not .Values.federatedETL.agentOnly) (not (eq (include "frontend.deployMethod" .) "haMode")) }}
- name: nginx-conf
configMap:
name: nginx-conf
items:
- key: nginx.conf
path: default.conf
{{- end }}
{{- if .Values.global.containerSecuritycontext }}
- name: var-run
emptyDir: { }
- name: cache
emptyDir: { }
{{- end }}
{{- if or .Values.kubecostModel.federatedStorageConfigSecret .Values.kubecostModel.federatedStorageConfig }}
- name: federated-storage-config
secret:
defaultMode: 420
secretName: {{ .Values.kubecostModel.federatedStorageConfigSecret | default "federated-store" }}
{{- end }}
{{- if .Values.kubecostProductConfigs }}
{{- if and ((.Values.kubecostProductConfigs).productKey).enabled ((.Values.kubecostProductConfigs).productKey).secretname }}
- name: productkey-secret
secret:
secretName: {{ .Values.kubecostProductConfigs.productKey.secretname }}
items:
- key: productkey.json
path: productkey.json
{{- end }}
{{- if ((.Values.kubecostProductConfigs).smtp).secretname }}
- name: smtp-secret
secret:
secretName: {{ .Values.kubecostProductConfigs.smtp.secretname }}
items:
- key: smtp.json
path: smtp.json
{{- end }}
{{- if .Values.kubecostProductConfigs }}
{{- if .Values.kubecostProductConfigs.gcpSecretName }}
- name: gcp-key-secret
secret:
secretName: {{ .Values.kubecostProductConfigs.gcpSecretName }}
items:
- key: {{ .Values.kubecostProductConfigs.gcpSecretKeyName | default "compute-viewer-kubecost-key.json" }}
path: service-key.json
{{- end }}
{{- end -}}
{{- if .Values.kubecostProductConfigs.serviceKeySecretName }}
- name: service-key-secret
secret:
secretName: {{ .Values.kubecostProductConfigs.serviceKeySecretName }}
{{- else if .Values.kubecostProductConfigs.createServiceKeySecret }}
- name: service-key-secret
secret:
secretName: cloud-service-key
{{- end }}
{{- if .Values.kubecostProductConfigs.cloudIntegrationSecret }}
- name: cloud-integration
secret:
secretName: {{ .Values.kubecostProductConfigs.cloudIntegrationSecret }}
items:
- key: cloud-integration.json
path: cloud-integration.json
{{- else if or .Values.kubecostProductConfigs.cloudIntegrationJSON ((.Values.kubecostProductConfigs).athenaBucketName) }}
- name: cloud-integration
secret:
secretName: cloud-integration
items:
- key: cloud-integration.json
path: cloud-integration.json
{{- end }}
{{- if .Values.kubecostProductConfigs.clusters }}
- name: kubecost-clusters
configMap:
name: kubecost-clusters
{{- range .Values.kubecostProductConfigs.clusters }}
{{- if .auth }}
{{- if .auth.secretName }}
- name: {{ .auth.secretName }}
secret:
secretName: {{ .auth.secretName }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.kubecostFrontend.tls }}
{{- if .Values.kubecostFrontend.tls.enabled }}
- name: tls
secret:
secretName : {{ .Values.kubecostFrontend.tls.secretName }}
items:
- key: tls.crt
path: kc.crt
- key: tls.key
path: kc.key
{{- end }}
{{- end }}
{{- if .Values.kubecostAdmissionController }}
{{- if .Values.kubecostAdmissionController.enabled }}
{{- if .Values.kubecostAdmissionController.secretName }}
- name: webhook-server-tls
secret:
secretName: {{ .Values.kubecostAdmissionController.secretName }}
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.saml }}
{{- if .Values.saml.enabled }}
{{- if .Values.saml.secretName }}
- name: secret-volume
secret:
secretName: {{ .Values.saml.secretName }}
{{- end }}
{{- if .Values.saml.encryptionCertSecret }}
- name: saml-encryption-cert
secret:
secretName: {{ .Values.saml.encryptionCertSecret }}
{{- end }}
{{- if .Values.saml.decryptionKeySecret }}
- name: saml-decryption-key
secret:
secretName: {{ .Values.saml.decryptionKeySecret }}
{{- end }}
{{- if .Values.saml.metadataSecretName }}
- name: metadata-secret-volume
secret:
secretName: {{ .Values.saml.metadataSecretName }}
{{- end }}
- name: saml-auth-secret
secret:
secretName: {{ .Values.saml.authSecretName | default "kubecost-saml-secret" }}
{{- if .Values.saml.rbac.enabled }}
- name: saml-roles
configMap:
name: {{ template "cost-analyzer.fullname" . }}-saml
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.oidc }}
{{- if .Values.oidc.enabled }}
- name: oidc-config
configMap:
name: {{ template "cost-analyzer.fullname" . }}-oidc
{{- if and (not .Values.oidc.existingCustomSecret.enabled) .Values.oidc.secretName }}
- name: oidc-client-secret
secret:
secretName: {{ .Values.oidc.secretName }}
{{- end }}
{{- if .Values.oidc.existingCustomSecret.enabled }}
- name: oidc-client-secret
secret:
secretName: {{ .Values.oidc.existingCustomSecret.name }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumes }}
# Extra volume(s)
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
- name: persistent-configs
{{- if .Values.persistentVolume }}
{{- if .Values.persistentVolume.enabled }}
persistentVolumeClaim:
{{- if .Values.persistentVolume.existingClaim }}
claimName: {{ .Values.persistentVolume.existingClaim }}
{{- else }}
claimName: {{ template "cost-analyzer.fullname" . }}
{{- end -}}
{{- else }}
emptyDir: {}
{{- end -}}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "cost-analyzer.fullname" . }}
{{- end }}
{{- if .Values.persistentVolume.dbPVEnabled }}
- name: persistent-db
{{- if .Values.persistentVolume }}
{{- if .Values.persistentVolume.enabled }}
persistentVolumeClaim:
{{- if .Values.persistentVolume.dbExistingClaim }}
claimName: {{ .Values.persistentVolume.dbExistingClaim }}
{{- else }}
claimName: {{ template "cost-analyzer.fullname" . }}-db
{{- end -}}
{{- else }}
emptyDir: {}
{{- end -}}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "cost-analyzer.fullname" . }}-db
{{- end }}
{{- end }}
initContainers:
{{- if and .Values.kubecostModel.plugins.enabled (not (eq (include "aggregator.deployMethod" .) "statefulset")) }}
- name: plugin-installer
image: {{ .Values.kubecostModel.plugins.install.fullImageName }}
command: ["sh", "/install/install_plugins.sh"]
{{- with .Values.kubecostModel.plugins.install.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: install-script
mountPath: /install
- name: plugins-dir
mountPath: {{ .Values.kubecostModel.plugins.folder }}
{{- end }}
{{- if .Values.supportNFS }}
- name: config-db-perms-fix
{{- if .Values.initChownDataImage }}
image: {{ .Values.initChownDataImage }}
{{- else }}
image: busybox
{{- end }}
{{- with .Values.initChownData.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.persistentVolume.dbPVEnabled }}
command: ["sh", "-c", "/bin/chmod -R 777 /var/configs && /bin/chmod -R 777 /var/db"]
{{- else }}
command: ["sh", "-c", "/bin/chmod -R 777 /var/configs"]
{{- end }}
volumeMounts:
- name: persistent-configs
mountPath: /var/configs
{{- if .Values.persistentVolume.dbPVEnabled }}
- name: persistent-db
mountPath: /var/db
{{- end }}
securityContext:
runAsUser: 0
{{ end }}
containers:
{{- if .Values.global.gmp.enabled }}
- name: {{ .Values.global.gmp.gmpProxy.name }}
image: {{ .Values.global.gmp.gmpProxy.image }}
{{- if .Values.global.gmp.gmpProxy.imagePullPolicy }}
imagePullPolicy: {{ .Values.global.gmp.gmpProxy.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
args:
- "--web.listen-address=:{{ .Values.global.gmp.gmpProxy.port }}"
- "--query.project-id={{ .Values.global.gmp.gmpProxy.projectId }}"
{{- if .Values.systemProxy.enabled }}
env:
- name: HTTP_PROXY
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: http_proxy
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: HTTPS_PROXY
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: https_proxy
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: NO_PROXY
value: "{{ .Values.systemProxy.noProxy }}"
- name: no_proxy
value: "{{ .Values.systemProxy.noProxy }}"
{{- end }}
ports:
- name: web
containerPort: {{ .Values.global.gmp.gmpProxy.port | int }}
readinessProbe:
httpGet:
path: /-/ready
port: web
livenessProbe:
httpGet:
path: /-/healthy
port: web
{{- end }}
{{- if .Values.global.amp.enabled }}
- name: sigv4proxy
image: {{ .Values.sigV4Proxy.image }}
{{- if .Values.sigV4Proxy.imagePullPolicy }}
imagePullPolicy: {{ .Values.sigV4Proxy.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
{{- if .Values.global.containerSecurityContext }}
securityContext:
{{- toYaml .Values.global.containerSecurityContext | nindent 12 -}}
{{- end }}
{{- with .Values.sigV4Proxy.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
args:
- --name
- {{ .Values.sigV4Proxy.name }}
- --region
- {{ .Values.sigV4Proxy.region }}
- --host
- {{ .Values.sigV4Proxy.host }}
{{- if .Values.sigV4Proxy.role_arn }}
- --role-arn
- {{ .Values.sigV4Proxy.role_arn }}
{{- end }}
- --port
- :{{ .Values.sigV4Proxy.port }}
ports:
- name: aws-sigv4-proxy
containerPort: {{ .Values.sigV4Proxy.port | int }}
env:
- name: AGENT_LOCAL_PORT
value: "{{ .Values.sigV4Proxy.port | int }}"
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: http_proxy
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: HTTPS_PROXY
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: https_proxy
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: NO_PROXY
value: "{{ .Values.systemProxy.noProxy }}"
- name: no_proxy
value: "{{ .Values.systemProxy.noProxy }}"
{{- end }}
{{- if .Values.sigV4Proxy.extraEnv }}
{{- toYaml .Values.sigV4Proxy.extraEnv | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.global.gcpstore.enabled }}
- name: ubbagent
image: gcr.io/kubecost1/gcp-mp/ent/cost-model/ubbagent:1.0
env:
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
- name: AGENT_CONFIG_FILE
value: "/etc/ubbagent/config.yaml"
- name: AGENT_LOCAL_PORT
value: "6080"
- name: AGENT_ENCODED_KEY
valueFrom:
secretKeyRef:
name: {{ default "kubecost-reporting-secret" .Values.reportingSecret }}
key: reporting-key
- name: AGENT_CONSUMER_ID
valueFrom:
secretKeyRef:
name: {{ default "kubecost-reporting-secret" .Values.reportingSecret }}
key: consumer-id
volumeMounts:
- name: ubbagent-config
mountPath: /etc/ubbagent
{{- end }}
{{- if .Values.global.ammsp.enabled }}
# This section of the chart borrows liberally from
# https://github.com/Azure/aad-auth-proxy/blob/main/deploy/chart/aad-auth-proxy/templates/deployment.yaml
- name: {{ .Values.global.ammsp.aadAuthProxy.name }}
image: {{ .Values.global.ammsp.aadAuthProxy.image }}
{{- if .Values.global.ammsp.aadAuthProxy.imagePullPolicy }}
imagePullPolicy: {{ .Values.global.ammsp.aadAuthProxy.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
env:
- name: AUDIENCE
value: {{ .Values.global.ammsp.aadAuthProxy.audience }}
- name: TARGET_HOST
value: {{ .Values.global.ammsp.queryEndpoint }}
- name: LISTENING_PORT
value: {{ .Values.global.ammsp.aadAuthProxy.port | quote }}
- name: IDENTITY_TYPE
value: {{ .Values.global.ammsp.aadAuthProxy.identityType }}
{{- if eq .Values.global.ammsp.aadAuthProxy.identityType "userAssigned" }}
- name: AAD_CLIENT_ID
value: {{ required "aadClientId is required for userAssigned identity types" .Values.global.ammsp.aadAuthProxy.aadClientId | toString | trim | quote }}
{{- else if eq .Values.global.ammsp.aadAuthProxy.identityType "aadApplication" }}
- name: AAD_CLIENT_ID
value: {{ required "aadClientId is required for aadApplication identity types" .Values.global.ammsp.aadAuthProxy.aadClientId | toString | trim | quote }}
- name: AAD_TENANT_ID
value: {{ required "aadTenantId is required for aadApplication identity type" .Values.global.ammsp.aadAuthProxy.aadTenantId | toString | trim | quote }}
- name: AAD_CLIENT_CERTIFICATE_PATH
value: {{ required "aadClientCertificatePath is required for aadApplication identity type" .Values.global.ammsp.aadAuthProxy.aadClientCertificatePath | toString | trim | quote }}
{{- end }}
- name: AAD_TOKEN_REFRESH_INTERVAL_IN_PERCENTAGE
value: "10"
- name: OTEL_SERVICE_NAME
value: {{ .Values.global.ammsp.aadAuthProxy.name | replace "-" "_" }}
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: http_proxy
value: "{{ .Values.systemProxy.httpProxyUrl }}"
- name: HTTPS_PROXY
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: https_proxy
value: "{{ .Values.systemProxy.httpsProxyUrl }}"
- name: NO_PROXY
value: "{{ .Values.systemProxy.noProxy }}"
- name: no_proxy
value: "{{ .Values.systemProxy.noProxy }}"
{{- end }}
ports:
- name: http
containerPort: {{ .Values.global.ammsp.aadAuthProxy.port | int }}
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /ready
port: http
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: http
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
{{- end }}
- image: {{ include "cost-model.image" . | trim | quote}}
name: cost-model
{{- if .Values.kubecostModel.extraArgs }}
args:
{{- toYaml .Values.kubecostModel.extraArgs | nindent 12 }}
{{- end }}
securityContext:
{{- if .Values.kubecostModel.securityContext }}
{{- toYaml .Values.kubecostModel.securityContext | nindent 12 -}}
{{- else if .Values.global.containerSecurityContext }}
{{- toYaml .Values.global.containerSecurityContext | nindent 12 -}}
{{- end }}
{{- if .Values.kubecostModel.imagePullPolicy }}
imagePullPolicy: {{ .Values.kubecostModel.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
ports:
- name: tcp-model
containerPort: 9003
protocol: TCP
{{- if and .Values.kubecostFrontend.enabled (not .Values.federatedETL.agentOnly) (not (eq (include "frontend.deployMethod" .) "haMode")) }}
- name: tcp-frontend
containerPort: 9090
protocol: TCP
{{- end }}
{{- with .Values.kubecostModel.extraPorts }}
{{- toYaml . | nindent 10 }}
{{- end }}
resources:
{{ toYaml .Values.kubecostModel.resources | indent 12 }}
{{- if .Values.kubecostModel.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: 9003
initialDelaySeconds: {{ .Values.kubecostModel.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.kubecostModel.readinessProbe.periodSeconds}}
failureThreshold: {{ .Values.kubecostModel.readinessProbe.failureThreshold}}
{{- end }}
{{- if .Values.kubecostModel.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: 9003
initialDelaySeconds: {{ .Values.kubecostModel.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.kubecostModel.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.kubecostModel.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.global.containerSecuritycontext }}
securityContext:
{{- toYaml .Values.global.containerSecuritycontext | nindent 12 }}
{{- end }}
volumeMounts:
- name: persistent-configs
mountPath: /var/configs
{{- if .Values.extraVolumeMounts }}
# Extra volume mount(s)
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.persistentVolume.dbPVEnabled }}
- name: persistent-db
mountPath: /var/db
{{- end }}
{{- if or .Values.kubecostModel.federatedStorageConfigSecret .Values.kubecostModel.federatedStorageConfig }}
- name: federated-storage-config
mountPath: /var/configs/etl/federated
readOnly: true
{{- end }}
{{- if .Values.kubecostAdmissionController }}
{{- if .Values.kubecostAdmissionController.enabled }}
{{- if .Values.kubecostAdmissionController.secretName }}
- name: {{ .Values.kubecostAdmissionController.secretName }}
mountPath: /certs
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.kubecostProductConfigs }}
{{- if and ((.Values.kubecostProductConfigs).productKey).enabled ((.Values.kubecostProductConfigs).productKey).secretname }}
- name: productkey-secret
mountPath: /var/configs/productkey
{{- end }}
{{- if ((.Values.kubecostProductConfigs).smtp).secretname }}
- name: smtp-secret
mountPath: /var/configs/smtp
{{- end }}
{{- if .Values.kubecostProductConfigs.gcpSecretName }}
- name: gcp-key-secret
mountPath: /var/secrets
{{- end }}
{{- if or .Values.kubecostProductConfigs.serviceKeySecretName .Values.kubecostProductConfigs.createServiceKeySecret }}
- name: service-key-secret
mountPath: /var/secrets
{{- end }}
{{- if .Values.kubecostProductConfigs.clusters }}
- name: kubecost-clusters
mountPath: /var/configs/clusters
{{- range .Values.kubecostProductConfigs.clusters }}
{{- if .auth }}
{{- if .auth.secretName }}
- name: {{ .auth.secretName }}
mountPath: /var/secrets/{{ .auth.secretName }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.saml }}
{{- if .Values.saml.enabled }}
{{- if .Values.saml.secretName }}
- name: secret-volume
mountPath: /var/configs/secret-volume
{{- end }}
{{- if .Values.saml.encryptionCertSecret }}
- name: saml-encryption-cert
mountPath: /var/configs/saml-encryption-cert
{{- end }}
{{- if .Values.saml.decryptionKeySecret }}
- name: saml-decryption-key
mountPath: /var/configs/saml-decryption-key
{{- end }}
{{- if .Values.saml.metadataSecretName }}
- name: metadata-secret-volume
mountPath: /var/configs/metadata-secret-volume
{{- end }}
- name: saml-auth-secret
mountPath: /var/configs/saml-auth-secret
{{- if .Values.saml.rbac.enabled }}
- name: saml-roles
mountPath: /var/configs/saml
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.oidc }}
{{- if .Values.oidc.enabled }}
- name: oidc-config
mountPath: /var/configs/oidc
{{- if or .Values.oidc.existingCustomSecret.name .Values.oidc.secretName }}
- name: oidc-client-secret
mountPath: /var/configs/oidc-client-secret
{{- end }}
{{- end }}
{{- end }}
env:
- name: CONTAINER_IMAGE_TAG
value: {{ include "cost-model.imagetag" . }}
{{- if .Values.global.grafana }}
- name: GRAFANA_ENABLED
value: "{{ template "cost-analyzer.grafanaEnabled" . }}"
{{- end}}
- name: LOG_LEVEL
value: {{ .Values.kubecostModel.logLevel }}
{{- if .Values.kubecostModel.extraEnv -}}
{{ toYaml .Values.kubecostModel.extraEnv | nindent 12 }}
{{- end }}
{{- if .Values.reporting }}
{{- if .Values.reporting.valuesReporting }}
- name: HELM_VALUES
value: {{ template "cost-analyzer.filterEnabled" .Values }}
{{- end }}
{{- end }}
{{- if .Values.alertConfigmapName }}
- name: ALERT_CONFIGMAP_NAME
value: {{ .Values.alertConfigmapName }}
{{- end }}
{{- if .Values.productConfigmapName }}
- name: PRODUCT_CONFIGMAP_NAME
value: {{ .Values.productConfigmapName }}
{{- end }}
{{- if .Values.smtpConfigmapName }}
- name: SMTP_CONFIGMAP_NAME
value: {{ .Values.smtpConfigmapName }}
{{- end }}
{{- if .Values.appConfigmapName }}
- name: APP_CONFIGMAP_NAME
value: {{ .Values.appConfigmapName }}
{{- end }}
{{- if .Values.kubecostModel.softMemoryLimit }}
- name: GOMEMLIMIT
value: {{ .Values.kubecostModel.softMemoryLimit }}
{{- end }}
{{- if .Values.assetReportConfigmapName }}
- name: ASSET_REPORT_CONFIGMAP_NAME
value: {{ .Values.assetReportConfigmapName }}
{{- end }}
{{- if .Values.cloudCostReportConfigmapName }}
- name: CLOUD_COST_REPORT_CONFIGMAP_NAME
value: {{ .Values.cloudCostReportConfigmapName }}
{{- end }}
{{- if .Values.savedReportConfigmapName }}
- name: SAVED_REPORT_CONFIGMAP_NAME
value: {{ .Values.savedReportConfigmapName }}
{{- end }}
{{- if .Values.groupFiltersConfigmapName }}
- name: GROUP_FILTERS_CONFIGMAP_NAME
value: {{ .Values.groupFiltersConfigmapName }}
{{- end }}
{{- if .Values.pricingConfigmapName }}
- name: PRICING_CONFIGMAP_NAME
value: {{ .Values.pricingConfigmapName }}
{{- end }}
{{- if .Values.metricsConfigmapName }}
- name: METRICS_CONFIGMAP_NAME
value: {{ .Values.metricsConfigmapName }}
{{- end }}
- name: READ_ONLY
value: {{ (quote .Values.readonly) | default (quote false) }}
- name: PROMETHEUS_SERVER_ENDPOINT
valueFrom:
configMapKeyRef:
name: {{ template "cost-analyzer.fullname" . }}
key: prometheus-server-endpoint
- name: CLOUD_PROVIDER_API_KEY
value: "AIzaSyDXQPG_MHUEy9neR7stolq6l0ujXmjJlvk" # The GCP Pricing API key.This GCP api key is expected to be here and is limited to accessing google's billing API.
{{- if .Values.kubecostProductConfigs }}
{{- if .Values.kubecostProductConfigs.gcpSecretName }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /var/configs/key.json
{{- end }}
{{- end }}
- name: CONFIG_PATH
value: /var/configs/
- name: DB_PATH
value: /var/db/
- name: CLUSTER_PROFILE
{{- if .Values.kubecostProductConfigs }}
value: {{ .Values.kubecostProductConfigs.clusterProfile | default "production" }}
{{- else }}
value: production
{{- end }}
{{- if .Values.kubecostProductConfigs }}
{{- if ((.Values.kubecostProductConfigs).productKey).mountPath }}
- name: PRODUCT_KEY_MOUNT_PATH
value: {{ .Values.kubecostProductConfigs.productKey.mountPath }}
{{- end }}
{{- if ((.Values.kubecostProductConfigs).smtp).mountPath }}
- name: SMTP_CONFIG_MOUNT_PATH
value: {{ .Values.kubecostProductConfigs.smtp.mountPath }}
{{- end }}
{{- if .Values.kubecostProductConfigs.ingestPodUID }}
- name: INGEST_POD_UID
value: {{ (quote .Values.kubecostProductConfigs.ingestPodUID) }}
{{- end }}
{{- if .Values.kubecostProductConfigs.regionOverrides }}
- name: REGION_OVERRIDE_LIST
value: {{ (quote .Values.kubecostProductConfigs.regionOverrides) }}
{{- end }}
{{- end }}
{{- if .Values.global.prometheus.queryServiceBasicAuthSecretName}}
- name: DB_BASIC_AUTH_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.global.prometheus.queryServiceBasicAuthSecretName }}
key: USERNAME
- name: DB_BASIC_AUTH_PW
valueFrom:
secretKeyRef:
name: {{ .Values.global.prometheus.queryServiceBasicAuthSecretName }}
key: PASSWORD
{{- end }}
{{- if .Values.global.prometheus.queryServiceBearerTokenSecretName }}
- name: DB_BEARER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.global.prometheus.queryServiceBearerTokenSecretName }}
key: TOKEN
{{- end }}
{{- if .Values.global.prometheus.insecureSkipVerify }}
- name: INSECURE_SKIP_VERIFY
value: {{ (quote .Values.global.prometheus.insecureSkipVerify) }}
{{- end }}
{{- if .Values.global.prometheus.kubeRBACProxy }}
- name: KUBE_RBAC_PROXY_ENABLED
value: {{ (quote .Values.global.prometheus.kubeRBACProxy) }}
{{- end }}
{{- if .Values.pricingCsv }}
{{- if .Values.pricingCsv.enabled }}
- name: USE_CSV_PROVIDER
value: "true"
- name: CSV_PATH
value: {{ .Values.pricingCsv.location.URI }}
- name: CSV_REGION
value: {{ .Values.pricingCsv.location.region }}
{{- if eq .Values.pricingCsv.location.provider "AWS"}}
{{- if .Values.pricingCsv.location.csvAccessCredentials }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ .Values.pricingCsv.location.csvAccessCredentials }}
key: AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.pricingCsv.location.csvAccessCredentials }}
key: AWS_SECRET_ACCESS_KEY
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.kubecostMetrics }}
- name: EMIT_POD_ANNOTATIONS_METRIC
value: {{ (quote .Values.kubecostMetrics.emitPodAnnotations) | default (quote false) }}
- name: EMIT_NAMESPACE_ANNOTATIONS_METRIC
value: {{ (quote .Values.kubecostMetrics.emitNamespaceAnnotations) | default (quote false) }}
{{- end }}
{{- if .Values.kubecostMetrics }}
- name: EMIT_KSM_V1_METRICS
value: {{ (quote .Values.kubecostMetrics.emitKsmV1Metrics) | default (quote true) }}
{{- end }}
{{- if .Values.kubecostMetrics }}
- name: EMIT_KSM_V1_METRICS_ONLY # ONLY emit KSM v1 metrics that do not exist in KSM 2 by default
value: {{ (quote .Values.kubecostMetrics.emitKsmV1MetricsOnly) | default (quote false) }}
{{- end }}
{{- if .Values.reporting }}
- name: LOG_COLLECTION_ENABLED
value: {{ (quote .Values.reporting.logCollection) | default (quote true) }}
- name: PRODUCT_ANALYTICS_ENABLED
value: {{ (quote .Values.reporting.productAnalytics) | default (quote true) }}
- name: ERROR_REPORTING_ENABLED
value: {{ (quote .Values.reporting.errorReporting ) | default (quote true) }}
- name: VALUES_REPORTING_ENABLED
value: {{ (quote .Values.reporting.valuesReporting) | default (quote true) }}
{{- if .Values.reporting.errorReporting }}
- name: SENTRY_DSN
value: "https://71964476292e4087af8d5072afe43abd@o394722.ingest.sentry.io/5245431"
{{- end }}
{{- end }}
{{- if or .Values.kubecostModel.federatedStorageConfigSecret .Values.kubecostModel.federatedStorageConfig }}
- name: FEDERATED_STORE_CONFIG
value: "/var/configs/etl/federated/federated-store.yaml"
{{- end }}
{{- if or .Values.federatedETL.federatedCluster .Values.kubecostModel.federatedStorageConfigSecret .Values.kubecostModel.federatedStorageConfig }}
- name: FEDERATED_CLUSTER
{{- if eq .Values.federatedETL.readOnlyPrimary true }}
value: "false"
{{- else }}
value: "true"
{{- end }}
{{- end }}
{{- if .Values.federatedETL.redirectS3Backup }}
- name: FEDERATED_REDIRECT_BACKUP
value: "true"
{{- end }}
{{- if .Values.federatedETL.useMultiClusterDB }}
- name: CURRENT_CLUSTER_ID_FILTER_ENABLED
value: "true"
{{- end }}
{{- if .Values.persistentVolume.dbPVEnabled }}
- name: ETL_PATH_PREFIX
value: "/var/db"
{{- end }}
- name: ETL_RESOLUTION_SECONDS
value: {{ (quote .Values.kubecostModel.etlResolutionSeconds) | default (quote 300) }}
- name: ETL_MAX_PROMETHEUS_QUERY_DURATION_MINUTES
value: {{ (quote .Values.kubecostModel.maxPrometheusQueryDurationMinutes) | default (quote 1440) }}
- name: ETL_DAILY_STORE_DURATION_DAYS
value: {{ (quote .Values.kubecostModel.etlDailyStoreDurationDays) }}
- name: ETL_HOURLY_STORE_DURATION_HOURS
value: {{ (quote .Values.kubecostModel.etlHourlyStoreDurationHours) | default (quote 49) }}
{{- if .Values.kubecostModel }}
{{- if .Values.kubecostModel.allocation }}
{{- if .Values.kubecostModel.allocation.nodeLabels }}
{{- with .Values.kubecostModel.allocation.nodeLabels }}
- name: ALLOCATION_NODE_LABELS_ENABLED
value: {{ (quote .enabled) | default (quote true) }}
- name: ALLOCATION_NODE_LABELS_INCLUDE_LIST
value: {{ (quote .includeList) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
- name: CONTAINER_STATS_ENABLED
value: {{ (quote .Values.kubecostModel.containerStatsEnabled) | default (quote false) }}
{{- if .Values.systemProxy.enabled }}
- name: HTTP_PROXY
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: http_proxy
value: {{ .Values.systemProxy.httpProxyUrl }}
- name: HTTPS_PROXY
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: https_proxy
value: {{ .Values.systemProxy.httpsProxyUrl }}
- name: NO_PROXY
value: {{ .Values.systemProxy.noProxy }}
- name: no_proxy
value: {{ .Values.systemProxy.noProxy }}
{{- end }}
- name: PV_ENABLED
value: {{ (quote .Values.persistentVolume.enabled) | default (quote true) }}
- name: MAX_QUERY_CONCURRENCY
value: {{ (quote .Values.kubecostModel.maxQueryConcurrency) | default (quote 5) }}
- name: UTC_OFFSET
value: {{ (quote .Values.kubecostModel.utcOffset) | default (quote ) }}
{{- if .Values.networkCosts }}
{{- if .Values.networkCosts.enabled }}
- name: NETWORK_COSTS_PORT
value: {{ quote .Values.networkCosts.port | default (quote 3001) }}
# ADVANCED_NETWORK_STATS is a feature offered by Kubecost that gives you network
# insights of your Kubernetes resources with cloud services. The feature is
# enabled when network cost is enabled and one of the service tagging is enabled
{{- if .Values.networkCosts.config.services }}
{{- $services := .Values.networkCosts.config.services -}}
{{- if or (index $services "google-cloud-services") (index $services "amazon-web-services") (index $services "azure-cloud-services")}}
- name: ADVANCED_NETWORK_STATS
value: "true"
{{- else}}
- name: ADVANCED_NETWORK_STATS
value: "false"
{{- end}}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.oidc.enabled }}
- name: OIDC_ENABLED
value: "true"
- name: OIDC_SKIP_ONLINE_VALIDATION
value: {{ (quote .Values.oidc.skipOnlineTokenValidation) | default (quote false) }}
{{- end}}
{{- if .Values.saml }}
{{- if .Values.saml.enabled }}
- name: SAML_ENABLED
value: "true"
- name: IDP_URL
value: {{ .Values.saml.idpMetadataURL }}
- name: SP_HOST
value: {{ .Values.saml.appRootURL }}
{{- if .Values.saml.audienceURI }}
- name: AUDIENCE_URI
value: {{ .Values.saml.audienceURI }}
{{- end }}
{{- if .Values.saml.isGLUUProvider }}
- name: GLUU_SAML_PROVIDER
value: {{ (quote .Values.saml.isGLUUProvider) }}
{{- end }}
{{- if .Values.saml.nameIDFormat }}
- name: NAME_ID_FORMAT
value: {{ .Values.saml.nameIDFormat }}
{{- end}}
{{- if .Values.saml.authTimeout }}
- name: AUTH_TOKEN_TIMEOUT
value: {{ (quote .Values.saml.authTimeout) }}
{{- end}}
{{- if .Values.saml.redirectURL }}
- name: LOGOUT_REDIRECT_URL
value: {{ .Values.saml.redirectURL }}
{{- end}}
{{- if .Values.saml.rbac.enabled }}
- name: SAML_RBAC_ENABLED
value: "true"
{{- end }}
{{- if and .Values.saml.encryptionCertSecret .Values.saml.decryptionKeySecret }}
- name: SAML_RESPONSE_ENCRYPTED