{{- if .Values.monitoring.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: prometheus namespace: {{ .Values.namespace }} labels: {{- include "osint-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: monitoring spec: replicas: 1 selector: matchLabels: {{- include "osint-dashboard.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: monitoring template: metadata: labels: {{- include "osint-dashboard.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: monitoring annotations: prometheus.io/scrape: "true" prometheus.io/port: "9090" spec: securityContext: runAsNonRoot: true runAsUser: 65534 # nobody fsGroup: 65534 serviceAccountName: prometheus containers: - name: prometheus image: "{{ .Values.monitoring.prometheus.image.repository }}:{{ .Values.monitoring.prometheus.image.tag }}" ports: - containerPort: {{ .Values.monitoring.prometheus.port }} name: web args: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus" - "--storage.tsdb.retention.time={{ .Values.monitoring.prometheus.retention }}" - "--storage.tsdb.retention.size={{ .Values.monitoring.prometheus.retentionSize }}" - "--web.enable-lifecycle" - "--web.enable-admin-api" resources: {{- toYaml .Values.monitoring.prometheus.resources | nindent 12 }} volumeMounts: - name: config mountPath: /etc/prometheus - name: rules mountPath: /etc/prometheus/rules - name: data mountPath: /prometheus securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: ["ALL"] volumes: - name: config configMap: name: prometheus-config - name: rules configMap: name: prometheus-rules strategy: type: Recreate --- apiVersion: v1 kind: Service metadata: name: prometheus namespace: {{ .Values.namespace }} labels: {{- include "osint-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: monitoring annotations: prometheus.io/scrape: "true" prometheus.io/port: "9090" spec: type: ClusterIP ports: - port: {{ .Values.monitoring.prometheus.port }} targetPort: web protocol: TCP name: web selector: app.kubernetes.io/name: osint-dashboard app.kubernetes.io/component: monitoring --- apiVersion: v1 kind: ServiceAccount metadata: name: prometheus namespace: {{ .Values.namespace }} labels: {{- include "osint-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: monitoring --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: prometheus namespace: {{ .Values.namespace }} labels: {{- include "osint-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: monitoring rules: - apiGroups: [""] resources: ["pods", "services", "endpoints", "configmaps"] verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: prometheus namespace: {{ .Values.namespace }} labels: {{- include "osint-dashboard.labels" . | nindent 4 }} app.kubernetes.io/component: monitoring roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: prometheus subjects: - kind: ServiceAccount name: prometheus namespace: {{ .Values.namespace }} {{- end }}