From abf6770c2ec33d6ae0b1fb93be1093081abb5a9f Mon Sep 17 00:00:00 2001 From: zamre Date: Wed, 7 Feb 2024 15:06:16 +0000 Subject: [PATCH] Feature 11010: Use of upstream helm charts for Prometheus and Grafana in OSM installation. Change-Id: I5ea705b61047bb46fe4d31312fb9ed89ef4e270a Signed-off-by: zamre Signed-off-by: Rahul Zamre --- installers/full_install_osm.sh | 2 +- installers/helm/osm/Chart.yaml | 8 + installers/helm/osm/templates/NOTES.txt | 2 + .../grafana/grafana-clusterrole.yaml | 34 -- .../grafana/grafana-clusterrolebinding.yaml | 32 -- .../templates/grafana/grafana-configmap.yaml | 33 -- .../grafana-dashboard-provider-configmap.yaml | 42 --- .../grafana/grafana-datasource-configmap.yaml | 40 --- .../templates/grafana/grafana-deployment.yaml | 157 --------- .../osm/templates/grafana/grafana-secret.yaml | 28 -- .../templates/grafana/grafana-service.yaml | 35 -- .../grafana/grafana-serviceaccount.yaml | 24 -- .../osm/templates/mon/mon-deployment.yaml | 7 +- .../prometheus-alertingrules-configmap.yaml | 37 --- .../prometheus/prometheus-configmap.yaml | 30 -- .../prometheus/prometheus-prom-configmap.yaml | 87 ----- .../prometheus-recordingrules-configmap.yaml | 43 --- .../prometheus/prometheus-service.yaml | 34 -- .../prometheus/prometheus-statefulset.yaml | 141 -------- installers/helm/osm/values.yaml | 306 +++++++++++++++++- installers/install_ngsa.sh | 8 +- 21 files changed, 320 insertions(+), 810 deletions(-) delete mode 100644 installers/helm/osm/templates/grafana/grafana-clusterrole.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-clusterrolebinding.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-configmap.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-dashboard-provider-configmap.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-datasource-configmap.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-deployment.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-secret.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-service.yaml delete mode 100644 installers/helm/osm/templates/grafana/grafana-serviceaccount.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-configmap.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-recordingrules-configmap.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-service.yaml delete mode 100644 installers/helm/osm/templates/prometheus/prometheus-statefulset.yaml diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index b7df2d5c..f463723b 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -278,7 +278,7 @@ EOF" OSM_HELM_OPTS="" # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false" OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}" - OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mysql.dbHostPath=${OSM_NAMESPACE_VOL}" + # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mysql.dbHostPath=${OSM_NAMESPACE_VOL}" # not needed as mysql is now bitnami helm chart if [ -n "${INSTALL_JUJU}" ]; then OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.enabled=true" OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.host=${OSM_VCA_HOST}" diff --git a/installers/helm/osm/Chart.yaml b/installers/helm/osm/Chart.yaml index 346986de..0b169544 100644 --- a/installers/helm/osm/Chart.yaml +++ b/installers/helm/osm/Chart.yaml @@ -34,6 +34,14 @@ 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" diff --git a/installers/helm/osm/templates/NOTES.txt b/installers/helm/osm/templates/NOTES.txt index ea59625b..8dd736a8 100644 --- a/installers/helm/osm/templates/NOTES.txt +++ b/installers/helm/osm/templates/NOTES.txt @@ -27,3 +27,5 @@ 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 }} +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 diff --git a/installers/helm/osm/templates/grafana/grafana-clusterrole.yaml b/installers/helm/osm/templates/grafana/grafana-clusterrole.yaml deleted file mode 100644 index 1e2753a9..00000000 --- a/installers/helm/osm/templates/grafana/grafana-clusterrole.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- 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 deleted file mode 100644 index 46669bf2..00000000 --- a/installers/helm/osm/templates/grafana/grafana-clusterrolebinding.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- 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 deleted file mode 100644 index 7d4653b2..00000000 --- a/installers/helm/osm/templates/grafana/grafana-configmap.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{- 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 deleted file mode 100644 index 68dc91b8..00000000 --- a/installers/helm/osm/templates/grafana/grafana-dashboard-provider-configmap.yaml +++ /dev/null @@ -1,42 +0,0 @@ -{{- 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 deleted file mode 100644 index ac07a36c..00000000 --- a/installers/helm/osm/templates/grafana/grafana-datasource-configmap.yaml +++ /dev/null @@ -1,40 +0,0 @@ -{{- 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 deleted file mode 100644 index c39f4e81..00000000 --- a/installers/helm/osm/templates/grafana/grafana-deployment.yaml +++ /dev/null @@ -1,157 +0,0 @@ -{{- 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 deleted file mode 100644 index fd240e60..00000000 --- a/installers/helm/osm/templates/grafana/grafana-secret.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- 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 deleted file mode 100644 index 6adee4b1..00000000 --- a/installers/helm/osm/templates/grafana/grafana-service.yaml +++ /dev/null @@ -1,35 +0,0 @@ -{{- 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 deleted file mode 100644 index 63ea5156..00000000 --- a/installers/helm/osm/templates/grafana/grafana-serviceaccount.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- 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 diff --git a/installers/helm/osm/templates/mon/mon-deployment.yaml b/installers/helm/osm/templates/mon/mon-deployment.yaml index 04bb6b25..4fcbd587 100644 --- a/installers/helm/osm/templates/mon/mon-deployment.yaml +++ b/installers/helm/osm/templates/mon/mon-deployment.yaml @@ -78,6 +78,11 @@ 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: @@ -115,4 +120,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml b/installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml deleted file mode 100644 index b4f26794..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-alertingrules-configmap.yaml +++ /dev/null @@ -1,37 +0,0 @@ -{{- 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 deleted file mode 100644 index b213e22e..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-configmap.yaml +++ /dev/null @@ -1,30 +0,0 @@ -{{- 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 deleted file mode 100644 index 18fef224..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-prom-configmap.yaml +++ /dev/null @@ -1,87 +0,0 @@ -{{- 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 deleted file mode 100644 index c314d86e..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-recordingrules-configmap.yaml +++ /dev/null @@ -1,43 +0,0 @@ -{{- 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 deleted file mode 100644 index 99eef4a2..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-service.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- 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 deleted file mode 100644 index 96f22813..00000000 --- a/installers/helm/osm/templates/prometheus/prometheus-statefulset.yaml +++ /dev/null @@ -1,141 +0,0 @@ -{{- 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 }} diff --git a/installers/helm/osm/values.yaml b/installers/helm/osm/values.yaml index 0cdfe6a1..3d0e1dcd 100644 --- a/installers/helm/osm/values.yaml +++ b/installers/helm/osm/values.yaml @@ -73,6 +73,96 @@ certauth: grafana: enabled: true + fullnameOverride: "grafana" + service: + type: NodePort + nodePort: 3000 + port: 3000 + extraVolumes: + - emptyDir: {} + name: sc-dashboard-volume-k8s + - emptyDir: {} + name: sc-dashboard-volume-osm + extraVolumeMounts: + - name: sc-dashboard-volume-k8s + mountPath: "/tmp/dashboards/Kubernetes Cluster" + - name: sc-dashboard-volume-osm + mountPath: "/tmp/dashboards/Open Source MANO" + rbac: + extraClusterRoleRules: + - apiGroups: + - "" + resources: + - configmaps + - secrets + verbs: + - get + - watch + - list + datasources: + 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 + dashboardProviders: + 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' + sidecar: + dashboards: + enabled: true + folder: "/tmp/dashboards/" + resource: both + searchNamespace: osm + extraMounts: + - name: sc-dashboard-volume-k8s + mountPath: "/tmp/dashboards/Kubernetes Cluster" + - name: sc-dashboard-volume-osm + mountPath: "/tmp/dashboards/Open Source MANO" + extraInitContainers: + - 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: config kafka: enabled: true @@ -173,13 +263,215 @@ pol: prometheus: enabled: true - service: - type: NodePort - nodePort: 9091 - # replicaCount: 1 - sidecarImage: {} - # repository: opensourcemano/ro - # tag: "testing-daily" + 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 + sidecarContainers: + prometheus-config-sidecar: + securityContext: + # readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + # runAsNonRoot: true + image: opensourcemano/prometheus + 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: + fullnameOverride: "alertmanager" + extraArgs: + log.level: debug + service: + type: NodePort + nodePort: 9093 + port: 9093 + 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" ro: enabled: true diff --git a/installers/install_ngsa.sh b/installers/install_ngsa.sh index 65c9f89f..a1f7fa39 100755 --- a/installers/install_ngsa.sh +++ b/installers/install_ngsa.sh @@ -113,8 +113,8 @@ echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" install_airflow track deploy_osm airflow_ok -install_prometheus_pushgateway -track deploy_osm pushgateway_ok -install_prometheus_alertmanager -track deploy_osm alertmanager_ok +#install_prometheus_pushgateway +#track deploy_osm pushgateway_ok +#install_prometheus_alertmanager +#track deploy_osm alertmanager_ok -- 2.25.1