Revert "Feature 11010: Use of upstream helm charts for Prometheus and Grafana in... 90/14390/10
authorRahul Zamre <rzamre@indracompany.com>
Tue, 28 May 2024 11:26:44 +0000 (12:26 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 3 Jun 2024 14:14:39 +0000 (16:14 +0200)
This reverts commit abf6770c2ec33d6ae0b1fb93be1093081abb5a9f.

Change-Id: Ic179fe5475d7a75286bcc10f7694a9e9ef19817b
Signed-off-by: Rahul Zamre <rzamre@indracompany.com>
21 files changed:
installers/helm/osm/Chart.yaml
installers/helm/osm/templates/NOTES.txt
installers/helm/osm/templates/_helpers.tpl
installers/helm/osm/templates/grafana/grafana-clusterrole.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-clusterrolebinding.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-dashboard-provider-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-datasource-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-deployment.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-secret.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-service.yaml [new file with mode: 0644]
installers/helm/osm/templates/grafana/grafana-serviceaccount.yaml [new file with mode: 0644]
installers/helm/osm/templates/mon/mon-deployment.yaml
installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/prometheus/prometheus-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/prometheus/prometheus-recordingrules-configmap.yaml [new file with mode: 0644]
installers/helm/osm/templates/prometheus/prometheus-service.yaml [new file with mode: 0644]
installers/helm/osm/templates/prometheus/prometheus-statefulset.yaml [new file with mode: 0644]
installers/helm/osm/values.yaml
jenkins/ci-pipelines/ci_stage_3.groovy

index 0b16954..346986d 100644 (file)
@@ -34,14 +34,6 @@ dependencies:
 #  repository: "https://charts.bitnami.com/bitnami"
 #  version: "12.1.3"
 #  condition: zookeeper.enabled
-- name: grafana
-  repository: "https://grafana.github.io/helm-charts"
-  version: 7.3.0
-  condition: grafana.enabled
-- name: prometheus
-  repository: "https://prometheus-community.github.io/helm-charts"
-  version: 25.11.0
-  condition: prometheus.enabled
 # - name: mongodb
 #   repository: "https://charts.bitnami.com/bitnami"
 #   version: "13.9.4"
index 45e1821..eef0be8 100644 (file)
@@ -28,6 +28,7 @@
   export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} nbi --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
   echo http://$SERVICE_IP:{{ .Values.nbi.service.port }}
 {{- end }}
+<<<<<<< HEAD
 {{- else }}
   export OSM_GUI_URL=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.rules[0].host}" ingress ngui-ingress)
   echo "OSM UI: $OSM_GUI_URL"
@@ -36,3 +37,5 @@
 {{- end }}
 2. Get Grafana credentials for admin user using below command.
   kubectl -n {{ .Release.Namespace }}  get secret grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
+=======
+>>>>>>> e34e722 (Revert "Feature 11010: Use of upstream helm charts for Prometheus and Grafana in OSM installation.")
index 337073f..cd8ca4f 100644 (file)
@@ -109,3 +109,6 @@ Create the name of the images to be used
 {{ define "osm.keystone.image" -}}
 {{ printf "%s:%s" (.Values.keystone.image.repository | default (printf "%s/keystone" (.Values.global.image.repositoryBase))) (.Values.keystone.image.tag | default .Values.global.image.tag) }}
 {{- end }}
+{{ define "osm.prometheus.image" -}}
+{{ printf "%s:%s" (.Values.prometheus.sidecarImage.repository | default (printf "%s/prometheus" (.Values.global.image.repositoryBase))) (.Values.prometheus.sidecarImage.tag | default .Values.global.image.tag) }}
+{{- end }}
diff --git a/installers/helm/osm/templates/grafana/grafana-clusterrole.yaml b/installers/helm/osm/templates/grafana/grafana-clusterrole.yaml
new file mode 100644 (file)
index 0000000..1e2753a
--- /dev/null
@@ -0,0 +1,34 @@
+{{- if .Values.grafana.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: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  labels:
+    app: grafana
+  name: grafana-clusterrole
+rules:
+- apiGroups:
+  - ""
+  resources:
+  - configmaps
+  - secrets
+  verbs:
+  - get
+  - watch
+  - list
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-clusterrolebinding.yaml b/installers/helm/osm/templates/grafana/grafana-clusterrolebinding.yaml
new file mode 100644 (file)
index 0000000..46669bf
--- /dev/null
@@ -0,0 +1,32 @@
+{{- if .Values.grafana.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: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  labels:
+    app: grafana
+  name: grafana-clusterrolebinding
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: grafana-clusterrole
+subjects:
+- kind: ServiceAccount
+  name: grafana
+  namespace: {{ .Release.Namespace }}
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-configmap.yaml b/installers/helm/osm/templates/grafana/grafana-configmap.yaml
new file mode 100644 (file)
index 0000000..7d4653b
--- /dev/null
@@ -0,0 +1,33 @@
+{{- if .Values.grafana.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: v1
+data:
+  grafana.ini: |
+    [log]
+    mode = console
+    [paths]
+    data = /var/lib/grafana/data
+    logs = /var/log/grafana
+    plugins = /var/lib/grafana/plugins
+    provisioning = /etc/grafana/provisioning
+kind: ConfigMap
+metadata:
+  labels:
+    app: grafana
+  name: grafana
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-dashboard-provider-configmap.yaml b/installers/helm/osm/templates/grafana/grafana-dashboard-provider-configmap.yaml
new file mode 100644 (file)
index 0000000..68dc91b
--- /dev/null
@@ -0,0 +1,42 @@
+{{- if .Values.grafana.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: v1
+data:
+  provider.yaml: |-
+    apiVersion: 1
+    providers:
+    - name: 'Kubernetes Cluster'
+      orgId: 1
+      folder: 'Kubernetes Cluster'
+      type: file
+      disableDeletion: false
+      options:
+        path: '/tmp/dashboards/Kubernetes Cluster'
+    - name: 'Open Source MANO'
+      orgId: 1
+      folder: 'Open Source MANO'
+      type: file
+      disableDeletion: false
+      options:
+        path: '/tmp/dashboards/Open Source MANO'
+kind: ConfigMap
+metadata:
+  labels:
+    app: grafana
+  name: grafana-dashboard-provider
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-datasource-configmap.yaml b/installers/helm/osm/templates/grafana/grafana-datasource-configmap.yaml
new file mode 100644 (file)
index 0000000..ac07a36
--- /dev/null
@@ -0,0 +1,40 @@
+{{- if .Values.grafana.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: v1
+kind: ConfigMap
+metadata:
+  labels:
+    grafana_datasource: "1"
+  name: grafana-datasource
+data:
+  datasource.yaml: |-
+    apiVersion: 1
+    datasources:
+    - name: osm_prometheus
+      type: prometheus
+      url: http://prometheus:9090
+      access: proxy
+      allowUiUpdates: true
+      isDefault: true
+    - name: Prometheus
+      type: prometheus
+      url: http://osm-monitoring-kube-promet-prometheus.monitoring:9090
+      access: proxy
+      allowUiUpdates: true
+      isDefault: false
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-deployment.yaml b/installers/helm/osm/templates/grafana/grafana-deployment.yaml
new file mode 100644 (file)
index 0000000..c39f4e8
--- /dev/null
@@ -0,0 +1,157 @@
+{{- if .Values.grafana.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: Deployment
+metadata:
+  labels:
+    app: grafana
+  name: grafana
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: grafana
+  template:
+    metadata:
+      labels:
+        app: grafana
+    spec:
+      containers:
+      - env:
+        - name: LABEL
+          value: grafana_dashboard
+        - name: FOLDER
+          value: "/tmp/dashboards/Kubernetes Cluster"
+        - name: RESOURCE
+          value: both
+        - name: NAMESPACE
+          value: monitoring
+        image: kiwigrid/k8s-sidecar:1.15.6
+        imagePullPolicy: IfNotPresent
+        name: grafana-sc-dashboard
+        resources: {}
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+        volumeMounts:
+        - mountPath: "/tmp/dashboards/Kubernetes Cluster"
+          name: sc-dashboard-volume-k8s
+        - mountPath: "/tmp/dashboards/Open Source MANO"
+          name: sc-dashboard-volume-osm
+      - env:
+        - name: GF_SECURITY_ADMIN_USER
+          valueFrom:
+            secretKeyRef:
+              key: admin-user
+              name: grafana
+        - name: GF_SECURITY_ADMIN_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              key: admin-password
+              name: grafana
+        image: grafana/grafana:10.1.2
+        imagePullPolicy: IfNotPresent
+        livenessProbe:
+          failureThreshold: 10
+          httpGet:
+            path: /api/health
+            port: 3000
+            scheme: HTTP
+          initialDelaySeconds: 60
+          periodSeconds: 10
+          successThreshold: 1
+          timeoutSeconds: 30
+        name: grafana
+        ports:
+        - containerPort: 80
+          name: service
+          protocol: TCP
+        - containerPort: 3000
+          name: grafana
+          protocol: TCP
+        readinessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /api/health
+            port: 3000
+            scheme: HTTP
+          periodSeconds: 10
+          successThreshold: 1
+          timeoutSeconds: 1
+        resources: {}
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+        volumeMounts:
+        - mountPath: /etc/grafana/grafana.ini
+          name: config
+          subPath: grafana.ini
+        - mountPath: /var/lib/grafana
+          name: storage
+        - mountPath: "/tmp/dashboards/Kubernetes Cluster"
+          name: sc-dashboard-volume-k8s
+        - mountPath: "/tmp/dashboards/Open Source MANO"
+          name: sc-dashboard-volume-osm
+        - mountPath: /etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml
+          name: sc-dashboard-provider
+          subPath: provider.yaml
+        - mountPath: /etc/grafana/provisioning/datasources
+          name: sc-datasources-volume
+      dnsPolicy: ClusterFirst
+      initContainers:
+      - env:
+        - name: METHOD
+          value: LIST
+        - name: LABEL
+          value: grafana_datasource
+        - name: FOLDER
+          value: /etc/grafana/provisioning/datasources
+        - name: RESOURCE
+          value: both
+        image: kiwigrid/k8s-sidecar:1.15.6
+        imagePullPolicy: IfNotPresent
+        name: grafana-sc-datasources
+        resources: {}
+        terminationMessagePath: /dev/termination-log
+        terminationMessagePolicy: File
+        volumeMounts:
+        - mountPath: /etc/grafana/provisioning/datasources
+          name: sc-datasources-volume
+      restartPolicy: Always
+      schedulerName: default-scheduler
+      securityContext:
+        {{- toYaml .Values.global.podSecurityContext | nindent 8 }}
+      serviceAccount: grafana
+      serviceAccountName: grafana
+      terminationGracePeriodSeconds: 30
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: grafana
+        name: config
+      - emptyDir: {}
+        name: storage
+      - emptyDir: {}
+        name: sc-dashboard-volume-k8s
+      - emptyDir: {}
+        name: sc-dashboard-volume-osm
+      - configMap:
+          defaultMode: 420
+          name: grafana-dashboard-provider
+        name: sc-dashboard-provider
+      - emptyDir: {}
+        name: sc-datasources-volume
+{{- end -}}
diff --git a/installers/helm/osm/templates/grafana/grafana-secret.yaml b/installers/helm/osm/templates/grafana/grafana-secret.yaml
new file mode 100644 (file)
index 0000000..fd240e6
--- /dev/null
@@ -0,0 +1,28 @@
+{{- if .Values.grafana.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: v1
+data:
+  admin-password: YWRtaW4=
+  admin-user: YWRtaW4=
+kind: Secret
+metadata:
+  labels:
+    app: grafana
+  name: grafana
+type: Opaque
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-service.yaml b/installers/helm/osm/templates/grafana/grafana-service.yaml
new file mode 100644 (file)
index 0000000..6adee4b
--- /dev/null
@@ -0,0 +1,35 @@
+{{- if .Values.grafana.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: v1
+kind: Service
+metadata:
+  labels:
+    app: grafana
+  name: grafana
+spec:
+  ports:
+  - name: service
+    nodePort: 3000
+    port: 3000
+    protocol: TCP
+    targetPort: 3000
+  selector:
+    app: grafana
+  sessionAffinity: None
+  type: NodePort
+{{- end -}}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/grafana/grafana-serviceaccount.yaml b/installers/helm/osm/templates/grafana/grafana-serviceaccount.yaml
new file mode 100644 (file)
index 0000000..63ea515
--- /dev/null
@@ -0,0 +1,24 @@
+{{- if .Values.grafana.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: v1
+kind: ServiceAccount
+metadata:
+  labels:
+    app: grafana
+  name: grafana
+{{- end -}}
\ No newline at end of file
index 4fcbd58..04bb6b2 100644 (file)
@@ -78,11 +78,6 @@ spec:
           {{- end }}
           {{- if or .Values.vca.enabled .Values.mon.useOsmSecret }}
           env:
-            - name: OSMMON_GRAFANA_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: grafana
-                  key: admin-password
             {{- if .Values.vca.enabled }}
             - name: OSMMON_VCA_HOST
               valueFrom:
@@ -120,4 +115,4 @@ spec:
       tolerations:
         {{- toYaml . | nindent 8 }}
       {{- end }}
-{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml
new file mode 100644 (file)
index 0000000..b4f2679
--- /dev/null
@@ -0,0 +1,37 @@
+{{- if not .Values.global.oldServiceAssurance -}}
+{{- 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: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "osm.fullname" . }}-prometheus-alertingrules-configmap
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+data:
+  osm_alert_rules.yml: |
+    groups:
+      - name: osm_alert_rules
+        rules:
+        - alert: vdu_down
+          expr: vm_status_extended != 1
+          for: 3m
+          annotations:
+            summary: "VDU {{ "{{" }} $labels.vm_id }} in VIM {{ "{{" }} $labels.vim_id }} is down"
+            description: "VDU {{ "{{" }} $labels.vm_id }} in VIM {{ "{{" }} $labels.vim_id }} has been down for more than 3 minutes. NS instance id is {{ "{{" }} $labels.ns_id }}"
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-configmap.yaml
new file mode 100644 (file)
index 0000000..b213e22
--- /dev/null
@@ -0,0 +1,30 @@
+{{- 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: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "osm.fullname" . }}-prometheus-configmap
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+data:
+  MONGODB_URL: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
+  PROMETHEUS_CONFIG_FILE: "/etc/prometheus/prometheus.yml"
+  PROMETHEUS_BASE_CONFIG_FILE: "/etc/prometheus_base/prometheus.yml"
+  TARGET_DATABASE: "osm"
+  PROMETHEUS_URL: "http://prometheus:9090"
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml
new file mode 100644 (file)
index 0000000..18fef22
--- /dev/null
@@ -0,0 +1,87 @@
+{{- 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: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "osm.fullname" . }}-prometheus-prom-configmap
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+data:
+  prometheus.yml: |
+    # Copyright 2018 The Prometheus Authors
+    # Copyright 2018 Whitestack
+    # Copyright 2018 Telefonica Investigacion y Desarrollo, S.A.U.
+    #
+    # 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.
+
+    # my global config
+    global:
+      scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
+      evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
+      # scrape_timeout is set to the global default (10s).
+
+    # Alertmanager configuration
+    alerting:
+      alertmanagers:
+      - static_configs:
+        - targets:
+{{- if .Values.global.oldServiceAssurance }}
+          # - alertmanager:9093
+{{- else }}
+          - alertmanager:9093
+{{- end }}
+    # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
+{{- if .Values.global.oldServiceAssurance }}
+    rule_files:
+      # - "first_rules.yml"
+      # - "second_rules.yml"
+{{- else }}
+    rule_files:
+      - "osm_metric_rules.yml"
+      - "osm_alert_rules.yml"
+{{- end }}
+    # A scrape configuration containing exactly one endpoint to scrape:
+    # Here it's Prometheus itself.
+    scrape_configs:
+      - job_name: 'mon_exporter'
+        static_configs:
+        - targets: ['mon:8000']
+{{- if .Values.global.oldServiceAssurance }}
+      # Add here other external targets, e.g. a pushgateway
+      # - job_name: 'pushgateway'
+      #   static_configs:
+      #   - targets: ['prometheus-pushgateway:9091']
+{{- else }}
+      - job_name: pushgateway
+        honor_labels: true
+        scrape_interval: 30s
+        static_configs:
+        - targets:
+          - pushgateway-prometheus-pushgateway:9091
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-recordingrules-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-recordingrules-configmap.yaml
new file mode 100644 (file)
index 0000000..c314d86
--- /dev/null
@@ -0,0 +1,43 @@
+{{- if not .Values.global.oldServiceAssurance -}}
+{{- 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: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "osm.fullname" . }}-prometheus-recordingrules-configmap
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+data:
+  osm_metric_rules.yml: |
+    groups:
+      - name: osm_metric_rules
+        rules:
+        - record: vm_status_extended
+          expr: (last_over_time(vm_status[1m]) * on (vm_id, vim_id) group_left(ns_id, vnf_id, vdu_id, project_id, job, vdu_name, vnf_member_index) last_over_time(ns_topology[1m])) or (last_over_time(ns_topology[1m]) * -1)
+          labels:
+            job: osm_prometheus
+        - record: vnf_status
+          expr: (0 * (count (vm_status_extended==0) by (ns_id, vnf_id)>=0)) or (min by (ns_id, vnf_id) (vm_status_extended))
+          labels:
+            job: osm_prometheus
+        - record: ns_status
+          expr: (0 * (count (vm_status_extended==0) by (ns_id)>=0)) or (min by (ns_id) (vm_status_extended))
+          labels:
+            job: osm_prometheus
+{{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-service.yaml b/installers/helm/osm/templates/prometheus/prometheus-service.yaml
new file mode 100644 (file)
index 0000000..99eef4a
--- /dev/null
@@ -0,0 +1,34 @@
+{{- 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: v1
+kind: Service
+metadata:
+  name: prometheus
+  labels:
+    {{- include "osm.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.prometheus.service.type }}
+  ports:
+    - nodePort: {{ .Values.prometheus.service.nodePort }}
+      port: 9090
+      targetPort: 9090
+      protocol: TCP
+  selector:
+    app.kubernetes.io/component: prometheus
+    {{- include "osm.selectorLabels" . | nindent 4 }}
+{{- end }}
\ No newline at end of file
diff --git a/installers/helm/osm/templates/prometheus/prometheus-statefulset.yaml b/installers/helm/osm/templates/prometheus/prometheus-statefulset.yaml
new file mode 100644 (file)
index 0000000..96f2281
--- /dev/null
@@ -0,0 +1,141 @@
+{{- 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 }}
index 1575136..0391a4f 100644 (file)
@@ -278,231 +278,13 @@ pol:
 
 prometheus:
   enabled: true
-  configmapReload:
-    prometheus:
-      enabled: true
-  prometheus-node-exporter:
-    enabled: false
-  kube-state-metrics:
-    enabled: false
-  server:
-    extraFlags:
-      - web.enable-lifecycle
-    statefulSet:
-      enabled: true
-    configPath: /etc/prometheus/prometheus.yml
-    fullnameOverride: "prometheus"
-    service:
-      servicePort: 9090
-    #   type: NodePort
-    #   nodePort: 9091
-    ingress:
-      enabled: true
-      ingressClassName: nginx
-      # hosts:
-      #   - prometheus.<IP_ADDRESS>.nip.io
-    sidecarContainers:
-      prometheus-config-sidecar:
-        securityContext:
-          # readOnlyRootFilesystem: true
-          allowPrivilegeEscalation: false
-          # runAsNonRoot: true
-        image: opensourcemano/prometheus:testing-daily
-        imagePullPolicy: IfNotPresent
-        command: ["/bin/sh", "-c"]
-        args: ["sleep 50; python -u ./app.py"]
-        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: osm-prometheus-sidecar-configmap
-    extraInitContainers:
-      - name: prometheus-init-config
-        image: busybox
-        command: ["/bin/sh", "-c"]
-          #args: [' sleep 100000 ']
-        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']
-        volumeMounts:
-          - name: prom-config
-            mountPath: /etc/prometheus
-          - name: prom-config-base
-            mountPath: /config
-    extraVolumeMounts:
-      - name: prom-config
-        mountPath: /etc/prometheus
-    extraVolumes:
-      - name: prom-config
-        emptyDir: {}
-      - name: prom-config-base
-        projected:
-          sources:
-            - configMap:
-                name: osm-prom-configmap
-                items:
-                  - key: prometheus.yml
-                    path: prometheus.yml
-            - configMap:
-                name: osm-prometheus-recordingrules-configmap
-                items:
-                  - key: osm_metric_rules.yml
-                    path: osm_metric_rules.yml
-            - configMap:
-                name: osm-prometheus-alertingrules-configmap
-                items:
-                  - key: osm_alert_rules.yml
-                    path: osm_alert_rules.yml
-  extraManifests:
-    - |
-      apiVersion: v1
-      kind: ConfigMap
-      metadata:
-        name: osm-prometheus-alertingrules-configmap
-      data:
-        osm_alert_rules.yml: |
-          groups:
-            - name: osm_alert_rules
-              rules:
-              - alert: vdu_down
-                expr: vm_status_extended != 1
-                for: 3m
-                annotations:
-                  summary: "VDU {{ "{{" }} $labels.vm_id }} in VIM {{ "{{" }} $labels.vim_id }} is down"
-                  description: "VDU {{ "{{" }} $labels.vm_id }} in VIM {{ "{{" }} $labels.vim_id }} has been down for more than 3 minutes. NS instance id is {{ "{{" }} $labels.ns_id }}"
-    - |
-      apiVersion: v1
-      kind: ConfigMap
-      metadata:
-        name: osm-prometheus-recordingrules-configmap
-      data:
-        osm_metric_rules.yml: |
-          groups:
-            - name: osm_metric_rules
-              rules:
-              - record: vm_status_extended
-                expr: (last_over_time(vm_status[1m]) * on (vm_id, vim_id) group_left(ns_id, vnf_id, vdu_id, project_id, job, vdu_name, vnf_member_index) last_over_time(ns_topology[1m])) or (last_over_time(ns_topology[1m]) * -1)
-                labels:
-                  job: osm_prometheus
-              - record: vnf_status
-                expr: (0 * (count (vm_status_extended==0) by (ns_id, vnf_id)>=0)) or (min by (ns_id, vnf_id) (vm_status_extended))
-                labels:
-                  job: osm_prometheus
-              - record: ns_status
-                expr: (0 * (count (vm_status_extended==0) by (ns_id)>=0)) or (min by (ns_id) (vm_status_extended))
-                labels:
-                  job: osm_prometheus
-    - |
-      apiVersion: v1
-      kind: ConfigMap
-      metadata:
-        name: osm-prometheus-sidecar-configmap
-      data:
-        MONGODB_URL: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
-        PROMETHEUS_CONFIG_FILE: "/etc/prometheus/prometheus.yml"
-        PROMETHEUS_BASE_CONFIG_FILE: "/etc/prometheus_base/prometheus.yml"
-        TARGET_DATABASE: "osm"
-        PROMETHEUS_URL: "http://prometheus:9090"
-    - |
-      apiVersion: v1
-      kind: ConfigMap
-      metadata:
-        name: osm-prom-configmap
-      data:
-        prometheus.yml: |
-          global:
-            scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
-            evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
-            # scrape_timeout is set to the global default (10s).
-          # Alertmanager configuration
-          alerting:
-            alertmanagers:
-            - static_configs:
-              - targets:
-                - alertmanager:9093
-          rule_files:
-            - "osm_metric_rules.yml"
-            - "osm_alert_rules.yml"
-          scrape_configs:
-            - job_name: 'mon_exporter'
-              static_configs:
-              - targets: ['mon:8000']
-            - job_name: pushgateway
-              honor_labels: true
-              scrape_interval: 30s
-              static_configs:
-              - targets:
-                - pushgateway-prometheus-pushgateway:9091
-            - job_name: prometheus
-              static_configs:
-                - targets:
-                  - localhost:9090
-            - job_name: node
-              static_configs:
-                - targets: ['prometheus-node-exporter:9100']
-  alertmanager:
-    enabled: true
-    fullnameOverride: "alertmanager"
-    extraArgs:
-      log.level: debug
-    # service:
-    #   type: NodePort
-    #   nodePort: 9093
-    #   port: 9093
-    # ingress:
-    #   enabled: True
-    #   className: nginx
-    #   hosts:
-    #     - host: localhost
-    #       paths:
-    #         - path: /
-    #           pathType: ImplementationSpecific
-    #   tls: []
-    config:
-      receivers:
-        - name: default-receiver
-        - name: vdu-webhook
-          webhook_configs:
-           - url: http://webhook-translator:9998/vdu_down
-        - name: scaleout-webhook
-          webhook_configs:
-           - url: http://webhook-translator:9998/scaleout_vdu
-        - name: scalein-webhook
-          webhook_configs:
-           - url: http://webhook-translator:9998/scalein_vdu
-        - name: alarm-webhook
-          webhook_configs:
-           - url: http://webhook-translator:9998/vdu_alarm
-      route:
-        group_wait: 10s
-        group_interval: 2m
-        receiver: default-receiver
-        routes:
-        - receiver: vdu-webhook
-          repeat_interval: 15m
-          matchers:
-          - alertname = "vdu_down"
-        - receiver: 'scaleout-webhook'
-          repeat_interval: 5m
-          matchers:
-          - alertname =~ "^scaleout_.*"
-        - receiver: 'scalein-webhook'
-          repeat_interval: 5m
-          matchers:
-          - alertname =~ "^scalein_.*"
-        - receiver: 'alarm-webhook'
-          repeat_interval: 5m
-          matchers:
-          - alertname =~ "^vdu_alarm_.*"
-  prometheus-pushgateway:
-    fullnameOverride: "pushgateway-prometheus-pushgateway"
-
+  service:
+    type: NodePort
+    nodePort: 9091
+  # replicaCount: 1
+  sidecarImage: {}
+    # repository: opensourcemano/ro
+    # tag: "testing-daily"
 ro:
   enabled: true
   # logLevel: DEBUG
index 1347650..b9e528f 100644 (file)
@@ -593,9 +593,9 @@ node("${params.NODE}") {
                                     ${osm_installation_options}
                             """
                         }
-                        prometheusHostname = "prometheus.${IP_ADDRESS}.nip.io"
-                        prometheusPort = 80
-                        osmHostname = "nbi.${IP_ADDRESS}.nip.io:443"
+                       prometheusHostname = IP_ADDRESS
+                        prometheusPort = 9091
+                        osmHostname = IP_ADDRESS
                     }
                 } // stage("Install")
 ///////////////////////////////////////////////////////////////////////////////////////