rancher-partner-charts/charts/kubecost/cost-analyzer/1.106.0/templates/federator-deployment-templa...

113 lines
4.2 KiB
YAML

{{- if .Values.federatedETL.useExistingS3Config -}}
{{- fail "ERROR: You are using a deprecated configuration `.Values.federatedETL.useExistingS3Config`. Please use `.Values.kubecostModel.federatedStorageConfigSecret` instead." -}}
{{- end -}}
{{- if and (.Values.federatedETL.federator) (.Values.federatedETL.federator.enabled) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "federator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "federator.commonLabels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "federator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "federator.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: federator
{{- if .Values.kubecostModel }}
{{- if .Values.kubecostModel.fullImageName }}
image: {{ .Values.kubecostModel.fullImageName }}
{{- else if .Values.imageVersion }}
image: {{ .Values.kubecostModel.image }}:{{ .Values.imageVersion }}
{{- else }}
image: {{ .Values.kubecostModel.image }}:prod-{{ $.Chart.AppVersion }}
{{- end }}
{{- else }}
image: gcr.io/kubecost1/cost-model:prod-{{ $.Chart.AppVersion }}
{{- end }}
imagePullPolicy: Always
args: ["federator"]
ports:
- name: tcp-model
containerPort: 9001
protocol: TCP
volumeMounts:
- name: federator-config
mountPath: /var/configs/federator
- name: federated-storage-config
mountPath: /var/configs/etl/federated
readOnly: true
{{- if .Values.federatedETL.federator.extraVolumeMounts }}
{{- toYaml .Values.federatedETL.federator.extraVolumeMounts | nindent 12 }}
{{- end }}
readinessProbe:
httpGet:
path: /healthz
port: 9001
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 200
resources:
{{- toYaml .Values.federatedETL.federator.resources | nindent 12 }}
env:
- name: CONFIG_PATH
value: /var/configs/
- name: DB_PATH
value: /var/db/
{{- if .Values.kubecostModel.federatedStorageConfigSecret }}
- name: FEDERATED_STORE_CONFIG
value: "/var/configs/etl/federated/federated-store.yaml"
{{- end }}
{{- if .Values.federatedETL.federator.extraEnv }}
{{- toYaml .Values.federatedETL.federator.extraEnv | nindent 12 }}
{{- end }}
restartPolicy: Always
serviceAccountName: {{ template "cost-analyzer.serviceAccountName" . }}
volumes:
- name: federator-config
configMap:
name: {{ template "cost-analyzer.fullname" . }}-federator
{{- if .Values.kubecostModel.federatedStorageConfigSecret }}
- name: federated-storage-config
secret:
defaultMode: 420
secretName: {{ .Values.kubecostModel.federatedStorageConfigSecret }}
{{- end }}
{{- if .Values.federatedETL.federator.extraVolumes }}
{{- toYaml .Values.federatedETL.federator.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 2 }}
{{- end }}
{{- if .Values.federatedETL.federator.priority }}
{{- if .Values.federatedETL.federator.priority.enabled }}
{{- if .Values.federatedETL.federator.priority.name }}
priorityClassName: {{ .Values.federatedETL.federator.priority.name }}
{{- else }}
priorityClassName: {{ template "federator.fullname" . }}-priority
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.federatedETL.federator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.federatedETL.federator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.federatedETL.federator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}