blob: 4026b6835ebd59dd9bf444136a01598c1e2c034c [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#
{{ if or .Values.metrics.prometheusEnabled .Values.metrics.userMetricsEnabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-prometheus-server
labels:
name: {{ .Release.Name }}-prometheus-server
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
spec:
serviceName: {{ .Release.Name }}-prometheus-server
replicas: {{ .Values.prometheus.replicaCount }}
selector:
matchLabels:
name: {{ .Release.Name }}-prometheus-server
template:
metadata:
labels:
name: {{ .Release.Name }}-prometheus-server
{{ include "openwhisk.label_boilerplate" . | indent 8 }}
spec:
restartPolicy: {{ .Values.user_events.restartPolicy }}
{{- if .Values.affinity.enabled }}
affinity:
{{ include "openwhisk.affinity.core" . | indent 8 }}
{{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-prometheus-server" .Release.Name ) | indent 8 }}
{{- end }}
{{- if .Values.toleration.enabled }}
tolerations:
{{ include "openwhisk.toleration.core" . | indent 8 }}
{{- end }}
securityContext:
fsGroup: 2000
runAsUser: 1000
runAsNonRoot: true
serviceAccountName: {{ .Release.Name }}-prometheus-server
containers:
- name: prometheus
imagePullPolicy: {{ .Values.prometheus.imagePullPolicy | quote }}
image: "{{- .Values.docker.registry.name -}}{{- .Values.prometheus.imageName -}}:{{- .Values.prometheus.imageTag -}}"
args:
- "--config.file=/etc/prometheus/prometheus.yaml"
- "--storage.tsdb.path={{ .Values.prometheus.persistentVolume.mountPath }}"
ports:
- containerPort: {{ .Values.prometheus.port }}
livenessProbe:
httpGet:
path: /-/healthy
port: {{ .Values.prometheus.port }}
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /-/healthy
port: {{ .Values.prometheus.port }}
volumeMounts:
- name: prometheus-config-volume
mountPath: /etc/prometheus/
- name: prometheus-storage-volume
mountPath: {{ .Values.prometheus.persistentVolume.mountPath }}
volumes:
- name: prometheus-config-volume
configMap:
name: "{{ .Release.Name }}-prometheus-configuration"
- name: prometheus-storage-volume
{{- if and .Values.k8s.persistence.enabled (eq (int .Values.prometheus.replicaCount) 1) }}
persistentVolumeClaim:
claimName: "{{ .Release.Name }}-prometheus-pvc"
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}