+++ /dev/null
-{{- if .Values.prometheus.enabled -}}
-#######################################################################################
-# Copyright ETSI Contributors and Others.
-#
-# 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.
-#######################################################################################
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: prometheus
- labels:
- {{- include "osm.labels" . | nindent 4 }}
-spec:
- replicas: {{ .Values.prometheus.replicaCount | default .Values.global.replicaCount }}
- serviceName: prometheus
- selector:
- matchLabels:
- app.kubernetes.io/component: prometheus
- {{- include "osm.selectorLabels" . | nindent 6 }}
- template:
- metadata:
- {{- with .Values.global.podAnnotations }}
- annotations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- labels:
- app.kubernetes.io/component: prometheus
- {{- include "osm.selectorLabels" . | nindent 8 }}
- spec:
- {{- with .Values.global.imagePullSecrets }}
- imagePullSecrets:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- serviceAccountName: {{ include "osm.serviceAccountName" . }}
- initContainers:
- - name: prometheus-init-config
- image: busybox
- command: ["/bin/sh", "-c"]
-{{- if .Values.global.oldServiceAssurance }}
- args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi']
-{{- else }}
- args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi; cp /config/osm_metric_rules.yml /config/osm_alert_rules.yml /etc/prometheus']
-{{- end }}
- volumeMounts:
- - name: prom-config
- mountPath: /etc/prometheus
- - name: prom-config-base
- mountPath: /config
- containers:
- - name: prometheus
- securityContext:
- # readOnlyRootFilesystem: true
- allowPrivilegeEscalation: false
- # runAsNonRoot: true
- image: prom/prometheus:v2.47.0
- imagePullPolicy: {{ .Values.global.image.pullPolicy }}
- args:
- - --config.file=/etc/prometheus/prometheus.yml
- - --web.enable-lifecycle
- ports:
- - containerPort: 9090
- protocol: TCP
- volumeMounts:
- - name: prom-config
- mountPath: /etc/prometheus
- - name: prom-db
- mountPath: /prometheus
- resources:
- limits:
- memory: 1024Mi
- requests:
- memory: 128Mi
- - name: prometheus-config-sidecar
- securityContext:
- # readOnlyRootFilesystem: true
- allowPrivilegeEscalation: false
- # runAsNonRoot: true
- image: {{ include "osm.prometheus.image" . }}
- imagePullPolicy: {{ .Values.global.image.pullPolicy }}
- volumeMounts:
- - name: prom-config
- mountPath: /etc/prometheus
- - name: prom-config-base
- mountPath: /etc/prometheus_base
- resources:
- limits:
- memory: 1024Mi
- requests:
- memory: 128Mi
- envFrom:
- - configMapRef:
- name: {{ include "osm.fullname" . }}-prometheus-configmap
- {{- with .Values.global.nodeSelector }}
- nodeSelector:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.global.affinity }}
- affinity:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.global.tolerations }}
- tolerations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- volumes:
- - name: prom-db
- emptyDir: {}
- - name: prom-config
- emptyDir: {}
- - name: prom-config-base
- projected:
- sources:
- - configMap:
- name: {{ include "osm.fullname" . }}-prometheus-prom-configmap
- items:
- - key: prometheus.yml
- path: prometheus.yml
-{{- if not .Values.global.oldServiceAssurance }}
- - configMap:
- name: {{ include "osm.fullname" . }}-prometheus-recordingrules-configmap
- items:
- - key: osm_metric_rules.yml
- path: osm_metric_rules.yml
- - configMap:
- name: {{ include "osm.fullname" . }}-prometheus-alertingrules-configmap
- items:
- - key: osm_alert_rules.yml
- path: osm_alert_rules.yml
-{{- end }}
-{{- end }}