From 94bfc956f43bcaec29f2fc9844b9ca4c35d72260 Mon Sep 17 00:00:00 2001 From: Rajamohan Raj Date: Thu, 18 Jun 2020 14:55:42 -0700 Subject: Integrate collectd, prometheus and grafana. In this patch, made neccessary changes in collectd and prometheus helm charts such that prometheus can pull data from collectd. Prometheus GUI and Grafana GUI are verified as well. Issue-ID: MULTICLOUD-1082 Signed-off-by: Rajamohan Raj Change-Id: I39b7e20f46aa789272be671056a76dd926701068 --- .../collection/app2/helm/prometheus/.helmignore | 22 ------- .../collection/app2/helm/prometheus/Chart.yaml | 5 -- .../app2/helm/prometheus/templates/NOTES.txt | 15 ----- .../app2/helm/prometheus/templates/_helpers.tpl | 57 ----------------- .../app2/helm/prometheus/templates/prometheus.yaml | 19 ------ .../app2/helm/prometheus/templates/role.yaml | 19 ------ .../helm/prometheus/templates/rolebinding.yaml | 15 ----- .../app2/helm/prometheus/templates/service.yaml | 38 ----------- .../helm/prometheus/templates/serviceaccount.yaml | 11 ---- .../helm/prometheus/templates/servicemonitor.yaml | 30 --------- .../collection/app2/helm/prometheus/values.yaml | 73 ---------------------- 11 files changed, 304 deletions(-) delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/.helmignore delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/Chart.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/NOTES.txt delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/_helpers.tpl delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/prometheus.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/role.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/rolebinding.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/service.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/serviceaccount.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/servicemonitor.yaml delete mode 100644 kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/values.yaml (limited to 'kud/tests/vnfs/comp-app/collection/app2/helm/prometheus') diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/.helmignore b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/.helmignore deleted file mode 100644 index 50af0317..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/.helmignore +++ /dev/null @@ -1,22 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/Chart.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/Chart.yaml deleted file mode 100644 index 6e7ddfbc..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -appVersion: "1.0" -description: Prometheus instance with remote storage integrations. -name: prometheus -version: 0.1.0 diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/NOTES.txt b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/NOTES.txt deleted file mode 100644 index f8882883..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/NOTES.txt +++ /dev/null @@ -1,15 +0,0 @@ -1. Get the application URL by running these commands: -{{ if contains "NodePort" .Values.prometheus.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "prometheus.fullname" . }}-prometheus) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.prometheus.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ include "prometheus.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "prometheus.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.prometheus.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "prometheus.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:9090 to use your application" - kubectl port-forward $POD_NAME 9090:80 -{{- end }} diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/_helpers.tpl b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/_helpers.tpl deleted file mode 100644 index 17b7e7bd..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/_helpers.tpl +++ /dev/null @@ -1,57 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "prometheus.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "prometheus.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "prometheus.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* Create chart name and version as used by the chart label. */}} -{{- define "prometheus.chartref" -}} -{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}} -{{- end }} - -{{/* Generate basic labels */}} -{{- define "prometheus.labels" }} -chart: {{ template "prometheus.chartref" . }} -release: {{ .Release.Name | quote }} -heritage: {{ .Release.Service | quote }} -{{- if .Values.commonLabels}} -{{ toYaml .Values.commonLabels }} -{{- end }} -{{- end }} - - -{{/* Create the name of prometheus service account to use */}} -{{- define "prometheus.serviceAccountName" -}} -{{- if .Values.prometheus.serviceAccount.create -}} - {{ default (include "prometheus.fullname" .) .Values.prometheus.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.prometheus.serviceAccount.name }} -{{- end -}} -{{- end -}} \ No newline at end of file diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/prometheus.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/prometheus.yaml deleted file mode 100644 index 53494920..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/prometheus.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: Prometheus -metadata: - name: {{ template "prometheus.fullname" . }}-prometheus - labels: - app: {{ template "prometheus.name" . }}-prometheus - "helm.sh/hook": post-install - "helm.sh/hook-weight": "2" -spec: - serviceAccountName: {{ template "prometheus.serviceAccountName" . }} - serviceMonitorSelector: - matchLabels: - app: {{ template "prometheus.name" . }}-prometheus - release: {{ .Release.Name }} - serviceMonitorNamespaceSelector: - matchNames: - - {{ .Release.Namespace | quote }} - resources: -{{ toYaml .Values.prometheus.resources | indent 4 }} diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/role.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/role.yaml deleted file mode 100644 index a3c69c31..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/role.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: {{ template "prometheus.fullname" . }}-prometheus - labels: - app: {{ template "prometheus.name" . }}-prometheus -{{ include "prometheus.labels" . | indent 4 }} -rules: -- apiGroups: - - "" - resources: - - nodes - - services - - endpoints - - pods - verbs: - - get - - list - - watch \ No newline at end of file diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/rolebinding.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/rolebinding.yaml deleted file mode 100644 index a721cd42..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/rolebinding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: {{ template "prometheus.fullname" . }}-prometheus - labels: - app: {{ template "prometheus.name" . }}-prometheus -{{ include "prometheus.labels" . | indent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ template "prometheus.fullname" . }}-prometheus -subjects: -- kind: ServiceAccount - name: {{ template "prometheus.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} \ No newline at end of file diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/service.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/service.yaml deleted file mode 100644 index 56fbb5f4..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/service.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "prometheus.fullname" . }}-prometheus - labels: - app: {{ template "prometheus.name" . }}-prometheus -{{- if .Values.prometheus.service.annotations }} - annotations: -{{ toYaml .Values.prometheus.service.annotations | indent 4 }} -{{- end }} -spec: -{{- if .Values.prometheus.service.clusterIP }} - clusterIP: {{ .Values.prometheus.service.clusterIP }} -{{- end }} -{{- if .Values.prometheus.service.externalIPs }} - externalIPs: -{{ toYaml .Values.prometheus.service.externalIPs | indent 4 }} -{{- end }} -{{- if .Values.prometheus.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.prometheus.service.loadBalancerIP }} -{{- end }} -{{- if .Values.prometheus.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: - {{- range $cidr := .Values.prometheus.service.loadBalancerSourceRanges }} - - {{ $cidr }} - {{- end }} -{{- end }} - ports: - - name: {{ .Values.prometheus.service.nameOfPort }} - {{- if eq .Values.prometheus.service.type "NodePort" }} - nodePort: {{ .Values.global.nodePortPrefix }}{{ .Values.prometheus.service.nodePort }} - {{- end }} - port: 9090 - targetPort: {{ .Values.prometheus.service.nameOfPort }} - selector: - app: prometheus - prometheus: {{ template "prometheus.fullname" . }}-prometheus - type: "{{ .Values.prometheus.service.type }}" diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/serviceaccount.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/serviceaccount.yaml deleted file mode 100644 index 82437523..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/serviceaccount.yaml +++ /dev/null @@ -1,11 +0,0 @@ -{{- if .Values.prometheus.serviceAccount.create }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "prometheus.serviceAccountName" . }} - labels: - app: {{ template "prometheus.name" . }}-prometheus -{{ include "prometheus.labels" . | indent 4 }} -imagePullSecrets: -{{ toYaml .Values.global.imagePullSecrets | indent 2 }} -{{- end }} diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/servicemonitor.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/servicemonitor.yaml deleted file mode 100644 index ea2b81b6..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/templates/servicemonitor.yaml +++ /dev/null @@ -1,30 +0,0 @@ -{{- if .Values.prometheus.additionalServiceMonitors }} -apiVersion: v1 -kind: List -items: -{{- range .Values.prometheus.additionalServiceMonitors }} - - apiVersion: "monitoring.coreos.com/v1" - kind: ServiceMonitor - metadata: - name: {{ .name }} - "helm.sh/hook": post-install - "helm.sh/hook-weight": "1" - labels: - app: {{ template "prometheus.name" $ }}-prometheus -{{ include "prometheus.labels" $ | indent 8 }} - {{- if .additionalLabels }} -{{ toYaml .additionalLabels | indent 8 }} - {{- end }} - spec: - endpoints: -{{ toYaml .endpoints | indent 8 }} - {{- if .jobLabel }} - jobLabel: {{ .jobLabel }} - {{- end }} - namespaceSelector: - matchNames: - - {{ $.Release.Namespace | quote }} - selector: -{{ toYaml .selector | indent 8 }} release: {{ $.Release.Name | quote }} -{{- end }} -{{- end }} diff --git a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/values.yaml b/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/values.yaml deleted file mode 100644 index fa528900..00000000 --- a/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus/values.yaml +++ /dev/null @@ -1,73 +0,0 @@ -## Deploy a Prometheus instance -## -prometheus: - serviceAccount: - create: true - name: "" - additionalServiceMonitors: - - name: service-monitor-collectd - additionalLabels: - collector: collectd - jobLabel: collectd - selector: - matchLabels: - app: collectd - endpoints: - - port: collectd-prometheus - interval: 10s - path: /metrics - - name: service-monitor-node-exporter - additionalLabels: - collector: prometheus-node-exporter - jobLabel: node-exporter - selector: - matchLabels: - app: prometheus-node-exporter - endpoints: - - port: metrics - interval: 30s - - name: service-monitor-cadvisor - additionalLabels: - collector: cadvisor - jobLabel: cadvisor - selector: - matchLabels: - app: cadvisor - endpoints: - - port: cadvisor-prometheus - interval: 10s - path: /metrics - - resources: {} - service: - nameOfPort: web - type: ClusterIP - annotations: {} - labels: {} - clusterIP: "" - - ## To be used with a proxy extraContainer port - targetPort: 9090 - - ## List of IP addresses at which the Prometheus server service is available - ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips - ## - externalIPs: [] - - ## Port to expose on each node - ## Only used if service.type is 'NodePort' - ## - # nodePort: 90 - - ## Loadbalancer IP - ## Only use if service.type is "loadbalancer" - loadBalancerIP: "" - loadBalancerSourceRanges: [] - ## Service type - ## - #type: NodePort - - sessionAffinity: "" - -global: - imagePullSecrets: "" \ No newline at end of file -- cgit 1.2.3-korg