Files
devops-infra-helm-charts-gcp/helm-templates/pmm/templates/statefulset.yaml
T
2026-08-26 03:39:42 +05:30

150 lines
4.8 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "pmm.fullname" . }}
labels:
{{- include "pmm.labels" . | nindent 4 }}
spec:
serviceName: {{ .Values.service.name }}
replicas: 1
selector:
matchLabels:
{{- include "pmm.selectorLabels" . | nindent 6 }}
updateStrategy:
type: RollingUpdate
template:
metadata:
annotations:
{{- include "pmm.podAnnotations" . | nindent 8 }}
labels:
{{- include "pmm.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "pmm.serviceAccountName" . }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.pmmResources }}
resources:
{{- toYaml .Values.pmmResources | nindent 12 }}
{{- end }}
# environment passed to PMM, defined in configMap
envFrom:
- configMapRef:
name: {{ include "pmm.fullname" . }}
optional: true
# additional secrets that could be used for Grafana iDP
env:
- name: GF_AUTH_GENERIC_OAUTH_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: GF_AUTH_GENERIC_OAUTH_CLIENT_ID
optional: true
- name: GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET
optional: true
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: PMM_ADMIN_PASSWORD
optional: true
- name: PMM_INSTALL_METHOD
valueFrom:
fieldRef:
fieldPath: metadata.annotations['app.kubernetes.io/managed-by']
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
readinessProbe:
httpGet:
path: /v1/readyz
port: http
{{- if .Values.readyProbeConf }}
{{- toYaml .Values.readyProbeConf | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ .Values.storage.name }}
mountPath: /srv
- name: annotations
mountPath: "/var/run/pmm/annotations"
readOnly: true
{{- if .Values.certs.name }}
- name: {{ .Values.certs.name }}
mountPath: /srv/nginx
readOnly: true
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
volumes:
- name: annotations
projected:
sources:
- downwardAPI:
items:
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations
{{- if .Values.certs.name }}
- name: {{ .Values.certs.name }}
secret:
secretName: {{ .Values.certs.name }}
optional: false
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: {{ .Values.storage.name }}
spec:
{{- if .Values.storage.selector }}
selector:
{{- toYaml .Values.storage.selector | nindent 10 }}
{{- end }}
{{ if .Values.storage.storageClassName }}
storageClassName: {{ .Values.storage.storageClassName }}
{{ end }}
{{- if .Values.storage.dataSource }}
dataSource:
{{- toYaml .Values.storage.dataSource | nindent 10 }}
{{- end }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.storage.size }}