2017-11-03 15:59:08 +00:00
|
|
|
{{/*
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/}}
|
|
|
|
|
2020-02-25 17:07:05 +00:00
|
|
|
{{- define "kubeMetricsReadinessProbe" }}
|
|
|
|
httpGet:
|
|
|
|
path: /metrics
|
|
|
|
port: {{ tuple "kube_state_metrics" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
|
|
|
{{- end }}
|
|
|
|
|
2017-11-03 15:59:08 +00:00
|
|
|
{{- if .Values.manifests.deployment }}
|
|
|
|
{{- $envAll := . }}
|
2017-12-07 15:34:05 +00:00
|
|
|
|
2019-01-03 22:45:49 +00:00
|
|
|
{{- $serviceAccountName := printf "%s-%s" .Release.Name "kube-state-metrics" }}
|
2018-03-31 16:36:31 +00:00
|
|
|
{{ tuple $envAll "kube_state_metrics" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
2017-11-03 15:59:08 +00:00
|
|
|
---
|
2019-12-17 05:21:57 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-01-17 01:24:25 +00:00
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: {{ $serviceAccountName }}
|
|
|
|
rules:
|
|
|
|
- apiGroups:
|
2020-10-04 06:25:49 +00:00
|
|
|
- "*"
|
2018-01-17 01:24:25 +00:00
|
|
|
resources:
|
2020-10-04 06:25:49 +00:00
|
|
|
- "*"
|
2018-06-12 22:26:01 +00:00
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- watch
|
2018-01-17 01:24:25 +00:00
|
|
|
---
|
2019-12-17 05:21:57 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
2018-01-17 01:24:25 +00:00
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: {{ $serviceAccountName }}
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: {{ $serviceAccountName }}
|
|
|
|
namespace: {{ $envAll.Release.Namespace }}
|
|
|
|
roleRef:
|
|
|
|
kind: ClusterRole
|
|
|
|
name: {{ $serviceAccountName }}
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
---
|
2018-06-12 02:58:39 +00:00
|
|
|
apiVersion: apps/v1
|
2017-11-03 15:59:08 +00:00
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: kube-state-metrics
|
2018-09-12 14:07:19 +00:00
|
|
|
annotations:
|
|
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
2018-06-12 02:58:39 +00:00
|
|
|
labels:
|
|
|
|
{{ tuple $envAll "kube-state-metrics" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
spec:
|
|
|
|
replicas: {{ .Values.pod.replicas.kube_state_metrics }}
|
2018-06-12 02:58:39 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
{{ tuple $envAll "kube-state-metrics" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
{{ tuple $envAll "kube-state-metrics" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
2019-02-12 17:00:14 +00:00
|
|
|
annotations:
|
|
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
|
|
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
2020-05-05 22:22:24 +00:00
|
|
|
{{ dict "envAll" $envAll "podName" "kube-state-metrics" "containerNames" (list "kube-state-metrics" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
spec:
|
2019-04-22 15:29:33 +00:00
|
|
|
{{ dict "envAll" $envAll "application" "exporter" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
2017-12-07 15:34:05 +00:00
|
|
|
serviceAccountName: {{ $serviceAccountName }}
|
2019-06-03 16:33:56 +00:00
|
|
|
affinity:
|
|
|
|
{{ tuple $envAll "kube-state-metrics" "exporter" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
nodeSelector:
|
2018-07-30 06:49:51 +00:00
|
|
|
{{ .Values.labels.kube_state_metrics.node_selector_key }}: {{ .Values.labels.kube_state_metrics.node_selector_value | quote }}
|
2017-11-03 15:59:08 +00:00
|
|
|
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.kube_state_metrics.timeout | default "30" }}
|
|
|
|
initContainers:
|
2018-03-31 16:36:31 +00:00
|
|
|
{{ tuple $envAll "kube_state_metrics" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
containers:
|
|
|
|
- name: kube-state-metrics
|
|
|
|
{{ tuple $envAll "kube_state_metrics" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
|
|
{{ tuple $envAll $envAll.Values.pod.resources.kube_state_metrics | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
2019-04-22 15:29:33 +00:00
|
|
|
{{ dict "envAll" $envAll "application" "exporter" "container" "kube_state_metrics" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
2017-11-03 15:59:08 +00:00
|
|
|
ports:
|
|
|
|
- name: metrics
|
2018-03-05 16:39:28 +00:00
|
|
|
containerPort: {{ tuple "kube_state_metrics" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
2020-02-25 17:07:05 +00:00
|
|
|
{{ dict "envAll" . "component" "server" "container" "kube_metrics" "type" "readiness" "probeTemplate" (include "kubeMetricsReadinessProbe" . | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 -}}
|
2018-06-13 16:05:56 +00:00
|
|
|
volumeMounts:
|
2019-04-20 12:58:42 +00:00
|
|
|
- name: pod-tmp
|
|
|
|
mountPath: /tmp
|
2018-06-13 16:05:56 +00:00
|
|
|
volumes:
|
2019-04-20 12:58:42 +00:00
|
|
|
- name: pod-tmp
|
|
|
|
emptyDir: {}
|
2017-11-03 15:59:08 +00:00
|
|
|
{{- end }}
|