2020-12-18 00:46:15 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
{{- if .Values.autosharding.enabled }}
|
|
|
|
kind: StatefulSet
|
|
|
|
{{- else }}
|
|
|
|
kind: Deployment
|
|
|
|
{{- end }}
|
|
|
|
metadata:
|
|
|
|
name: {{ template "kube-state-metrics.fullname" . }}
|
|
|
|
namespace: {{ template "kube-state-metrics.namespace" . }}
|
|
|
|
labels:
|
2021-12-09 18:03:55 +00:00
|
|
|
{{- include "kube-state-metrics.labels" . | indent 4 }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{ toYaml .Values.annotations | indent 4 }}
|
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2021-12-09 18:03:55 +00:00
|
|
|
{{- include "kube-state-metrics.selectorLabels" . | indent 6 }}
|
2020-12-18 00:46:15 +00:00
|
|
|
replicas: {{ .Values.replicas }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.autosharding.enabled }}
|
2020-12-18 00:46:15 +00:00
|
|
|
serviceName: {{ template "kube-state-metrics.fullname" . }}
|
|
|
|
volumeClaimTemplates: []
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2021-12-09 18:03:55 +00:00
|
|
|
{{- include "kube-state-metrics.labels" . | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.podAnnotations }}
|
2020-12-18 00:46:15 +00:00
|
|
|
annotations:
|
|
|
|
{{ toYaml .Values.podAnnotations | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
spec:
|
|
|
|
hostNetwork: {{ .Values.hostNetwork }}
|
|
|
|
serviceAccountName: {{ template "kube-state-metrics.serviceAccountName" . }}
|
|
|
|
{{- if .Values.securityContext.enabled }}
|
2022-08-24 15:13:39 +00:00
|
|
|
securityContext: {{- omit .Values.securityContext "enabled" | toYaml | nindent 8 }}
|
2020-12-18 00:46:15 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.priorityClassName }}
|
|
|
|
priorityClassName: {{ .Values.priorityClassName }}
|
|
|
|
{{- end }}
|
|
|
|
containers:
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- $httpPort := ternary 9090 (.Values.service.port | default 8080) .Values.kubeRBACProxy.enabled}}
|
|
|
|
{{- $telemetryPort := ternary 9091 (.Values.selfMonitor.telemetryPort | default 8081) .Values.kubeRBACProxy.enabled}}
|
2022-08-24 15:13:39 +00:00
|
|
|
- name: {{ template "kube-state-metrics.name" . }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.autosharding.enabled }}
|
2020-12-18 00:46:15 +00:00
|
|
|
env:
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: POD_NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
args:
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.extraArgs }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- .Values.extraArgs | toYaml | nindent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
- --port={{ $httpPort }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.collectors }}
|
|
|
|
- --resources={{ .Values.collectors | join "," }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.metricLabelsAllowlist }}
|
|
|
|
- --metric-labels-allowlist={{ .Values.metricLabelsAllowlist | join "," }}
|
|
|
|
{{- end }}
|
2021-12-09 18:03:55 +00:00
|
|
|
{{- if .Values.metricAnnotationsAllowList }}
|
|
|
|
- --metric-annotations-allowlist={{ .Values.metricAnnotationsAllowList | join "," }}
|
|
|
|
{{- end }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.metricAllowlist }}
|
|
|
|
- --metric-allowlist={{ .Values.metricAllowlist | join "," }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.metricDenylist }}
|
|
|
|
- --metric-denylist={{ .Values.metricDenylist | join "," }}
|
|
|
|
{{- end }}
|
2022-10-27 12:27:42 +00:00
|
|
|
{{- $namespaces := list }}
|
|
|
|
{{- if .Values.namespaces }}
|
|
|
|
{{- range $ns := join "," .Values.namespaces | split "," }}
|
|
|
|
{{- $namespaces = append $namespaces (tpl $ns $) }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.releaseNamespace }}
|
2022-10-27 12:27:42 +00:00
|
|
|
{{- $namespaces = append $namespaces ( include "kube-state-metrics.namespace" . ) }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if $namespaces }}
|
|
|
|
- --namespaces={{ $namespaces | mustUniq | join "," }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2022-04-08 15:08:28 +00:00
|
|
|
{{- if .Values.namespacesDenylist }}
|
|
|
|
- --namespaces-denylist={{ tpl (.Values.namespacesDenylist | join ",") $ }}
|
|
|
|
{{- end }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.autosharding.enabled }}
|
2020-12-18 00:46:15 +00:00
|
|
|
- --pod=$(POD_NAME)
|
|
|
|
- --pod-namespace=$(POD_NAMESPACE)
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.kubeconfig.enabled }}
|
2020-12-18 00:46:15 +00:00
|
|
|
- --kubeconfig=/opt/k8s/.kube/config
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- if .Values.kubeRBACProxy.enabled }}
|
|
|
|
- --telemetry-host=127.0.0.1
|
|
|
|
- --telemetry-port={{ $telemetryPort }}
|
|
|
|
{{- else }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.selfMonitor.telemetryHost }}
|
2021-02-26 21:25:43 +00:00
|
|
|
- --telemetry-host={{ .Values.selfMonitor.telemetryHost }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2022-09-16 09:21:38 +00:00
|
|
|
{{- if .Values.selfMonitor.telemetryPort }}
|
2023-04-14 10:44:57 +00:00
|
|
|
- --telemetry-port={{ $telemetryPort }}
|
|
|
|
{{- end }}
|
2022-09-16 09:21:38 +00:00
|
|
|
{{- end }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if or (.Values.kubeconfig.enabled) (.Values.volumeMounts) }}
|
2020-12-18 00:46:15 +00:00
|
|
|
volumeMounts:
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.kubeconfig.enabled }}
|
2020-12-18 00:46:15 +00:00
|
|
|
- name: kubeconfig
|
|
|
|
mountPath: /opt/k8s/.kube/
|
|
|
|
readOnly: true
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.volumeMounts }}
|
|
|
|
{{ toYaml .Values.volumeMounts | indent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
2023-04-14 10:44:57 +00:00
|
|
|
image: {{ include "kube-state-metrics.image" . }}
|
|
|
|
{{- if eq .Values.kubeRBACProxy.enabled false }}
|
2020-12-18 00:46:15 +00:00
|
|
|
ports:
|
2021-06-30 16:26:06 +00:00
|
|
|
- containerPort: {{ .Values.service.port | default 8080}}
|
2021-12-09 18:03:55 +00:00
|
|
|
name: "http"
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.selfMonitor.enabled }}
|
2023-04-14 10:44:57 +00:00
|
|
|
- containerPort: {{ $telemetryPort }}
|
2021-12-09 18:03:55 +00:00
|
|
|
name: "metrics"
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- end }}
|
2020-12-18 00:46:15 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
2023-04-14 10:44:57 +00:00
|
|
|
port: {{ $httpPort }}
|
2020-12-18 00:46:15 +00:00
|
|
|
initialDelaySeconds: 5
|
|
|
|
timeoutSeconds: 5
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /
|
2023-04-14 10:44:57 +00:00
|
|
|
port: {{ $httpPort }}
|
2020-12-18 00:46:15 +00:00
|
|
|
initialDelaySeconds: 5
|
|
|
|
timeoutSeconds: 5
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.resources }}
|
2020-12-18 00:46:15 +00:00
|
|
|
resources:
|
|
|
|
{{ toYaml .Values.resources | indent 10 }}
|
|
|
|
{{- end }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- if .Values.containerSecurityContext }}
|
|
|
|
securityContext:
|
|
|
|
{{ toYaml .Values.containerSecurityContext | indent 10 }}
|
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- if .Values.kubeRBACProxy.enabled }}
|
|
|
|
- name: kube-rbac-proxy-http
|
|
|
|
args:
|
|
|
|
{{- if .Values.kubeRBACProxy.extraArgs }}
|
|
|
|
{{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
- --secure-listen-address=:{{ .Values.service.port | default 8080}}
|
|
|
|
- --upstream=http://127.0.0.1:{{ $httpPort }}/
|
|
|
|
- --proxy-endpoints-port=8888
|
|
|
|
- --config-file=/etc/kube-rbac-proxy-config/config-file.yaml
|
|
|
|
volumeMounts:
|
|
|
|
- name: kube-rbac-proxy-config
|
|
|
|
mountPath: /etc/kube-rbac-proxy-config
|
2023-05-13 08:38:33 +00:00
|
|
|
{{- with .Values.kubeRBACProxy.volumeMounts }}
|
|
|
|
{{- toYaml . | nindent 10 }}
|
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
imagePullPolicy: {{ .Values.kubeRBACProxy.image.pullPolicy }}
|
|
|
|
image: {{ include "kubeRBACProxy.image" . }}
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ .Values.service.port | default 8080}}
|
|
|
|
name: "http"
|
|
|
|
- containerPort: 8888
|
|
|
|
name: "http-healthz"
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
scheme: HTTPS
|
|
|
|
port: 8888
|
|
|
|
path: healthz
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
timeoutSeconds: 5
|
|
|
|
{{- if .Values.kubeRBACProxy.resources }}
|
|
|
|
resources:
|
|
|
|
{{ toYaml .Values.kubeRBACProxy.resources | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.kubeRBACProxy.containerSecurityContext }}
|
|
|
|
securityContext:
|
|
|
|
{{ toYaml .Values.kubeRBACProxy.containerSecurityContext | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.selfMonitor.enabled }}
|
|
|
|
- name: kube-rbac-proxy-telemetry
|
|
|
|
args:
|
|
|
|
{{- if .Values.kubeRBACProxy.extraArgs }}
|
|
|
|
{{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
- --secure-listen-address=:{{ .Values.selfMonitor.telemetryPort | default 8081 }}
|
|
|
|
- --upstream=http://127.0.0.1:{{ $telemetryPort }}/
|
|
|
|
- --proxy-endpoints-port=8889
|
|
|
|
- --config-file=/etc/kube-rbac-proxy-config/config-file.yaml
|
|
|
|
volumeMounts:
|
|
|
|
- name: kube-rbac-proxy-config
|
|
|
|
mountPath: /etc/kube-rbac-proxy-config
|
2023-05-13 08:38:33 +00:00
|
|
|
{{- with .Values.kubeRBACProxy.volumeMounts }}
|
|
|
|
{{- toYaml . | nindent 10 }}
|
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
imagePullPolicy: {{ .Values.kubeRBACProxy.image.pullPolicy }}
|
|
|
|
image: {{ include "kubeRBACProxy.image" . }}
|
|
|
|
ports:
|
|
|
|
- containerPort: {{ .Values.selfMonitor.telemetryPort | default 8081 }}
|
|
|
|
name: "metrics"
|
|
|
|
- containerPort: 8889
|
|
|
|
name: "metrics-healthz"
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
scheme: HTTPS
|
|
|
|
port: 8889
|
|
|
|
path: healthz
|
|
|
|
initialDelaySeconds: 5
|
|
|
|
timeoutSeconds: 5
|
|
|
|
{{- if .Values.kubeRBACProxy.resources }}
|
|
|
|
resources:
|
|
|
|
{{ toYaml .Values.kubeRBACProxy.resources | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.kubeRBACProxy.containerSecurityContext }}
|
|
|
|
securityContext:
|
|
|
|
{{ toYaml .Values.kubeRBACProxy.containerSecurityContext | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }}
|
2020-12-18 00:46:15 +00:00
|
|
|
imagePullSecrets:
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- include "kube-state-metrics.imagePullSecrets" (dict "Values" .Values "imagePullSecrets" .Values.imagePullSecrets) | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.affinity }}
|
2020-12-18 00:46:15 +00:00
|
|
|
affinity:
|
|
|
|
{{ toYaml .Values.affinity | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.nodeSelector }}
|
2020-12-18 00:46:15 +00:00
|
|
|
nodeSelector:
|
|
|
|
{{ toYaml .Values.nodeSelector | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.tolerations }}
|
2020-12-18 00:46:15 +00:00
|
|
|
tolerations:
|
|
|
|
{{ toYaml .Values.tolerations | indent 8 }}
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.topologySpreadConstraints }}
|
|
|
|
topologySpreadConstraints:
|
|
|
|
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
|
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- if or (.Values.kubeconfig.enabled) (.Values.volumes) (.Values.kubeRBACProxy.enabled) }}
|
2020-12-18 00:46:15 +00:00
|
|
|
volumes:
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.kubeconfig.enabled}}
|
2020-12-18 00:46:15 +00:00
|
|
|
- name: kubeconfig
|
|
|
|
secret:
|
|
|
|
secretName: {{ template "kube-state-metrics.fullname" . }}-kubeconfig
|
2021-06-30 16:26:06 +00:00
|
|
|
{{- end }}
|
2023-04-14 10:44:57 +00:00
|
|
|
{{- if .Values.kubeRBACProxy.enabled}}
|
|
|
|
- name: kube-rbac-proxy-config
|
|
|
|
configMap:
|
|
|
|
name: {{ template "kube-state-metrics.fullname" . }}-rbac-config
|
|
|
|
{{- end }}
|
2022-08-24 15:13:39 +00:00
|
|
|
{{- if .Values.volumes }}
|
|
|
|
{{ toYaml .Values.volumes | indent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|