rancher-partner-charts/charts/kubecost/cost-analyzer/templates/cost-analyzer-prometheus-po...

58 lines
1.8 KiB
YAML

{{- if .Values.remoteWrite -}}
{{- if .Values.remoteWrite.postgres -}}
{{- if .Values.remoteWrite.postgres.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "cost-analyzer.fullname" . }}-adapter
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
spec:
selector:
matchLabels:
app: adapter
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: adapter
spec:
initContainers:
- name: kubecost-sql-init
image: {{ .Values.remoteWrite.postgres.initImage }}:prod-{{ $.Chart.AppVersion }}
{{- if .Values.remoteWrite.postgres.initImagePullPolicy }}
imagePullPolicy: {{ .Values.remoteWrite.postgres.initImagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
env:
- name: PROMETHEUS_SERVER_ENDPOINT
valueFrom:
configMapKeyRef:
name: {{ template "cost-analyzer.fullname" . }}
key: prometheus-server-endpoint
containers:
- image: timescale/prometheus-postgresql-adapter:latest
name: pgprometheusadapter
ports:
- containerPort: 9201
args:
{{- if .Values.remoteWrite.postgres.installLocal }}
- "-pg-host=pgprometheus"
{{- else }}
- "-pg-host={{ .Values.remoteWrite.postgres.remotePostgresAddress }}"
{{- end }}
- "-pg-prometheus-log-samples=true"
- "-pg-password={{ .Values.remoteWrite.postgres.auth.password }}"
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}