blob: 2610710f4a78de0893ca4c7fea7ef5c3df17a77f [file] [log] [blame]
bravofc973b572020-10-21 16:58:50 -03001# Copyright 2021 Whitestack, LLC
2# *************************************************************
3
4# This file is part of OSM Monitoring module
5# All Rights Reserved to Whitestack, LLC
6
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10
11# http://www.apache.org/licenses/LICENSE-2.0
12
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18
19# For those usages not covered by the Apache License, Version 2.0 please
20# contact: fbravo@whitestack.com or glavado@whitestack.com
21##
22
vijaynag8339ed22019-07-25 17:10:58 +053023apiVersion: v1
24kind: Service
25metadata:
26 name: prometheus
27spec:
28 ports:
29 - nodePort: 9091
30 port: 9090
31 protocol: TCP
32 targetPort: 9090
33 selector:
34 app: prometheus
35 type: NodePort
36---
37apiVersion: v1
38data:
39 prometheus.yml: |
40 # Copyright 2018 The Prometheus Authors
41 # Copyright 2018 Whitestack
42 # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U.
43 #
44 # Licensed under the Apache License, Version 2.0 (the "License");
45 # you may not use this file except in compliance with the License.
46 # You may obtain a copy of the License at
47 #
48 # http://www.apache.org/licenses/LICENSE-2.0
49 #
50 # Unless required by applicable law or agreed to in writing, software
51 # distributed under the License is distributed on an "AS IS" BASIS,
52 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53 # See the License for the specific language governing permissions and
54 # limitations under the License.
55
56 # my global config
57 global:
58 scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
59 evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
60 # scrape_timeout is set to the global default (10s).
61
62 # Alertmanager configuration
63 alerting:
64 alertmanagers:
65 - static_configs:
66 - targets:
67 # - alertmanager:9093
68
69 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
70 rule_files:
71 # - "first_rules.yml"
72 # - "second_rules.yml"
73
74 # A scrape configuration containing exactly one endpoint to scrape:
75 # Here it's Prometheus itself.
garciadeblas09eaa922022-09-07 22:57:53 +020076 scrape_configs: []
77 # scrape_configs:
78 # Add here other external targets, e.g. a pushgateway
79 # - job_name: 'pushgateway'
80 # static_configs:
81 # - targets: ['prometheus-pushgateway:9091']
vijaynag8339ed22019-07-25 17:10:58 +053082kind: ConfigMap
83metadata:
84 name: prom
85---
86apiVersion: apps/v1
87kind: StatefulSet
88metadata:
89 name: prometheus
90 labels:
91 app: prometheus
92spec:
93 replicas: 1
94 serviceName: prometheus
95 selector:
96 matchLabels:
97 app: prometheus
98 template:
99 metadata:
100 labels:
101 app: prometheus
102 spec:
bravof1e0297e2020-07-01 15:11:57 -0400103 initContainers:
104 - name: prometheus-init-config
105 image: busybox
106 command: ["/bin/sh", "-c"]
garciadeblas09eaa922022-09-07 22:57:53 +0200107 args: ['if [ ! -f "/etc/prometheus/prometheus.yml" ]; then cp /config/prometheus.yml /etc/prometheus; fi']
bravof1e0297e2020-07-01 15:11:57 -0400108 volumeMounts:
109 - name: prom-config
110 mountPath: /etc/prometheus
garciadeblas09eaa922022-09-07 22:57:53 +0200111 - name: prom-config-base
112 mountPath: /config
vijaynag8339ed22019-07-25 17:10:58 +0530113 containers:
114 - name: prometheus
garciadeblas0ab16612022-02-22 14:23:57 +0100115 image: prom/prometheus:v2.28.1
lavado71906482020-04-13 17:02:00 -0500116 args:
117 - --config.file=/etc/prometheus/prometheus.yml
118 - --web.enable-lifecycle
vijaynag8339ed22019-07-25 17:10:58 +0530119 ports:
120 - containerPort: 9090
121 protocol: TCP
122 volumeMounts:
123 - name: prom-config
bravof1e0297e2020-07-01 15:11:57 -0400124 mountPath: /etc/prometheus
vijaynag8339ed22019-07-25 17:10:58 +0530125 - name: prom-db
126 mountPath: /prometheus
bravofc973b572020-10-21 16:58:50 -0300127 - name: prometheus-config-sidecar
garciadeblas96155042022-06-22 16:26:22 +0200128 image: opensourcemano/prometheus:12
bravofc973b572020-10-21 16:58:50 -0300129 env:
130 - name: MONGODB_URL
131 value: mongodb://mongodb-k8s:27017/?replicaSet=rs0
132 - name: PROMETHEUS_CONFIG_FILE
133 value: /etc/prometheus/prometheus.yml
garciadeblas09eaa922022-09-07 22:57:53 +0200134 - name: PROMETHEUS_BASE_CONFIG_FILE
135 value: /etc/prometheus_base/prometheus.yml
bravofc973b572020-10-21 16:58:50 -0300136 - name: TARGET_DATABASE
137 value: osm
138 - name: PROMETHEUS_URL
139 value: http://prometheus:9090
140 volumeMounts:
141 - name: prom-config
142 mountPath: /etc/prometheus
garciadeblas09eaa922022-09-07 22:57:53 +0200143 - name: prom-config-base
144 mountPath: /etc/prometheus_base
vijaynag8339ed22019-07-25 17:10:58 +0530145 volumes:
garciadeblas09eaa922022-09-07 22:57:53 +0200146 - name: prom-db
147 emptyDir: {}
bravof1e0297e2020-07-01 15:11:57 -0400148 - name: prom-config
bravofc973b572020-10-21 16:58:50 -0300149 emptyDir: {}
garciadeblas09eaa922022-09-07 22:57:53 +0200150 - name: prom-config-base
bravof9d2556f2020-07-03 10:01:42 -0400151 configMap:
152 name: prom