From f73a061d37837ef7893fc0a15019ff44d3288260 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 08:32:46 +0200 Subject: [PATCH 1/6] refactoring ocf. Including enabled condition --- .gitignore | 4 - helm/capif/Chart.yaml | 10 + helm/capif/charts/fluentbit/.helmignore | 23 + helm/capif/charts/fluentbit/Chart.yaml | 24 + .../charts/fluentbit/templates/NOTES.txt | 22 + .../charts/fluentbit/templates/_helpers.tpl | 62 + .../fluentbit/templates/configmap.yaml} | 4 +- .../fluentbit/templates/deployment.yaml | 79 + .../capif/charts/fluentbit/templates/hpa.yaml | 34 + .../charts/fluentbit/templates/ingress.yaml | 63 + .../charts/fluentbit/templates/service.yaml | 21 + .../fluentbit/templates/serviceaccount.yaml | 15 + helm/capif/charts/fluentbit/values.yaml | 116 + helm/capif/charts/grafana/.helmignore | 23 + helm/capif/charts/grafana/Chart.yaml | 24 + helm/capif/charts/grafana/README.md | 51 + .../charts/grafana/kubernetes-dashboard.json | 2629 +++++++++++++++++ helm/capif/charts/grafana/loki-logs.json | 281 ++ helm/capif/charts/grafana/templates/NOTES.txt | 22 + .../charts/grafana/templates/_helpers.tpl | 62 + .../grafana/templates/configmap.yaml} | 52 +- .../grafana/templates/deployment.yaml} | 82 +- helm/capif/charts/grafana/templates/hpa.yaml | 30 + .../charts/grafana/templates/ingress.yaml | 61 + helm/capif/charts/grafana/templates/pvc.yaml | 17 + .../charts/grafana/templates/secrets.yaml | 10 + .../charts/grafana/templates/service.yaml | 17 + .../grafana/templates/serviceaccount.yaml | 14 + .../templates/tests/test-connection.yaml | 17 + helm/capif/charts/grafana/values.yaml | 99 + helm/capif/charts/loki/.helmignore | 23 + helm/capif/charts/loki/Chart.yaml | 24 + helm/capif/charts/loki/templates/NOTES.txt | 22 + helm/capif/charts/loki/templates/_helpers.tpl | 62 + .../charts/loki/templates/deployment.yaml | 74 + helm/capif/charts/loki/templates/hpa.yaml | 34 + helm/capif/charts/loki/templates/ingress.yaml | 63 + helm/capif/charts/loki/templates/pvc.yaml | 16 + helm/capif/charts/loki/templates/service.yaml | 17 + .../charts/loki/templates/serviceaccount.yaml | 15 + .../loki/templates/tests/test-connection.yaml | 17 + helm/capif/charts/loki/values.yaml | 115 + .../mock-server/templates/deployment.yaml | 2 + .../charts/mock-server/templates/hpa.yaml | 2 + .../charts/mock-server/templates/ingress.yaml | 2 + .../charts/mock-server/templates/service.yaml | 2 + .../mock-server/templates/serviceaccount.yaml | 2 + .../templates/tests/test-connection.yaml | 2 + helm/capif/charts/mock-server/values.yaml | 2 + .../mongo-express/templates/deployment.yaml | 2 + .../charts/mongo-express/templates/hpa.yaml | 2 + .../mongo-express/templates/ingress.yaml | 6 +- .../mongo-express/templates/service.yaml | 2 + .../templates/serviceaccount.yaml | 2 + .../templates/tests/test-connection.yaml | 2 + helm/capif/charts/mongo-express/values.yaml | 4 +- .../templates/deployment.yaml | 2 + .../mongo-register-express/templates/hpa.yaml | 2 + .../templates/ingress.yaml | 6 +- .../templates/service.yaml | 2 + .../templates/serviceaccount.yaml | 2 + .../templates/tests/test-connection.yaml | 4 +- .../charts/mongo-register-express/values.yaml | 4 +- helm/capif/charts/otelcollector/.helmignore | 23 + helm/capif/charts/otelcollector/Chart.yaml | 24 + .../charts/otelcollector/templates/NOTES.txt | 26 + .../otelcollector/templates/_helpers.tpl | 62 + .../otelcollector/templates/configmap.yaml} | 4 +- .../otelcollector/templates/deployment.yaml | 75 + .../charts/otelcollector/templates/hpa.yaml | 34 + .../otelcollector/templates/ingress.yaml | 63 + .../otelcollector/templates/service.yaml | 19 + .../templates/serviceaccount.yaml | 15 + helm/capif/charts/otelcollector/values.yaml | 119 + helm/capif/charts/renderer/.helmignore | 23 + helm/capif/charts/renderer/Chart.yaml | 24 + .../capif/charts/renderer/templates/NOTES.txt | 22 + .../charts/renderer/templates/_helpers.tpl | 62 + .../charts/renderer/templates/configmap.yaml | 8 + .../charts/renderer/templates/deployment.yaml | 74 + helm/capif/charts/renderer/templates/hpa.yaml | 34 + .../charts/renderer/templates/ingress.yaml | 63 + .../charts/renderer/templates/service.yaml | 17 + .../renderer/templates/serviceaccount.yaml | 15 + .../templates/tests/test-connection.yaml | 17 + helm/capif/charts/renderer/values.yaml | 112 + helm/capif/templates/deployment.yaml | 1 - helm/capif/templates/fluent-bit-service.yaml | 24 - .../capif/templates/fluentbit-deployment.yaml | 59 - .../templates/grafana-ingress-route.yaml | 18 - helm/capif/templates/grafana-ingress.yaml | 34 - helm/capif/templates/grafana-pvc.yaml | 17 - helm/capif/templates/grafana-secrets.yaml | 10 - helm/capif/templates/grafana-service.yaml | 17 - helm/capif/templates/loki-deployment.yaml | 54 - helm/capif/templates/loki-pvc.yaml | 17 - helm/capif/templates/loki-service.yaml | 19 - .../templates/otel-collector-deployment.yaml | 54 - .../templates/otel-collector-service.yaml | 22 - .../templates/prometheus-clusterrole.yaml | 49 - .../capif/templates/prometheus-configmap.yaml | 141 - .../templates/prometheus-deployment.yaml | 68 - .../templates/prometheus-ingress-route.yaml | 20 - helm/capif/templates/prometheus-ingress.yaml | 36 - helm/capif/templates/prometheus-pvc.yaml | 20 - helm/capif/templates/prometheus-service.yaml | 22 - helm/capif/templates/renderer-configmap.yaml | 8 - helm/capif/templates/renderer-deployment.yaml | 44 - helm/capif/templates/renderer-service.yaml | 18 - helm/capif/values.yaml | 202 +- 110 files changed, 5391 insertions(+), 1024 deletions(-) create mode 100644 helm/capif/charts/fluentbit/.helmignore create mode 100644 helm/capif/charts/fluentbit/Chart.yaml create mode 100644 helm/capif/charts/fluentbit/templates/NOTES.txt create mode 100644 helm/capif/charts/fluentbit/templates/_helpers.tpl rename helm/capif/{templates/fluentbit-configmap.yaml => charts/fluentbit/templates/configmap.yaml} (79%) create mode 100644 helm/capif/charts/fluentbit/templates/deployment.yaml create mode 100644 helm/capif/charts/fluentbit/templates/hpa.yaml create mode 100644 helm/capif/charts/fluentbit/templates/ingress.yaml create mode 100644 helm/capif/charts/fluentbit/templates/service.yaml create mode 100644 helm/capif/charts/fluentbit/templates/serviceaccount.yaml create mode 100644 helm/capif/charts/fluentbit/values.yaml create mode 100644 helm/capif/charts/grafana/.helmignore create mode 100644 helm/capif/charts/grafana/Chart.yaml create mode 100644 helm/capif/charts/grafana/README.md create mode 100644 helm/capif/charts/grafana/kubernetes-dashboard.json create mode 100644 helm/capif/charts/grafana/loki-logs.json create mode 100644 helm/capif/charts/grafana/templates/NOTES.txt create mode 100644 helm/capif/charts/grafana/templates/_helpers.tpl rename helm/capif/{templates/grafana-configmap.yaml => charts/grafana/templates/configmap.yaml} (83%) rename helm/capif/{templates/grafana-deployment.yaml => charts/grafana/templates/deployment.yaml} (55%) create mode 100644 helm/capif/charts/grafana/templates/hpa.yaml create mode 100644 helm/capif/charts/grafana/templates/ingress.yaml create mode 100644 helm/capif/charts/grafana/templates/pvc.yaml create mode 100644 helm/capif/charts/grafana/templates/secrets.yaml create mode 100644 helm/capif/charts/grafana/templates/service.yaml create mode 100644 helm/capif/charts/grafana/templates/serviceaccount.yaml create mode 100644 helm/capif/charts/grafana/templates/tests/test-connection.yaml create mode 100644 helm/capif/charts/grafana/values.yaml create mode 100644 helm/capif/charts/loki/.helmignore create mode 100644 helm/capif/charts/loki/Chart.yaml create mode 100644 helm/capif/charts/loki/templates/NOTES.txt create mode 100644 helm/capif/charts/loki/templates/_helpers.tpl create mode 100644 helm/capif/charts/loki/templates/deployment.yaml create mode 100644 helm/capif/charts/loki/templates/hpa.yaml create mode 100644 helm/capif/charts/loki/templates/ingress.yaml create mode 100644 helm/capif/charts/loki/templates/pvc.yaml create mode 100644 helm/capif/charts/loki/templates/service.yaml create mode 100644 helm/capif/charts/loki/templates/serviceaccount.yaml create mode 100644 helm/capif/charts/loki/templates/tests/test-connection.yaml create mode 100644 helm/capif/charts/loki/values.yaml create mode 100644 helm/capif/charts/otelcollector/.helmignore create mode 100644 helm/capif/charts/otelcollector/Chart.yaml create mode 100644 helm/capif/charts/otelcollector/templates/NOTES.txt create mode 100644 helm/capif/charts/otelcollector/templates/_helpers.tpl rename helm/capif/{templates/otel-collector-configmap.yaml => charts/otelcollector/templates/configmap.yaml} (81%) create mode 100644 helm/capif/charts/otelcollector/templates/deployment.yaml create mode 100644 helm/capif/charts/otelcollector/templates/hpa.yaml create mode 100644 helm/capif/charts/otelcollector/templates/ingress.yaml create mode 100644 helm/capif/charts/otelcollector/templates/service.yaml create mode 100644 helm/capif/charts/otelcollector/templates/serviceaccount.yaml create mode 100644 helm/capif/charts/otelcollector/values.yaml create mode 100644 helm/capif/charts/renderer/.helmignore create mode 100644 helm/capif/charts/renderer/Chart.yaml create mode 100644 helm/capif/charts/renderer/templates/NOTES.txt create mode 100644 helm/capif/charts/renderer/templates/_helpers.tpl create mode 100644 helm/capif/charts/renderer/templates/configmap.yaml create mode 100644 helm/capif/charts/renderer/templates/deployment.yaml create mode 100644 helm/capif/charts/renderer/templates/hpa.yaml create mode 100644 helm/capif/charts/renderer/templates/ingress.yaml create mode 100644 helm/capif/charts/renderer/templates/service.yaml create mode 100644 helm/capif/charts/renderer/templates/serviceaccount.yaml create mode 100644 helm/capif/charts/renderer/templates/tests/test-connection.yaml create mode 100644 helm/capif/charts/renderer/values.yaml delete mode 100644 helm/capif/templates/deployment.yaml delete mode 100644 helm/capif/templates/fluent-bit-service.yaml delete mode 100644 helm/capif/templates/fluentbit-deployment.yaml delete mode 100644 helm/capif/templates/grafana-ingress-route.yaml delete mode 100644 helm/capif/templates/grafana-ingress.yaml delete mode 100644 helm/capif/templates/grafana-pvc.yaml delete mode 100644 helm/capif/templates/grafana-secrets.yaml delete mode 100644 helm/capif/templates/grafana-service.yaml delete mode 100644 helm/capif/templates/loki-deployment.yaml delete mode 100644 helm/capif/templates/loki-pvc.yaml delete mode 100644 helm/capif/templates/loki-service.yaml delete mode 100644 helm/capif/templates/otel-collector-deployment.yaml delete mode 100644 helm/capif/templates/otel-collector-service.yaml delete mode 100644 helm/capif/templates/prometheus-clusterrole.yaml delete mode 100644 helm/capif/templates/prometheus-configmap.yaml delete mode 100644 helm/capif/templates/prometheus-deployment.yaml delete mode 100644 helm/capif/templates/prometheus-ingress-route.yaml delete mode 100644 helm/capif/templates/prometheus-ingress.yaml delete mode 100644 helm/capif/templates/prometheus-pvc.yaml delete mode 100644 helm/capif/templates/prometheus-service.yaml delete mode 100644 helm/capif/templates/renderer-configmap.yaml delete mode 100644 helm/capif/templates/renderer-deployment.yaml delete mode 100644 helm/capif/templates/renderer-service.yaml diff --git a/.gitignore b/.gitignore index ec4110f..c27c6be 100644 --- a/.gitignore +++ b/.gitignore @@ -36,8 +36,4 @@ docs/testing_with_postman/package-lock.json results helm/capif/*.lock -<<<<<<< HEAD -helm/capif/charts -======= helm/capif/charts/tempo* ->>>>>>> staging diff --git a/helm/capif/Chart.yaml b/helm/capif/Chart.yaml index 3cdcb3e..1c49c2c 100644 --- a/helm/capif/Chart.yaml +++ b/helm/capif/Chart.yaml @@ -58,6 +58,16 @@ dependencies: version: "*" - name: redis version: "*" + - name: fluentbit + version: "*" + - name: grafana + version: "*" + - name: loki + version: "*" + - name: otelcollector + version: "*" + - name: renderer + version: "*" - name: "tempo" condition: tempo.enabled repository: "https://grafana.github.io/helm-charts" diff --git a/helm/capif/charts/fluentbit/.helmignore b/helm/capif/charts/fluentbit/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/capif/charts/fluentbit/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/capif/charts/fluentbit/Chart.yaml b/helm/capif/charts/fluentbit/Chart.yaml new file mode 100644 index 0000000..b10c00b --- /dev/null +++ b/helm/capif/charts/fluentbit/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: fluentbit +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/capif/charts/fluentbit/templates/NOTES.txt b/helm/capif/charts/fluentbit/templates/NOTES.txt new file mode 100644 index 0000000..8e6d43e --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fluentbit.fullname" . }}) + 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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "fluentbit.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fluentbit.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fluentbit.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm/capif/charts/fluentbit/templates/_helpers.tpl b/helm/capif/charts/fluentbit/templates/_helpers.tpl new file mode 100644 index 0000000..a880f20 --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "fluentbit.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 "fluentbit.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 "fluentbit.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "fluentbit.labels" -}} +helm.sh/chart: {{ include "fluentbit.chart" . }} +{{ include "fluentbit.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "fluentbit.selectorLabels" -}} +app.kubernetes.io/name: {{ include "fluentbit.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "fluentbit.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "fluentbit.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/capif/templates/fluentbit-configmap.yaml b/helm/capif/charts/fluentbit/templates/configmap.yaml similarity index 79% rename from helm/capif/templates/fluentbit-configmap.yaml rename to helm/capif/charts/fluentbit/templates/configmap.yaml index 20467b1..2561e38 100644 --- a/helm/capif/templates/fluentbit-configmap.yaml +++ b/helm/capif/charts/fluentbit/templates/configmap.yaml @@ -1,10 +1,10 @@ -{{- if eq .Values.monitoring.enable "true" }} +{{- if .Values.enabled | default false }} apiVersion: v1 kind: ConfigMap metadata: name: fluent-bit-configmap data: - LOKI_URL: {{ quote .Values.monitoring.fluentBit.env.lokiUrl }} + LOKI_URL: {{ quote .Values.env.lokiUrl }} fluent-bit.conf: | [INPUT] Name forward diff --git a/helm/capif/charts/fluentbit/templates/deployment.yaml b/helm/capif/charts/fluentbit/templates/deployment.yaml new file mode 100644 index 0000000..ce6125c --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/deployment.yaml @@ -0,0 +1,79 @@ +{{- if .Values.enabled | default false }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "fluentbit.fullname" . }} + labels: + {{- include "fluentbit.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "fluentbit.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + labels: + {{- include "fluentbit.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "fluentbit.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: fluent-bit-udp + containerPort: {{ .Values.service.port }} + protocol: UDP + - name: fluent-bit-tcp + containerPort: {{ .Values.service.port }} + protocol: TCP + env: + - name: LOKI_URL + valueFrom: + configMapKeyRef: + name: fluent-bit-configmap + key: LOKI_URL + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/fluentbit/templates/hpa.yaml b/helm/capif/charts/fluentbit/templates/hpa.yaml new file mode 100644 index 0000000..9a6dd95 --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/hpa.yaml @@ -0,0 +1,34 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "fluentbit.fullname" . }} + labels: + {{- include "fluentbit.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "fluentbit.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/fluentbit/templates/ingress.yaml b/helm/capif/charts/fluentbit/templates/ingress.yaml new file mode 100644 index 0000000..601131c --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "fluentbit.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "fluentbit.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/fluentbit/templates/service.yaml b/helm/capif/charts/fluentbit/templates/service.yaml new file mode 100644 index 0000000..dd9be52 --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Service +metadata: + name: fluent-bit + labels: + {{- include "fluentbit.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: UDP + name: fluent-bit-udp + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: fluent-bit-tcp + selector: + {{- include "fluentbit.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/helm/capif/charts/fluentbit/templates/serviceaccount.yaml b/helm/capif/charts/fluentbit/templates/serviceaccount.yaml new file mode 100644 index 0000000..fbdb575 --- /dev/null +++ b/helm/capif/charts/fluentbit/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "fluentbit.serviceAccountName" . }} + labels: + {{- include "fluentbit.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/fluentbit/values.yaml b/helm/capif/charts/fluentbit/values.yaml new file mode 100644 index 0000000..49aa7e7 --- /dev/null +++ b/helm/capif/charts/fluentbit/values.yaml @@ -0,0 +1,116 @@ +# Default values for fluentbit. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +enabled: false + +replicaCount: 1 + +image: + repository: grafana/fluent-bit-plugin-loki + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +env: + lokiUrl: http://loki:3100/loki/api/v1/push + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 24224 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + tcpSocket: + port: 24224 + initialDelaySeconds: 20 + periodSeconds: 5 +readinessProbe: + tcpSocket: + port: 24224 + initialDelaySeconds: 20 + periodSeconds: 5 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: + - name: fluent-bit-conf + configMap: + name: fluent-bit-configmap + items: + - key: fluent-bit.conf + path: fluent-bit.conf + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: + - name: fluent-bit-conf + mountPath: /fluent-bit/etc/fluent-bit.conf + subPath: fluent-bit.conf + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm/capif/charts/grafana/.helmignore b/helm/capif/charts/grafana/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/capif/charts/grafana/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/capif/charts/grafana/Chart.yaml b/helm/capif/charts/grafana/Chart.yaml new file mode 100644 index 0000000..2c7c54e --- /dev/null +++ b/helm/capif/charts/grafana/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: grafana +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/capif/charts/grafana/README.md b/helm/capif/charts/grafana/README.md new file mode 100644 index 0000000..5325ad0 --- /dev/null +++ b/helm/capif/charts/grafana/README.md @@ -0,0 +1,51 @@ +# grafana + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) + +A Helm chart for Kubernetes + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| env.gfAuthAnonymousEnable | bool | `true` | | +| env.gfAuthAnonymousOrgRole | string | `"Admin"` | | +| env.gfSecurityAdminPassword | string | `"secure_pass"` | | +| env.gfSecurityAllowEmbedding | bool | `true` | | +| env.prometheusUrl | string | `"http://prometheus.prometheus-system.svc.cluster.local:9090"` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"Always"` | | +| image.repository | string | `"grafana/grafana"` | | +| image.tag | string | `"latest"` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `"nginx"` | | +| ingress.enabled | bool | `true` | | +| ingress.environment | string | `"edge"` | | +| ingress.hosts[0].host | string | `"grafana-dt.tactile5g.int"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| persistence.enable | bool | `false` | | +| persistence.storage | string | `"10Gi"` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"NodePort"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/helm/capif/charts/grafana/kubernetes-dashboard.json b/helm/capif/charts/grafana/kubernetes-dashboard.json new file mode 100644 index 0000000..ac97f80 --- /dev/null +++ b/helm/capif/charts/grafana/kubernetes-dashboard.json @@ -0,0 +1,2629 @@ +{ + "annotations": { + "list": [ + { + "$$hashKey": "object:103", + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Monitors Kubernetes cluster using Prometheus. Shows overall cluster CPU / Memory / Filesystem usage as well as individual pod, containers, systemd services statistics. Uses cAdvisor metrics only.", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 12740, + "graphTooltip": 0, + "id": 7, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 33, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Network I/O pressure", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 1 + }, + "height": "200px", + "hiddenSeries": false, + "id": 32, + "legend": { + "alignAsTable": false, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": false, + "show": false, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_network_receive_bytes_total{kubernetes_io_hostname=~\"^$Node$\"}[1m]))", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "Received", + "metric": "network", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{kubernetes_io_hostname=~\"^$Node$\"}[1m]))", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "Sent", + "metric": "network", + "refId": "B", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Network I/O pressure", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "logBase": 1, + "show": true + }, + { + "format": "Bps", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 34, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Total usage", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 65 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 0, + "y": 8 + }, + "id": 4, + "links": [], + "maxDataPoints": 100, + "options": { + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{id=\"/\",kubernetes_io_hostname=~\"^$Node$\"}) / sum (machine_memory_bytes{kubernetes_io_hostname=~\"^$Node$\"}) * 100", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Cluster memory usage", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 65 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 8, + "y": 8 + }, + "id": 6, + "links": [], + "maxDataPoints": 100, + "options": { + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{id=\"/\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) / sum (machine_cpu_cores{kubernetes_io_hostname=~\"^$Node$\"}) * 100", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Cluster CPU usage (1m avg)", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 65 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 8, + "x": 16, + "y": 8 + }, + "id": 7, + "links": [], + "maxDataPoints": 100, + "options": { + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_fs_usage_bytes{device=~\"^/dev/[sv]d[a-z][1-9]$\",id=\"/\",kubernetes_io_hostname=~\"^$Node$\"}) / sum (container_fs_limit_bytes{device=~\"^/dev/[sv]d[a-z][1-9]$\",id=\"/\",kubernetes_io_hostname=~\"^$Node$\"}) * 100", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 10 + } + ], + "title": "Cluster filesystem usage", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 0, + "y": 13 + }, + "id": 9, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{id=\"/\",kubernetes_io_hostname=~\"^$Node$\"})", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Used", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 4, + "y": 13 + }, + "id": 10, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (machine_memory_bytes{kubernetes_io_hostname=~\"^$Node$\"})", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Total", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 8, + "y": 13 + }, + "id": 11, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{id=\"/\",kubernetes_io_hostname=~\"^$Node$\"}[1m]))", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Used", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 12, + "y": 13 + }, + "id": 12, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (machine_cpu_cores{kubernetes_io_hostname=~\"^$Node$\"})", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Total", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 16, + "y": 13 + }, + "id": 13, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_fs_usage_bytes{device=~\"^/dev/[sv]d[a-z][1-9]$\",id=\"/\",kubernetes_io_hostname=~\"^$Node$\"})", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Used", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 20, + "y": 13 + }, + "id": 14, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_fs_limit_bytes{device=~\"^/dev/[sv]d[a-z][1-9]$\",id=\"/\",kubernetes_io_hostname=~\"^$Node$\"})", + "interval": "10s", + "intervalFactor": 1, + "refId": "A", + "step": 10 + } + ], + "title": "Total", + "type": "stat" + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 35, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Pods CPU usage", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 3, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 17 + }, + "height": "", + "hiddenSeries": false, + "id": 17, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "editorMode": "code", + "expr": "sum (rate (container_cpu_usage_seconds_total{image!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (pod)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ pod }}", + "metric": "container_cpu", + "range": true, + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Pods CPU usage (1m avg)", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:112", + "format": "none", + "label": "cores", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:113", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 24 + }, + "id": 39, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Pods memory usage", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 25 + }, + "hiddenSeries": false, + "id": 25, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "editorMode": "code", + "expr": "sum (container_memory_working_set_bytes{image!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}) by (pod)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ pod }}", + "metric": "container_memory_usage:sort_desc", + "range": true, + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Pods memory usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:181", + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:182", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 32 + }, + "id": 43, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Pods network I/O", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 33 + }, + "hiddenSeries": false, + "id": 16, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "editorMode": "code", + "expr": "sum (rate (container_network_receive_bytes_total{image!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (pod)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "-> {{ pod }}", + "metric": "network", + "range": true, + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{image!=\"\",name=~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (pod)", + "hide": true, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "<- {{ pod }}", + "metric": "network", + "refId": "B", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Pods network I/O (1m avg)", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 40 + }, + "id": 37, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 3, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 41 + }, + "height": "", + "hiddenSeries": false, + "id": 24, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "hideEmpty": false, + "hideZero": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{image!=\"\",name=~\"^k8s_.*\",container!=\"POD\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (container, pod)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "pod: {{ pod }}| {{ container }}", + "metric": "container_cpu", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{image!=\"\",name!~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, name, image)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "docker: {{ kubernetes_io_hostname }} | {{ image }} ({{ name }})", + "metric": "container_cpu", + "refId": "B", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{rkt_container_name!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, rkt_container_name)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "rkt: {{ kubernetes_io_hostname }} | {{ rkt_container_name }}", + "metric": "container_cpu", + "refId": "C", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Containers CPU usage (1m avg)", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:337", + "format": "none", + "label": "cores", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:338", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Containers CPU usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 41 + }, + "id": 41, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 42 + }, + "hiddenSeries": false, + "id": 27, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{image!=\"\",name=~\"^k8s_.*\",container!=\"POD\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}) by (container, pod)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "pod: {{ pod }} | {{ container }}", + "metric": "container_memory_usage:sort_desc", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{image!=\"\",name!~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}) by (kubernetes_io_hostname, name, image)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "docker: {{ kubernetes_io_hostname }} | {{ image }} ({{ name }})", + "metric": "container_memory_usage:sort_desc", + "refId": "B", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{rkt_container_name!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}) by (kubernetes_io_hostname, rkt_container_name)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "rkt: {{ kubernetes_io_hostname }} | {{ rkt_container_name }}", + "metric": "container_memory_usage:sort_desc", + "refId": "C", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Containers memory usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:406", + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:407", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Containers memory usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 42 + }, + "id": 44, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 43 + }, + "hiddenSeries": false, + "id": 30, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_network_receive_bytes_total{image!=\"\",name=~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (container, pod)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "-> pod: {{ pod }} | {{ container }}", + "metric": "network", + "refId": "B", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{image!=\"\",name=~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (container, pod)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "<- pod: {{ pod }} | {{ container }}", + "metric": "network", + "refId": "D", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_network_receive_bytes_total{image!=\"\",name!~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, name, image)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "-> docker: {{ kubernetes_io_hostname }} | {{ image }} ({{ name }})", + "metric": "network", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{image!=\"\",name!~\"^k8s_.*\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, name, image)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "<- docker: {{ kubernetes_io_hostname }} | {{ image }} ({{ name }})", + "metric": "network", + "refId": "C", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_network_transmit_bytes_total{rkt_container_name!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, rkt_container_name)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "-> rkt: {{ kubernetes_io_hostname }} | {{ rkt_container_name }}", + "metric": "network", + "refId": "E", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{rkt_container_name!=\"\",kubernetes_io_hostname=~\"^$Node$\",namespace=~\"^$namespace$\"}[1m])) by (kubernetes_io_hostname, rkt_container_name)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "<- rkt: {{ kubernetes_io_hostname }} | {{ rkt_container_name }}", + "metric": "network", + "refId": "F", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Containers network I/O (1m avg)", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "Containers network I/O", + "type": "row" + }, + { + "collapsed": false, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 36, + "panels": [], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "System services CPU usage", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 3, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 44 + }, + "height": "", + "hiddenSeries": false, + "id": 23, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": true, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "editorMode": "code", + "expr": "sum (rate (container_cpu_usage_seconds_total{systemd_service_name!=\"\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) by (systemd_service_name)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ systemd_service_name }}", + "metric": "container_cpu", + "range": true, + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "System services CPU usage (1m avg)", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": "cores", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 51 + }, + "id": 40, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 29 + }, + "hiddenSeries": false, + "id": 26, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": true, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{systemd_service_name!=\"\",kubernetes_io_hostname=~\"^$Node$\"}) by (systemd_service_name)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ systemd_service_name }}", + "metric": "container_memory_usage:sort_desc", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "System services memory usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "System services memory usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 38, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 3, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 46 + }, + "hiddenSeries": false, + "id": 20, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.0.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_cpu_usage_seconds_total{id!=\"/\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) by (id)", + "hide": false, + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ id }}", + "metric": "container_cpu", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "All processes CPU usage (1m avg)", + "tooltip": { + "msResolution": true, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:254", + "format": "none", + "label": "cores", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:255", + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "All processes CPU usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 53 + }, + "id": 42, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 47 + }, + "hiddenSeries": false, + "id": 28, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": true, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (container_memory_working_set_bytes{id!=\"/\",kubernetes_io_hostname=~\"^$Node$\"}) by (id)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "{{ id }}", + "metric": "container_memory_usage:sort_desc", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "All processes memory usage", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "All processes memory usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 54 + }, + "id": 45, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "decimals": 2, + "editable": true, + "error": false, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 48 + }, + "hiddenSeries": false, + "id": 29, + "isNew": true, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": false, + "show": true, + "sideWidth": 200, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "sum (rate (container_network_receive_bytes_total{id!=\"/\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) by (id)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "-> {{ id }}", + "metric": "network", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "expr": "- sum (rate (container_network_transmit_bytes_total{id!=\"/\",kubernetes_io_hostname=~\"^$Node$\"}[1m])) by (id)", + "interval": "10s", + "intervalFactor": 1, + "legendFormat": "<- {{ id }}", + "metric": "network", + "refId": "B", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "All processes network I/O (1m avg)", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 2, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "refId": "A" + } + ], + "title": "All processes network I/O", + "type": "row" + } + ], + "refresh": "10s", + "schemaVersion": 38, + "style": "dark", + "tags": [ + "kubernetes" + ], + "templating": { + "list": [ + { + "allValue": "", + "current": { + "selected": true, + "text": "monitoring", + "value": "monitoring" + }, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "definition": "label_values(namespace)", + "hide": 0, + "includeAll": true, + "multi": false, + "name": "namespace", + "options": [], + "query": "label_values(namespace)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "af6b44aa-0703-4979-825c-c1afba946534" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "multi": false, + "name": "Node", + "options": [], + "query": "label_values(kubernetes_io_hostname)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Kubernetes Monitoring Dashboard", + "uid": "msqzbWjWk", + "version": 2, + "weekStart": "" + } \ No newline at end of file diff --git a/helm/capif/charts/grafana/loki-logs.json b/helm/capif/charts/grafana/loki-logs.json new file mode 100644 index 0000000..e7e4d72 --- /dev/null +++ b/helm/capif/charts/grafana/loki-logs.json @@ -0,0 +1,281 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Simple Loki dashboard", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 13198, + "graphTooltip": 0, + "id": 9, + "links": [], + "liveNow": false, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "fill": 0, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "hideEmpty": true, + "hideZero": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.5.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "datasource": { + "uid": "$datasource" + }, + "editorMode": "code", + "expr": "count_over_time({job=\"fluent-bit\"}[1m])", + "legendFormat": "{{ container_name }}", + "queryType": "range", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Metric Rate", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "datasource": { + "type": "loki", + "uid": "e4f43364-7019-45a7-aa7a-14ce2d4ddb0b" + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 2, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "pluginVersion": "7.1.3", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "e4f43364-7019-45a7-aa7a-14ce2d4ddb0b" + }, + "editorMode": "code", + "expr": "{job=~\"fluent-bit\"} |~ \"$string\"", + "legendFormat": "", + "queryType": "range", + "refId": "A" + } + ], + "title": "Loki Search", + "type": "logs" + } + ], + "refresh": "1m", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Loki", + "value": "Loki" + }, + "hide": 0, + "includeAll": false, + "multi": false, + "name": "datasource", + "options": [], + "query": "loki", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "definition": "label_values(container_name)", + "hide": 0, + "includeAll": true, + "label": "app", + "multi": false, + "name": "app", + "options": [], + "query": "label_values(container_name)", + "refresh": 2, + "regex": "(.*)-.*-.*-.*-.*-.*", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "$datasource" + }, + "definition": "label_values(container_name)", + "hide": 0, + "includeAll": true, + "label": "job", + "multi": false, + "name": "job", + "options": [], + "query": "label_values(container_name)", + "refresh": 2, + "regex": "$app-(.*)", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "hide": 0, + "label": "string", + "name": "string", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Loki Logs", + "uid": "ffxEJdvGz", + "version": 6, + "weekStart": "" +} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/NOTES.txt b/helm/capif/charts/grafana/templates/NOTES.txt new file mode 100644 index 0000000..c7ac87e --- /dev/null +++ b/helm/capif/charts/grafana/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "grafana.fullname" . }}) + 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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "grafana.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "grafana.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "grafana.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm/capif/charts/grafana/templates/_helpers.tpl b/helm/capif/charts/grafana/templates/_helpers.tpl new file mode 100644 index 0000000..993f46b --- /dev/null +++ b/helm/capif/charts/grafana/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "grafana.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 "grafana.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 "grafana.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "grafana.labels" -}} +helm.sh/chart: {{ include "grafana.chart" . }} +{{ include "grafana.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "grafana.selectorLabels" -}} +app.kubernetes.io/name: {{ include "grafana.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "grafana.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "grafana.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/capif/templates/grafana-configmap.yaml b/helm/capif/charts/grafana/templates/configmap.yaml similarity index 83% rename from helm/capif/templates/grafana-configmap.yaml rename to helm/capif/charts/grafana/templates/configmap.yaml index 654101f..dc70d23 100644 --- a/helm/capif/templates/grafana-configmap.yaml +++ b/helm/capif/charts/grafana/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{- if eq .Values.monitoring.enable "true" }} +{{- if .Values.enabled | default false }} apiVersion: v1 kind: ConfigMap metadata: @@ -7,13 +7,29 @@ data: datasources.yaml: | apiVersion: 1 datasources: + - name: Prometheus + type: prometheus + typeName: Prometheus + typeLogoUrl: public/app/plugins/datasource/prometheus/img/prometheus_logo.svg + access: proxy + url: {{ .Values.env.prometheusUrl }} + uid: af6b44aa-0703-4979-825c-c1afba946534 + user: '' + database: '' + basicAuth: false + isDefault: false + jsonData: + httpMethod: POST + prometheusType: Prometheus + prometheusVersion: 2.40.1 + readOnly: false - name: Loki type: loki uid: e4f43364-7019-45a7-aa7a-14ce2d4ddb0b typeName: Loki typeLogoUrl: public/app/plugins/datasource/loki/img/loki_icon.svg access: proxy - url: {{ .Values.monitoring.grafana.env.lokiUrl }} + url: {{ .Values.env.lokiUrl }} user: '' database: '' basicAuth: false @@ -24,30 +40,14 @@ data: matcherRegex: '"traceID":\s*"([a-fA-F0-9]+)"' name: traceID url: "$${__value.raw}" - readOnly: false - - name: Prometheus - type: prometheus - typeName: Prometheus - typeLogoUrl: public/app/plugins/datasource/prometheus/img/prometheus_logo.svg - access: proxy - url: {{ .Values.monitoring.grafana.env.prometheusUrl }} - uid: af6b44aa-0703-4979-825c-c1afba946534 - user: '' - database: '' - basicAuth: false - isDefault: false - jsonData: - httpMethod: POST - prometheusType: Prometheus - prometheusVersion: 2.40.1 - readOnly: false + readOnly: false - name: Tempo type: tempo typeName: Tempo typeLogoUrl: public/app/plugins/datasource/tempo/img/tempo_logo.svg uid: fee7e008-f836-424a-b701-88cad583c715 access: proxy - url: {{ .Values.monitoring.grafana.env.tempoUrl }} + url: {{ .Values.env.tempoUrl }} user: '' database: '' basicAuth: false @@ -78,16 +78,6 @@ data: --- -apiVersion: v1 -kind: ConfigMap -metadata: - name: docker-monitoring -data: - Docker-monitoring.json: |- -{{ .Files.Get "docker-monitoring.json" | indent 4 }} - ---- - apiVersion: v1 kind: ConfigMap metadata: @@ -105,4 +95,4 @@ metadata: data: loki-logs.json: | {{ .Files.Get "loki-logs.json" | indent 4 }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/grafana-deployment.yaml b/helm/capif/charts/grafana/templates/deployment.yaml similarity index 55% rename from helm/capif/templates/grafana-deployment.yaml rename to helm/capif/charts/grafana/templates/deployment.yaml index 844f32e..d74241f 100644 --- a/helm/capif/templates/grafana-deployment.yaml +++ b/helm/capif/charts/grafana/templates/deployment.yaml @@ -1,54 +1,56 @@ -{{- if eq .Values.monitoring.enable "true" }} +{{- if .Values.enabled | default false }} apiVersion: apps/v1 kind: Deployment metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) + name: {{ include "grafana.fullname" . }} labels: - io.kompose.service: grafana - {{- include "capif.labels" . | nindent 4 }} - name: grafana + {{- include "grafana.labels" . | nindent 4 }} spec: - replicas: 1 + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} strategy: type: Recreate + {{- end }} selector: matchLabels: - io.kompose.service: grafana - {{- include "capif.selectorLabels" . | nindent 6 }} - strategy: - type: Recreate + {{- include "grafana.selectorLabels" . | nindent 6 }} template: metadata: annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - checksum/config: {{ include (print $.Template.BasePath "/grafana-configmap.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} labels: - io.kompose.network/monitoring-default: "true" - io.kompose.service: grafana - {{- include "capif.selectorLabels" . | nindent 8 }} + {{- include "grafana.selectorLabels" . | nindent 8 }} spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "grafana.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - env: - name: GF_AUTH_ANONYMOUS_ENABLED - value: {{ quote .Values.monitoring.grafana.env.gfAuthAnonymousEnable }} + value: {{ quote .Values.env.gfAuthAnonymousEnable }} - name: GF_SECURITY_ALLOW_EMBEDDING - value: {{ quote .Values.monitoring.grafana.env.gfSecurityAllowEmbedding }} + value: {{ quote .Values.env.gfSecurityAllowEmbedding }} - name: GF_PATHS_PROVISIONING value: /etc/grafana/provisioning - image: {{ .Values.monitoring.grafana.image.repository }}:{{ .Values.monitoring.grafana.image.tag }} - name: grafana + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + name: {{ .Chart.Name }} envFrom: - secretRef: name: grafana-secrets ports: - - containerPort: 3000 + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP +# livenessProbe: +# tcpSocket: +# port: {{ .Values.service.port }} resources: - {{- toYaml .Values.monitoring.grafana.resources | nindent 12 }} - securityContext: - runAsUser: 0 + {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: grafana-datasources mountPath: /etc/grafana/provisioning/datasources/datasources.yaml @@ -56,16 +58,13 @@ spec: - name: grafana-default mountPath: /etc/grafana/provisioning/dashboards/default.yaml subPath: default.yaml - - name: grafana-docker - mountPath: /var/lib/grafana/dashboards/Docker-monitoring.json - subPath: Docker-monitoring.json - name: kubernetes-dashboard mountPath: /var/lib/grafana/dashboards/kubernetes-dashboard.json subPath: kubernetes-dashboard.json - name: grafana-loki mountPath: /var/lib/grafana/dashboards/Loki-Logs.json subPath: loki-logs.json - {{- if eq .Values.monitoring.grafana.persistence.enable "true" }} + {{- if .Values.persistence.enable | default false }} - name: grafana-claim0 mountPath: /var/lib/grafana {{- end }} @@ -82,12 +81,6 @@ spec: items: - key: "default.yaml" path: "default.yaml" - - name: grafana-docker - configMap: - name: docker-monitoring - items: - - key: "Docker-monitoring.json" - path: "Docker-monitoring.json" - name: kubernetes-dashboard configMap: name: kubernetes-dashboard @@ -100,10 +93,21 @@ spec: items: - key: "loki-logs.json" path: "loki-logs.json" - {{- if eq .Values.monitoring.grafana.persistence.enable "true" }} + {{- if .Values.persistence.enable | default false }} - name: grafana-claim0 persistentVolumeClaim: claimName: grafana-claim0 - {{- end }} - restartPolicy: Always + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/hpa.yaml b/helm/capif/charts/grafana/templates/hpa.yaml new file mode 100644 index 0000000..f8efd87 --- /dev/null +++ b/helm/capif/charts/grafana/templates/hpa.yaml @@ -0,0 +1,30 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "grafana.fullname" . }} + labels: + {{- include "grafana.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "grafana.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/grafana/templates/ingress.yaml b/helm/capif/charts/grafana/templates/ingress.yaml new file mode 100644 index 0000000..dfe5c9a --- /dev/null +++ b/helm/capif/charts/grafana/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "grafana.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "grafana.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: grafana + port: + number: {{ $svcPort }} + {{- else }} + serviceName: grafana + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/helm/capif/charts/grafana/templates/pvc.yaml b/helm/capif/charts/grafana/templates/pvc.yaml new file mode 100644 index 0000000..7aa2b72 --- /dev/null +++ b/helm/capif/charts/grafana/templates/pvc.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.persistence.enable | default false }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: grafana-claim0 + name: grafana-claim0 +spec: + storageClassName: {{ .Values.persistence.storageClass }} + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.persistence.storage }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/secrets.yaml b/helm/capif/charts/grafana/templates/secrets.yaml new file mode 100644 index 0000000..0313f54 --- /dev/null +++ b/helm/capif/charts/grafana/templates/secrets.yaml @@ -0,0 +1,10 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Secret +metadata: + name: grafana-secrets +type: Opaque +data: + GF_AUTH_ANONYMOUS_ORG_ROLE: {{ .Values.env.gfAuthAnonymousOrgRole | b64enc | quote }} + GF_SECURITY_ADMIN_PASSWORD: {{ .Values.env.gfSecurityAdminPassword | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/service.yaml b/helm/capif/charts/grafana/templates/service.yaml new file mode 100644 index 0000000..b13c5fc --- /dev/null +++ b/helm/capif/charts/grafana/templates/service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Service +metadata: + name: grafana + labels: + {{- include "grafana.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: http + selector: + {{- include "grafana.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/serviceaccount.yaml b/helm/capif/charts/grafana/templates/serviceaccount.yaml new file mode 100644 index 0000000..049f60f --- /dev/null +++ b/helm/capif/charts/grafana/templates/serviceaccount.yaml @@ -0,0 +1,14 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "grafana.serviceAccountName" . }} + labels: + {{- include "grafana.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/grafana/templates/tests/test-connection.yaml b/helm/capif/charts/grafana/templates/tests/test-connection.yaml new file mode 100644 index 0000000..27d46d2 --- /dev/null +++ b/helm/capif/charts/grafana/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "grafana.fullname" . }}-test-connection" + labels: + {{- include "grafana.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['grafana:{{ .Values.service.port }}'] + restartPolicy: Never +{{- end }} diff --git a/helm/capif/charts/grafana/values.yaml b/helm/capif/charts/grafana/values.yaml new file mode 100644 index 0000000..8391800 --- /dev/null +++ b/helm/capif/charts/grafana/values.yaml @@ -0,0 +1,99 @@ +# Default values for grafana. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +enabled: false + +replicaCount: 1 + +image: + repository: grafana/grafana + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# PENDING: gfAuthAnonymousOrgRole and gfSecurityAdminPassword as aws external-secret +env: + gfAuthAnonymousEnable: true + gfSecurityAllowEmbedding: true + gfAuthAnonymousOrgRole: Admin + gfSecurityAdminPassword: secure_pass + prometheusUrl: http://prometheus.prometheus-system.svc.cluster.local:9090 + lokiUrl: http://loki:3100 + tempoUrl: http://tempo:3100 + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +persistence: + enable: true + storage: 10Gi + storageClass: nfs-01 + +service: + type: ClusterIP + port: 3000 + +ingress: + enabled: true + className: "nginx" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: grafana-dt.tactile5g.int + paths: + - path: / + pathType: Prefix + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm/capif/charts/loki/.helmignore b/helm/capif/charts/loki/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/capif/charts/loki/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/capif/charts/loki/Chart.yaml b/helm/capif/charts/loki/Chart.yaml new file mode 100644 index 0000000..1125160 --- /dev/null +++ b/helm/capif/charts/loki/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: loki +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/capif/charts/loki/templates/NOTES.txt b/helm/capif/charts/loki/templates/NOTES.txt new file mode 100644 index 0000000..b448c2f --- /dev/null +++ b/helm/capif/charts/loki/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "loki.fullname" . }}) + 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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "loki.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "loki.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "loki.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm/capif/charts/loki/templates/_helpers.tpl b/helm/capif/charts/loki/templates/_helpers.tpl new file mode 100644 index 0000000..fe4bc4e --- /dev/null +++ b/helm/capif/charts/loki/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "loki.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 "loki.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 "loki.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "loki.labels" -}} +helm.sh/chart: {{ include "loki.chart" . }} +{{ include "loki.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "loki.selectorLabels" -}} +app.kubernetes.io/name: {{ include "loki.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "loki.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "loki.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/loki/templates/deployment.yaml b/helm/capif/charts/loki/templates/deployment.yaml new file mode 100644 index 0000000..7cd543e --- /dev/null +++ b/helm/capif/charts/loki/templates/deployment.yaml @@ -0,0 +1,74 @@ +{{- if .Values.enabled | default false }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "loki.fullname" . }} + labels: + {{- include "loki.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "loki.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "loki.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "loki.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + args: + - -config.file=/etc/loki/local-config.yaml + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/loki/templates/hpa.yaml b/helm/capif/charts/loki/templates/hpa.yaml new file mode 100644 index 0000000..3ffe63f --- /dev/null +++ b/helm/capif/charts/loki/templates/hpa.yaml @@ -0,0 +1,34 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "loki.fullname" . }} + labels: + {{- include "loki.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "loki.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/loki/templates/ingress.yaml b/helm/capif/charts/loki/templates/ingress.yaml new file mode 100644 index 0000000..0ad6092 --- /dev/null +++ b/helm/capif/charts/loki/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "loki.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "loki.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: loki + port: + number: {{ $svcPort }} + {{- else }} + serviceName: loki + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/loki/templates/pvc.yaml b/helm/capif/charts/loki/templates/pvc.yaml new file mode 100644 index 0000000..c6594b2 --- /dev/null +++ b/helm/capif/charts/loki/templates/pvc.yaml @@ -0,0 +1,16 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.persistence.enable | default false }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + name: loki-claim0 +spec: + storageClassName: {{ .Values.persistence.storageClass }} + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.persistence.storage }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/loki/templates/service.yaml b/helm/capif/charts/loki/templates/service.yaml new file mode 100644 index 0000000..5eb8004 --- /dev/null +++ b/helm/capif/charts/loki/templates/service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Service +metadata: + name: loki + labels: + {{- include "loki.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "loki.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/helm/capif/charts/loki/templates/serviceaccount.yaml b/helm/capif/charts/loki/templates/serviceaccount.yaml new file mode 100644 index 0000000..491cd0e --- /dev/null +++ b/helm/capif/charts/loki/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "loki.serviceAccountName" . }} + labels: + {{- include "loki.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/loki/templates/tests/test-connection.yaml b/helm/capif/charts/loki/templates/tests/test-connection.yaml new file mode 100644 index 0000000..42bf046 --- /dev/null +++ b/helm/capif/charts/loki/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "loki.fullname" . }}-test-connection" + labels: + {{- include "loki.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['loki:{{ .Values.service.port }}'] + restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/loki/values.yaml b/helm/capif/charts/loki/values.yaml new file mode 100644 index 0000000..444311d --- /dev/null +++ b/helm/capif/charts/loki/values.yaml @@ -0,0 +1,115 @@ +# Default values for loki. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +enabled: false + +replicaCount: 1 + +image: + repository: grafana/loki + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "2.8.0" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + runAsUser: 0 + +persistence: + enable: true + storage: 100Mi + storageClass: nfs-01 + +service: + type: ClusterIP + port: 3100 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + tcpSocket: + port: 3100 + initialDelaySeconds: 20 + periodSeconds: 5 + +readinessProbe: + tcpSocket: + port: 3100 + initialDelaySeconds: 20 + periodSeconds: 5 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: + - name: loki-claim0 + persistentVolumeClaim: + claimName: loki-claim0 + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: + - name: loki-claim0 + mountPath: /loki/wal + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm/capif/charts/mock-server/templates/deployment.yaml b/helm/capif/charts/mock-server/templates/deployment.yaml index 270411b..89261d7 100644 --- a/helm/capif/charts/mock-server/templates/deployment.yaml +++ b/helm/capif/charts/mock-server/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: apps/v1 kind: Deployment metadata: @@ -66,3 +67,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/templates/hpa.yaml b/helm/capif/charts/mock-server/templates/hpa.yaml index fbdd9bc..d0ae761 100644 --- a/helm/capif/charts/mock-server/templates/hpa.yaml +++ b/helm/capif/charts/mock-server/templates/hpa.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler @@ -30,3 +31,4 @@ spec: averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/templates/ingress.yaml b/helm/capif/charts/mock-server/templates/ingress.yaml index 68406e7..96c13ae 100644 --- a/helm/capif/charts/mock-server/templates/ingress.yaml +++ b/helm/capif/charts/mock-server/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.ingress.enabled -}} {{- $fullName := include "mock-server.fullname" . -}} {{- $svcPort := .Values.service.port -}} @@ -59,3 +60,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/templates/service.yaml b/helm/capif/charts/mock-server/templates/service.yaml index f160730..e11c5cf 100644 --- a/helm/capif/charts/mock-server/templates/service.yaml +++ b/helm/capif/charts/mock-server/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Service metadata: @@ -13,3 +14,4 @@ spec: name: http selector: {{- include "mock-server.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/templates/serviceaccount.yaml b/helm/capif/charts/mock-server/templates/serviceaccount.yaml index 004803d..2538086 100644 --- a/helm/capif/charts/mock-server/templates/serviceaccount.yaml +++ b/helm/capif/charts/mock-server/templates/serviceaccount.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount @@ -11,3 +12,4 @@ metadata: {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automount }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/templates/tests/test-connection.yaml b/helm/capif/charts/mock-server/templates/tests/test-connection.yaml index 796d72b..7173753 100644 --- a/helm/capif/charts/mock-server/templates/tests/test-connection.yaml +++ b/helm/capif/charts/mock-server/templates/tests/test-connection.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Pod metadata: @@ -13,3 +14,4 @@ spec: command: ['wget'] args: ['mock-server:{{ .Values.service.port }}'] restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mock-server/values.yaml b/helm/capif/charts/mock-server/values.yaml index f005d9f..cd2dfc0 100644 --- a/helm/capif/charts/mock-server/values.yaml +++ b/helm/capif/charts/mock-server/values.yaml @@ -2,6 +2,8 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +enabled: false + replicaCount: 1 image: diff --git a/helm/capif/charts/mongo-express/templates/deployment.yaml b/helm/capif/charts/mongo-express/templates/deployment.yaml index 175a045..32bda44 100644 --- a/helm/capif/charts/mongo-express/templates/deployment.yaml +++ b/helm/capif/charts/mongo-express/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: apps/v1 kind: Deployment metadata: @@ -71,3 +72,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/templates/hpa.yaml b/helm/capif/charts/mongo-express/templates/hpa.yaml index 2b7ca92..d591daf 100644 --- a/helm/capif/charts/mongo-express/templates/hpa.yaml +++ b/helm/capif/charts/mongo-express/templates/hpa.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler @@ -30,3 +31,4 @@ spec: averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/templates/ingress.yaml b/helm/capif/charts/mongo-express/templates/ingress.yaml index 9a0f710..f4d860c 100644 --- a/helm/capif/charts/mongo-express/templates/ingress.yaml +++ b/helm/capif/charts/mongo-express/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.ingress.enabled -}} {{- $fullName := include "mongo-express.fullname" . -}} {{- $svcPort := .Values.service.port -}} @@ -49,13 +50,14 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $fullName }} + name: mongo-express port: number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} + serviceName: mongo-express servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/templates/service.yaml b/helm/capif/charts/mongo-express/templates/service.yaml index 888a03f..c72729e 100644 --- a/helm/capif/charts/mongo-express/templates/service.yaml +++ b/helm/capif/charts/mongo-express/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Service metadata: @@ -13,3 +14,4 @@ spec: name: http selector: {{- include "mongo-express.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/templates/serviceaccount.yaml b/helm/capif/charts/mongo-express/templates/serviceaccount.yaml index 4a6a666..4535ab9 100644 --- a/helm/capif/charts/mongo-express/templates/serviceaccount.yaml +++ b/helm/capif/charts/mongo-express/templates/serviceaccount.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount @@ -11,3 +12,4 @@ metadata: {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automount }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/templates/tests/test-connection.yaml b/helm/capif/charts/mongo-express/templates/tests/test-connection.yaml index 666e36f..fc31c20 100644 --- a/helm/capif/charts/mongo-express/templates/tests/test-connection.yaml +++ b/helm/capif/charts/mongo-express/templates/tests/test-connection.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Pod metadata: @@ -13,3 +14,4 @@ spec: command: ['wget'] args: ['mongo-express:{{ .Values.service.port }}'] restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-express/values.yaml b/helm/capif/charts/mongo-express/values.yaml index 447ec98..36f3a8b 100644 --- a/helm/capif/charts/mongo-express/values.yaml +++ b/helm/capif/charts/mongo-express/values.yaml @@ -2,6 +2,8 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +enabled: false + replicaCount: 1 image: @@ -50,7 +52,7 @@ service: ingress: enabled: false - className: "" + className: "nginx" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" diff --git a/helm/capif/charts/mongo-register-express/templates/deployment.yaml b/helm/capif/charts/mongo-register-express/templates/deployment.yaml index 3e86c2d..d77c8bc 100644 --- a/helm/capif/charts/mongo-register-express/templates/deployment.yaml +++ b/helm/capif/charts/mongo-register-express/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: apps/v1 kind: Deployment metadata: @@ -71,3 +72,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/templates/hpa.yaml b/helm/capif/charts/mongo-register-express/templates/hpa.yaml index 7f0a835..3804acd 100644 --- a/helm/capif/charts/mongo-register-express/templates/hpa.yaml +++ b/helm/capif/charts/mongo-register-express/templates/hpa.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler @@ -30,3 +31,4 @@ spec: averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/templates/ingress.yaml b/helm/capif/charts/mongo-register-express/templates/ingress.yaml index 02c99e5..be3d87f 100644 --- a/helm/capif/charts/mongo-register-express/templates/ingress.yaml +++ b/helm/capif/charts/mongo-register-express/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.ingress.enabled -}} {{- $fullName := include "mongo-register-express.fullname" . -}} {{- $svcPort := .Values.service.port -}} @@ -49,13 +50,14 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $fullName }} + name: mongo-register-express port: number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} + serviceName: mongo-register-express servicePort: {{ $svcPort }} {{- end }} {{- end }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/templates/service.yaml b/helm/capif/charts/mongo-register-express/templates/service.yaml index eed599c..7598b38 100644 --- a/helm/capif/charts/mongo-register-express/templates/service.yaml +++ b/helm/capif/charts/mongo-register-express/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Service metadata: @@ -13,3 +14,4 @@ spec: name: http selector: {{- include "mongo-register-express.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/templates/serviceaccount.yaml b/helm/capif/charts/mongo-register-express/templates/serviceaccount.yaml index 21c6862..ade812a 100644 --- a/helm/capif/charts/mongo-register-express/templates/serviceaccount.yaml +++ b/helm/capif/charts/mongo-register-express/templates/serviceaccount.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount @@ -11,3 +12,4 @@ metadata: {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automount }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/templates/tests/test-connection.yaml b/helm/capif/charts/mongo-register-express/templates/tests/test-connection.yaml index 240abe3..cdafc63 100644 --- a/helm/capif/charts/mongo-register-express/templates/tests/test-connection.yaml +++ b/helm/capif/charts/mongo-register-express/templates/tests/test-connection.yaml @@ -1,3 +1,4 @@ +{{- if .Values.enabled | default false }} apiVersion: v1 kind: Pod metadata: @@ -11,5 +12,6 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "mongo-register-express.fullname" . }}:{{ .Values.service.port }}'] + args: ['mongo-register-express:{{ .Values.service.port }}'] restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/mongo-register-express/values.yaml b/helm/capif/charts/mongo-register-express/values.yaml index d36bf6c..dd225f5 100644 --- a/helm/capif/charts/mongo-register-express/values.yaml +++ b/helm/capif/charts/mongo-register-express/values.yaml @@ -2,6 +2,8 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +enabled: false + replicaCount: 1 image: @@ -51,7 +53,7 @@ service: ingress: enabled: false - className: "" + className: "nginx" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" diff --git a/helm/capif/charts/otelcollector/.helmignore b/helm/capif/charts/otelcollector/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/capif/charts/otelcollector/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/capif/charts/otelcollector/Chart.yaml b/helm/capif/charts/otelcollector/Chart.yaml new file mode 100644 index 0000000..77867b3 --- /dev/null +++ b/helm/capif/charts/otelcollector/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: otelcollector +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/capif/charts/otelcollector/templates/NOTES.txt b/helm/capif/charts/otelcollector/templates/NOTES.txt new file mode 100644 index 0000000..a0fe621 --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/NOTES.txt @@ -0,0 +1,26 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else }} +{{- range .Values.service }} + {{- if contains "NodePort" .type }} + export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[?(@.name=='{{ .name }}')].nodePort}" services {{ include "otelcollector.fullname" $ }}) + 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" .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 --namespace {{ $.Release.Namespace }} svc -w {{ include "otelcollector.fullname" $ }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ $.Release.Namespace }} {{ include "otelcollector.fullname" $ }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ (index .ports 0).port }} + {{- else if contains "ClusterIP" .type }} + export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "otelcollector.name" $ }},app.kubernetes.io/instance={{ $.Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ $.Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/otelcollector/templates/_helpers.tpl b/helm/capif/charts/otelcollector/templates/_helpers.tpl new file mode 100644 index 0000000..0868fea --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "otelcollector.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 "otelcollector.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 "otelcollector.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "otelcollector.labels" -}} +helm.sh/chart: {{ include "otelcollector.chart" . }} +{{ include "otelcollector.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "otelcollector.selectorLabels" -}} +app.kubernetes.io/name: {{ include "otelcollector.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "otelcollector.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "otelcollector.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/otel-collector-configmap.yaml b/helm/capif/charts/otelcollector/templates/configmap.yaml similarity index 81% rename from helm/capif/templates/otel-collector-configmap.yaml rename to helm/capif/charts/otelcollector/templates/configmap.yaml index fed1535..d169e1f 100644 --- a/helm/capif/templates/otel-collector-configmap.yaml +++ b/helm/capif/charts/otelcollector/templates/configmap.yaml @@ -1,4 +1,4 @@ -{{- if eq .Values.monitoring.enable "true" }} +{{- if .Values.enabled | default false }} apiVersion: v1 kind: ConfigMap metadata: @@ -22,7 +22,7 @@ data: loglevel: debug otlp: #timeout: 60s - endpoint: {{ .Values.monitoring.otel.configMap.tempoEndpoint }} + endpoint: {{ .Values.configMap.tempoEndpoint }} tls: insecure: true diff --git a/helm/capif/charts/otelcollector/templates/deployment.yaml b/helm/capif/charts/otelcollector/templates/deployment.yaml new file mode 100644 index 0000000..a39db22 --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/deployment.yaml @@ -0,0 +1,75 @@ +{{- if .Values.enabled | default false }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "otelcollector.fullname" . }} + labels: + {{- include "otelcollector.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "otelcollector.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + labels: + {{- include "otelcollector.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "otelcollector.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + {{- range .Values.service }} + - containerPort: {{ .port }} + name: {{ .name }} + protocol: {{ if eq .name "otel-collector-udp" }}UDP{{ else }}TCP{{ end }} + {{- end }} + args: + - --config + - /etc/otel-collector-config.yaml + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/otelcollector/templates/hpa.yaml b/helm/capif/charts/otelcollector/templates/hpa.yaml new file mode 100644 index 0000000..69863be --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/hpa.yaml @@ -0,0 +1,34 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "otelcollector.fullname" . }} + labels: + {{- include "otelcollector.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "otelcollector.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/otelcollector/templates/ingress.yaml b/helm/capif/charts/otelcollector/templates/ingress.yaml new file mode 100644 index 0000000..5e3fae9 --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "otelcollector.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "otelcollector.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/otelcollector/templates/service.yaml b/helm/capif/charts/otelcollector/templates/service.yaml new file mode 100644 index 0000000..cb8afee --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.enabled }} +{{- range .Values.service }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .name }} + labels: + {{- include "otelcollector.labels" $ | nindent 4 }} +spec: + type: {{ .type }} + ports: + - port: {{ .port }} + name: {{ .name }} + protocol: {{ if eq .name "otel-collector-udp" }}UDP{{ else }}TCP{{ end }} + selector: + {{- include "otelcollector.selectorLabels" $ | nindent 4 }} +--- +{{- end }} +{{- end }} diff --git a/helm/capif/charts/otelcollector/templates/serviceaccount.yaml b/helm/capif/charts/otelcollector/templates/serviceaccount.yaml new file mode 100644 index 0000000..68267fd --- /dev/null +++ b/helm/capif/charts/otelcollector/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "otelcollector.serviceAccountName" . }} + labels: + {{- include "otelcollector.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/otelcollector/values.yaml b/helm/capif/charts/otelcollector/values.yaml new file mode 100644 index 0000000..cd541af --- /dev/null +++ b/helm/capif/charts/otelcollector/values.yaml @@ -0,0 +1,119 @@ +# Default values for otelcollector. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + + +enabled: false + +replicaCount: 1 + +image: + repository: otel/opentelemetry-collector + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "0.81.0" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +configMap: + tempoEndpoint: tempo:4317 + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + - name: otel-collector + type: ClusterIP + port: 55680 + - name: otel-tcp + type: ClusterIP + port: 4318 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: +# httpGet: +# path: / +# port: http +readinessProbe: +# httpGet: +# path: / +# port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: + - name: op-telemetry + configMap: + name: open-telemetry-configmap + items: + - key: "otel-collector-config.yaml" + path: "otel-collector-config.yaml" + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: + - name: op-telemetry + mountPath: /etc/otel-collector-config.yaml + subPath: otel-collector-config.yaml + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm/capif/charts/renderer/.helmignore b/helm/capif/charts/renderer/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/capif/charts/renderer/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/capif/charts/renderer/Chart.yaml b/helm/capif/charts/renderer/Chart.yaml new file mode 100644 index 0000000..49cab70 --- /dev/null +++ b/helm/capif/charts/renderer/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: renderer +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/capif/charts/renderer/templates/NOTES.txt b/helm/capif/charts/renderer/templates/NOTES.txt new file mode 100644 index 0000000..c3a1259 --- /dev/null +++ b/helm/capif/charts/renderer/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "renderer.fullname" . }}) + 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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "renderer.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "renderer.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "renderer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/helm/capif/charts/renderer/templates/_helpers.tpl b/helm/capif/charts/renderer/templates/_helpers.tpl new file mode 100644 index 0000000..6ed72f2 --- /dev/null +++ b/helm/capif/charts/renderer/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "renderer.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 "renderer.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 "renderer.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "renderer.labels" -}} +helm.sh/chart: {{ include "renderer.chart" . }} +{{ include "renderer.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "renderer.selectorLabels" -}} +app.kubernetes.io/name: {{ include "renderer.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "renderer.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "renderer.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/capif/charts/renderer/templates/configmap.yaml b/helm/capif/charts/renderer/templates/configmap.yaml new file mode 100644 index 0000000..102b859 --- /dev/null +++ b/helm/capif/charts/renderer/templates/configmap.yaml @@ -0,0 +1,8 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: renderer-configmap +data: + ENABLE_METRICS: {{ quote .Values.env.enableMetrics }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/renderer/templates/deployment.yaml b/helm/capif/charts/renderer/templates/deployment.yaml new file mode 100644 index 0000000..42cab3f --- /dev/null +++ b/helm/capif/charts/renderer/templates/deployment.yaml @@ -0,0 +1,74 @@ +{{- if .Values.enabled | default false }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "renderer.fullname" . }} + labels: + {{- include "renderer.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "renderer.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + labels: + {{- include "renderer.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "renderer.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + env: + - name: ENABLE_METRICS + valueFrom: + configMapKeyRef: + name: renderer-configmap + key: ENABLE_METRICS + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/renderer/templates/hpa.yaml b/helm/capif/charts/renderer/templates/hpa.yaml new file mode 100644 index 0000000..7783b71 --- /dev/null +++ b/helm/capif/charts/renderer/templates/hpa.yaml @@ -0,0 +1,34 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "renderer.fullname" . }} + labels: + {{- include "renderer.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "renderer.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/renderer/templates/ingress.yaml b/helm/capif/charts/renderer/templates/ingress.yaml new file mode 100644 index 0000000..86f62ee --- /dev/null +++ b/helm/capif/charts/renderer/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "renderer.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "renderer.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/renderer/templates/service.yaml b/helm/capif/charts/renderer/templates/service.yaml new file mode 100644 index 0000000..47f91af --- /dev/null +++ b/helm/capif/charts/renderer/templates/service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Service +metadata: + name: renderer + labels: + {{- include "renderer.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "renderer.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/helm/capif/charts/renderer/templates/serviceaccount.yaml b/helm/capif/charts/renderer/templates/serviceaccount.yaml new file mode 100644 index 0000000..00ff2dc --- /dev/null +++ b/helm/capif/charts/renderer/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.enabled | default false }} +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "renderer.serviceAccountName" . }} + labels: + {{- include "renderer.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/capif/charts/renderer/templates/tests/test-connection.yaml b/helm/capif/charts/renderer/templates/tests/test-connection.yaml new file mode 100644 index 0000000..9e7838a --- /dev/null +++ b/helm/capif/charts/renderer/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if .Values.enabled | default false }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "renderer.fullname" . }}-test-connection" + labels: + {{- include "renderer.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['renderer:{{ .Values.service.port }}'] + restartPolicy: Never +{{- end }} diff --git a/helm/capif/charts/renderer/values.yaml b/helm/capif/charts/renderer/values.yaml new file mode 100644 index 0000000..7696150 --- /dev/null +++ b/helm/capif/charts/renderer/values.yaml @@ -0,0 +1,112 @@ +# Default values for renderer. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +enabled: false + +replicaCount: 1 + +image: + repository: grafana/grafana-image-renderer + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +env: + enableMetrics: "true" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8081 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm/capif/templates/deployment.yaml b/helm/capif/templates/deployment.yaml deleted file mode 100644 index 8b13789..0000000 --- a/helm/capif/templates/deployment.yaml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/helm/capif/templates/fluent-bit-service.yaml b/helm/capif/templates/fluent-bit-service.yaml deleted file mode 100644 index 90653b3..0000000 --- a/helm/capif/templates/fluent-bit-service.yaml +++ /dev/null @@ -1,24 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - creationTimestamp: null - labels: - io.kompose.service: fluent-bit - {{- include "capif.labels" . | nindent 4 }} - name: fluent-bit -spec: - ports: - - name: "24224-tcp" - port: 24224 - targetPort: 24224 - - name: 24224-udp - port: 24224 - protocol: UDP - targetPort: 24224 - selector: - io.kompose.service: fluent-bit -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/fluentbit-deployment.yaml b/helm/capif/templates/fluentbit-deployment.yaml deleted file mode 100644 index 925ec02..0000000 --- a/helm/capif/templates/fluentbit-deployment.yaml +++ /dev/null @@ -1,59 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: fluent-bit - {{- include "capif.labels" . | nindent 4 }} - name: fluent-bit -spec: - replicas: 1 - selector: - matchLabels: - io.kompose.service: fluent-bit - {{- include "capif.selectorLabels" . | nindent 6 }} - strategy: - type: Recreate - template: - metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - checksum/config: {{ include (print $.Template.BasePath "/fluentbit-configmap.yaml") . | sha256sum }} - creationTimestamp: null - labels: - io.kompose.network/monitoring-default: "true" - io.kompose.service: fluent-bit - {{- include "capif.selectorLabels" . | nindent 8 }} - spec: - containers: - - env: - - name: LOKI_URL - valueFrom: - configMapKeyRef: - name: fluent-bit-configmap - key: LOKI_URL - image: {{ .Values.monitoring.fluentBit.image.repository }}:{{ .Values.monitoring.fluentBit.image.tag }} - name: fluent-bit - ports: - - containerPort: 24224 - - containerPort: 24224 - protocol: UDP - resources: - {{- toYaml .Values.monitoring.fluentBit.resources | nindent 12 }} - volumeMounts: - - name: fluent-bit-conf - mountPath: /fluent-bit/etc/fluent-bit.conf - subPath: fluent-bit.conf - restartPolicy: Always - volumes: - - name: fluent-bit-conf - configMap: - name: fluent-bit-configmap - items: - - key: "fluent-bit.conf" - path: "fluent-bit.conf" -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/grafana-ingress-route.yaml b/helm/capif/templates/grafana-ingress-route.yaml deleted file mode 100644 index 2e2648b..0000000 --- a/helm/capif/templates/grafana-ingress-route.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.grafana.ingressRoute.enable "true" }} -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: grafana-ingress-route -spec: - entryPoints: [web] - routes: - - kind: Rule - match: Host(`{{ .Values.monitoring.grafana.ingressRoute.host }}`) - services: - - kind: Service - name: grafana - port: {{ .Values.monitoring.grafana.service.port }} - scheme: http -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/grafana-ingress.yaml b/helm/capif/templates/grafana-ingress.yaml deleted file mode 100644 index 7d7d0cb..0000000 --- a/helm/capif/templates/grafana-ingress.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if .Values.monitoring.grafana.ingress.enabled -}} -{{- $svcPort := .Values.monitoring.grafana.service.port -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: grafana-ingress - labels: - {{- include "capif.labels" . | nindent 4 }} - {{- with .Values.monitoring.grafana.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: -{{- if .Values.monitoring.grafana.ingress.ingressClassName }} - ingressClassName: {{ .Values.monitoring.grafana.ingress.ingressClassName }} -{{- end }} - rules: - {{- range .Values.monitoring.grafana.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - pathType: {{ .pathType }} - backend: - service: - name: grafana - port: - number: {{ $svcPort }} - {{- end }} - {{- end }} -{{- end }} -{{- end }} diff --git a/helm/capif/templates/grafana-pvc.yaml b/helm/capif/templates/grafana-pvc.yaml deleted file mode 100644 index 5a55282..0000000 --- a/helm/capif/templates/grafana-pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.grafana.persistence.enable "true" }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - io.kompose.service: grafana-claim0 - name: grafana-claim0 -spec: - storageClassName: {{ .Values.monitoring.grafana.persistence.storageClass }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.monitoring.grafana.persistence.storage }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/grafana-secrets.yaml b/helm/capif/templates/grafana-secrets.yaml deleted file mode 100644 index a6796d4..0000000 --- a/helm/capif/templates/grafana-secrets.yaml +++ /dev/null @@ -1,10 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Secret -metadata: - name: grafana-secrets -type: Opaque -data: - GF_AUTH_ANONYMOUS_ORG_ROLE: {{ .Values.monitoring.grafana.env.gfAuthAnonymousOrgRole | b64enc | quote }} - GF_SECURITY_ADMIN_PASSWORD: {{ .Values.monitoring.grafana.env.gfSecurityAdminPassword | b64enc | quote }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/grafana-service.yaml b/helm/capif/templates/grafana-service.yaml deleted file mode 100644 index c628043..0000000 --- a/helm/capif/templates/grafana-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - name: grafana - labels: - {{- include "capif.labels" . | nindent 4 }} -spec: - type: {{ .Values.monitoring.grafana.service.type }} - ports: - - port: {{ .Values.monitoring.grafana.service.port }} - targetPort: {{ .Values.monitoring.grafana.service.port }} - protocol: TCP - name: http-port - selector: - io.kompose.service: grafana -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/loki-deployment.yaml b/helm/capif/templates/loki-deployment.yaml deleted file mode 100644 index cadf37d..0000000 --- a/helm/capif/templates/loki-deployment.yaml +++ /dev/null @@ -1,54 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: loki - {{- include "capif.labels" . | nindent 4 }} - name: loki -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - io.kompose.service: loki - {{- include "capif.selectorLabels" . | nindent 6 }} - strategy: {} - template: - metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.network/monitoring-default: "true" - io.kompose.service: loki - {{- include "capif.selectorLabels" . | nindent 8 }} - spec: - containers: - - args: - - -config.file=/etc/loki/local-config.yaml - image: {{ .Values.monitoring.loki.image.repository }}:{{ .Values.monitoring.loki.image.tag }} - name: loki - ports: - - containerPort: 3100 - {{- if eq .Values.monitoring.loki.persistence.enable "true" }} - volumeMounts: - - name: loki-claim0 - mountPath: /loki/wal - {{- end }} - resources: - {{- toYaml .Values.monitoring.loki.resources | nindent 12 }} - securityContext: - runAsUser: 0 - {{- if eq .Values.monitoring.loki.persistence.enable "true" }} - volumes: - - name: loki-claim0 - persistentVolumeClaim: - claimName: loki-claim0 - {{- end }} - restartPolicy: Always -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/loki-pvc.yaml b/helm/capif/templates/loki-pvc.yaml deleted file mode 100644 index 0b90bda..0000000 --- a/helm/capif/templates/loki-pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.loki.persistence.enable "true" }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - labels: - io.kompose.service: loki-claim0 - name: loki-claim0 -spec: - storageClassName: {{ .Values.monitoring.loki.persistence.storageClass }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.monitoring.loki.persistence.storage }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/loki-service.yaml b/helm/capif/templates/loki-service.yaml deleted file mode 100644 index cf711a9..0000000 --- a/helm/capif/templates/loki-service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: loki - {{- include "capif.labels" . | nindent 4 }} - name: loki -spec: - ports: - - name: "loki-port" - port: 3100 - targetPort: 3100 - selector: - io.kompose.service: loki -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/otel-collector-deployment.yaml b/helm/capif/templates/otel-collector-deployment.yaml deleted file mode 100644 index 8c83eca..0000000 --- a/helm/capif/templates/otel-collector-deployment.yaml +++ /dev/null @@ -1,54 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: otel-collector - {{- include "capif.labels" . | nindent 4 }} - name: otel-collector -spec: - replicas: 1 - selector: - matchLabels: - io.kompose.service: otel-collector - {{- include "capif.selectorLabels" . | nindent 6 }} - strategy: - type: Recreate - template: - metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - checksum/config: {{ include (print $.Template.BasePath "/otel-collector-configmap.yaml") . | sha256sum }} - labels: - io.kompose.network/monitoring-default: "true" - io.kompose.service: otel-collector - {{- include "capif.selectorLabels" . | nindent 8 }} - spec: - containers: - - args: - - --config - - /etc/otel-collector-config.yaml - image: {{ .Values.monitoring.otel.image.repository }}:{{ .Values.monitoring.otel.image.tag }} - name: otel-collector - ports: - - containerPort: 55680 - - containerPort: 4317 - resources: - {{- toYaml .Values.monitoring.otel.resources | nindent 12 }} - volumeMounts: - - name: op-telemetry - mountPath: /etc/otel-collector-config.yaml - subPath: otel-collector-config.yaml - restartPolicy: Always - volumes: - - name: op-telemetry - configMap: - name: open-telemetry-configmap - items: - - key: "otel-collector-config.yaml" - path: "otel-collector-config.yaml" -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/otel-collector-service.yaml b/helm/capif/templates/otel-collector-service.yaml deleted file mode 100644 index 761b8ce..0000000 --- a/helm/capif/templates/otel-collector-service.yaml +++ /dev/null @@ -1,22 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: otel-collector - {{- include "capif.labels" . | nindent 4 }} - name: otel-collector -spec: - ports: - - name: "grpc-port" - port: 55680 - targetPort: 55680 - - name: "http-port" - port: 4318 - targetPort: 4318 - selector: - io.kompose.service: otel-collector -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-clusterrole.yaml b/helm/capif/templates/prometheus-clusterrole.yaml deleted file mode 100644 index 3470ffd..0000000 --- a/helm/capif/templates/prometheus-clusterrole.yaml +++ /dev/null @@ -1,49 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: prometheus - labels: - app: prometheus -rules: -- apiGroups: [""] - resources: - - nodes - - nodes/proxy - - services - - endpoints - - pods - verbs: ["get", "list", "watch"] -- apiGroups: - - extensions - resources: - - ingresses - verbs: ["get", "list", "watch"] -- nonResourceURLs: ["/metrics"] - verbs: ["get"] ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: prometheus - namespace: {{ .Release.Namespace }} - labels: - app: prometheus ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: prometheus - labels: - app: prometheus -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: prometheus -subjects: -- kind: ServiceAccount - name: prometheus - namespace: {{ .Release.Namespace }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-configmap.yaml b/helm/capif/templates/prometheus-configmap.yaml deleted file mode 100644 index d2ab952..0000000 --- a/helm/capif/templates/prometheus-configmap.yaml +++ /dev/null @@ -1,141 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -apiVersion: v1 -kind: ConfigMap -metadata: - labels: - app: prometheus - name: prometheus-config -data: - prometheus.rules: |- - groups: - - name: devopscube alert - rules: - - alert: High Pod Memory - expr: sum(container_memory_usage_bytes) > 1 - for: 1m - labels: - severity: slack - annotations: - summary: High Memory Usage - prometheus.yml: |- - global: - scrape_interval: 30s - scrape_timeout: 10s - scrape_configs: - #------------- configuration to collect pods metrics kubelet ------------------- - - job_name: 'kubernetes-cadvisor' - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - kubernetes_sd_configs: - - role: node - relabel_configs: - - action: labelmap - regex: __meta_kubernetes_node_label_(.+) - - target_label: __address__ - replacement: kubernetes.default.svc:443 - - source_labels: [__meta_kubernetes_node_name] - regex: (.+) - target_label: __metrics_path__ - replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor - #------------- configuration to collect pods metrics ------------------- - - job_name: 'kubernetes-pods' - honor_labels: true - kubernetes_sd_configs: - - role: pod - relabel_configs: - # select only those pods that has "prometheus.io/scrape: true" annotation - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] - action: keep - regex: true - # set metrics_path (default is /metrics) to the metrics path specified in "prometheus.io/path: " annotation. - - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - # set the scrapping port to the port specified in "prometheus.io/port: " annotation and set address accordingly. - - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] - action: replace - regex: ([^:]+)(?::\d+)?;(\d+) - replacement: $1:$2 - target_label: __address__ - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - source_labels: [__meta_kubernetes_namespace] - action: replace - target_label: kubernetes_namespace - - source_labels: [__meta_kubernetes_pod_name] - action: replace - target_label: kubernetes_pod_name - - #-------------- configuration to collect metrics from service endpoints ----------------------- - - job_name: 'kubernetes-service-endpoints' - honor_labels: true - kubernetes_sd_configs: - - role: endpoints - relabel_configs: - # select only those endpoints whose service has "prometheus.io/scrape: true" annotation - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] - action: keep - regex: true - # set the metrics_path to the path specified in "prometheus.io/path: " annotation. - - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] - action: replace - target_label: __metrics_path__ - regex: (.+) - # set the scrapping port to the port specified in "prometheus.io/port: " annotation and set address accordingly. - - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] - action: replace - target_label: __address__ - regex: ([^:]+)(?::\d+)?;(\d+) - replacement: $1:$2 - - action: labelmap - regex: __meta_kubernetes_service_label_(.+) - - source_labels: [__meta_kubernetes_namespace] - action: replace - target_label: kubernetes_namespace - - source_labels: [__meta_kubernetes_service_name] - action: replace - target_label: kubernetes_name - - #---------------- configuration to collect metrics from kubernetes apiserver ------------------------- - - job_name: 'kubernetes-apiservers' - honor_labels: true - kubernetes_sd_configs: - - role: endpoints - # kubernetes apiserver serve metrics on a TLS secure endpoints. so, we have to use "https" scheme - scheme: https - # we have to provide certificate to establish tls secure connection - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - # bearer_token_file is required for authorizating prometheus server to kubernetes apiserver - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - - relabel_configs: - - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] - action: keep - regex: default;kubernetes;https - - #--------------- configuration to collect metrics from nodes ----------------------- - - job_name: 'kubernetes-nodes' - honor_labels: true - scheme: https - tls_config: - ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - - kubernetes_sd_configs: - - role: node - relabel_configs: - - action: labelmap - regex: __meta_kubernetes_node_label_(.+) - - target_label: __address__ - replacement: kubernetes.default.svc:443 - - source_labels: [__meta_kubernetes_node_name] - regex: (.+) - target_label: __metrics_path__ - replacement: /api/v1/nodes/${1}/proxy/metrics -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-deployment.yaml b/helm/capif/templates/prometheus-deployment.yaml deleted file mode 100644 index d70cf09..0000000 --- a/helm/capif/templates/prometheus-deployment.yaml +++ /dev/null @@ -1,68 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: prometheus - labels: - app: prometheus - {{- include "capif.labels" . | nindent 4 }} -spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app: prometheus - {{- include "capif.selectorLabels" . | nindent 6 }} - template: - metadata: - annotations: - checksum/config: {{ include (print $.Template.BasePath "/prometheus-configmap.yaml") . | sha256sum }} - labels: - app: prometheus - {{- include "capif.selectorLabels" . | nindent 8 }} - spec: - serviceAccountName: prometheus - containers: - - name: prometheus - image: {{ .Values.monitoring.prometheus.image.repository }}:{{ .Values.monitoring.prometheus.image.tag }} - args: - - "--config.file=/etc/prometheus/prometheus.yml" - - "--storage.tsdb.path=/prometheus/" - - "--storage.tsdb.retention.time={{.Values.monitoring.prometheus.retentionTime }}" - ports: - - containerPort: 9090 - resources: - {{- toYaml .Values.monitoring.prometheus.resources | nindent 12 }} - securityContext: - runAsUser: 0 - livenessProbe: - tcpSocket: - port: 9090 - initialDelaySeconds: 20 - volumeMounts: - - name: prometheus-config - mountPath: /etc/prometheus/ - {{- if eq .Values.monitoring.prometheus.persistence.enable "true" }} - - name: prometheus-storage-volume - mountPath: /prometheus/ - {{ else }} - - name: prometheus-storage - mountPath: /prometheus/ - {{- end }} - volumes: - - name: prometheus-config - configMap: - defaultMode: 420 - name: prometheus-config - {{- if eq .Values.monitoring.prometheus.persistence.enable "true" }} - - name: prometheus-storage-volume - persistentVolumeClaim: - claimName: prometheus-pvc - {{ else }} - - name: prometheus-storage - emptyDir: {} - {{- end }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-ingress-route.yaml b/helm/capif/templates/prometheus-ingress-route.yaml deleted file mode 100644 index b7a0d2b..0000000 --- a/helm/capif/templates/prometheus-ingress-route.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -{{- if eq .Values.monitoring.prometheus.ingressRoute.enable "true" }} -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: prometheus-ingress-route -spec: - entryPoints: [web] - routes: - - kind: Rule - match: Host(`{{ .Values.monitoring.prometheus.ingressRoute.host }}`) - services: - - kind: Service - name: prometheus - port: {{ .Values.monitoring.prometheus.service.port }} - scheme: http -{{- end }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-ingress.yaml b/helm/capif/templates/prometheus-ingress.yaml deleted file mode 100644 index d082973..0000000 --- a/helm/capif/templates/prometheus-ingress.yaml +++ /dev/null @@ -1,36 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -{{- if .Values.monitoring.prometheus.ingress.enabled -}} -{{- $svcPort := .Values.monitoring.prometheus.service.port -}} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: prometheus-ingress - labels: - {{- include "capif.labels" . | nindent 4 }} - {{- with .Values.monitoring.prometheus.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: -{{- if .Values.monitoring.prometheus.ingress.ingressClassName }} - ingressClassName: {{ .Values.monitoring.prometheus.ingress.ingressClassName }} -{{- end }} - rules: - {{- range .Values.monitoring.prometheus.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - pathType: {{ .pathType }} - backend: - service: - name: prometheus - port: - number: {{ $svcPort }} - {{- end }} - {{- end }} -{{- end }} -{{- end }} -{{- end }} diff --git a/helm/capif/templates/prometheus-pvc.yaml b/helm/capif/templates/prometheus-pvc.yaml deleted file mode 100644 index 8f763c6..0000000 --- a/helm/capif/templates/prometheus-pvc.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -{{- if eq .Values.monitoring.prometheus.persistence.enable "true" }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: prometheus-pvc - labels: - app: prometheus - {{- include "capif.labels" . | nindent 4 }} -spec: - storageClassName: {{ .Values.monitoring.prometheus.persistence.storageClass }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.monitoring.prometheus.persistence.storage }} -{{- end }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/prometheus-service.yaml b/helm/capif/templates/prometheus-service.yaml deleted file mode 100644 index 778dbd5..0000000 --- a/helm/capif/templates/prometheus-service.yaml +++ /dev/null @@ -1,22 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -{{- if eq .Values.monitoring.prometheus.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - annotations: - prometheus.io/path: /metrics - prometheus.io/port: {{ quote .Values.monitoring.prometheus.service.port }} - prometheus.io/scrape: "true" - name: prometheus - labels: - {{- include "capif.labels" . | nindent 4 }} -spec: - type: {{ .Values.monitoring.prometheus.service.type }} - ports: - - port: {{ .Values.monitoring.prometheus.service.port }} - protocol: TCP - targetPort: {{ .Values.monitoring.prometheus.service.port }} - selector: - app: prometheus -{{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/renderer-configmap.yaml b/helm/capif/templates/renderer-configmap.yaml deleted file mode 100644 index 0159fcb..0000000 --- a/helm/capif/templates/renderer-configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: renderer-configmap -data: - ENABLE_METRICS: {{ quote .Values.monitoring.renderer.env.enableMetrics }} -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/renderer-deployment.yaml b/helm/capif/templates/renderer-deployment.yaml deleted file mode 100644 index 83a7ee2..0000000 --- a/helm/capif/templates/renderer-deployment.yaml +++ /dev/null @@ -1,44 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: apps/v1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: renderer - {{- include "capif.labels" . | nindent 4 }} - name: renderer -spec: - replicas: 1 - selector: - matchLabels: - io.kompose.service: renderer - {{- include "capif.selectorLabels" . | nindent 6 }} - strategy: {} - template: - metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - checksum/config: {{ include (print $.Template.BasePath "/renderer-configmap.yaml") . | sha256sum }} - labels: - io.kompose.network/monitoring-default: "true" - io.kompose.service: renderer - {{- include "capif.selectorLabels" . | nindent 8 }} - spec: - containers: - - env: - - name: ENABLE_METRICS - valueFrom: - configMapKeyRef: - name: renderer-configmap - key: ENABLE_METRICS - image: {{ .Values.monitoring.renderer.image.repository }}:{{ .Values.monitoring.renderer.image.tag }} - name: grafana-image-renderer - ports: - - containerPort: 8081 - resources: - {{- toYaml .Values.monitoring.renderer.resources | nindent 12 }} - restartPolicy: Always -{{- end }} \ No newline at end of file diff --git a/helm/capif/templates/renderer-service.yaml b/helm/capif/templates/renderer-service.yaml deleted file mode 100644 index 471a51d..0000000 --- a/helm/capif/templates/renderer-service.yaml +++ /dev/null @@ -1,18 +0,0 @@ -{{- if eq .Values.monitoring.enable "true" }} -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose -f docker-compose.yml convert - kompose.version: 1.28.0 (c4137012e) - labels: - io.kompose.service: renderer - name: renderer -spec: - ports: - - name: "rendere-port" - port: 8081 - targetPort: 8081 - selector: - io.kompose.service: renderer -{{- end }} \ No newline at end of file diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index a2c7347..e70b634 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -1,8 +1,9 @@ -monitoring: - enable: "true" +# -- To enable monitoring in ocf. +# -- enabled the next services: +# -- tempo, fluentbit, grafana, loki, otelcollector and renderer. +# -- prometheus service must be previously installed in kubernetes # -- With tempo.enabled: false. It won't be deployed -# -- If monitoring.enable: "true". Also enable tempo.enabled: true tempo: enabled: true tempo: @@ -13,167 +14,34 @@ tempo: enabled: true size: 3Gi -monitoring: - # -- If monitoring enabled. enable: true, enable: "" = not enabled - enable: "true" - fluentBit: - image: - # -- The docker image repository to use - repository: "grafana/fluent-bit-plugin-loki" - # -- The docker image tag to use - # @default Chart version - tag: "latest" - env: - lokiUrl: http://loki:3100/loki/api/v1/push - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - loki: - image: - # -- The docker image repository to use - repository: "grafana/loki" - # -- The docker image tag to use - # @default Chart version - tag: "2.8.0" - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - # -- If grafana.persistence enabled. enable: true, enable: "" = not enabled - persistence: - enable: "true" - storage: 100Mi - storageClass: nfs-01 - otel: - image: - # -- The docker image repository to use - repository: "otel/opentelemetry-collector" - # -- The docker image tag to use - # @default Chart version - tag: "0.81.0" - configMap: - tempoEndpoint: monitoring-capif-tempo:4317 - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - renderer: - image: - # -- The docker image repository to use - repository: "grafana/grafana-image-renderer" - # -- The docker image tag to use - # @default Chart version - tag: "latest" - env: - enableMetrics: "true" - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - prometheus: - # -- With prometheus.enabled: "". It won't be deployed. prometheus.enable: "true" - # -- It will deploy prometheus - enable: "" - image: - # -- The docker image repository to use - repository: "prom/prometheus" - # -- The docker image tag to use - # @default Chart version - tag: "latest" - retentionTime: 3d - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - persistence: - enable: "true" - storage: 8Gi - storageClass: nfs-01 - service: - type: ClusterIP - port: 9090 - ingress: - enabled: true - ingressClassName: nginx - annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: prometheus.test.int - paths: - - path: / - pathType: Prefix - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - # -- If ingressRoute enable=true, use monitoring.prometheus.ingress.enabled="" - ingressRoute: - enable: "" - host: prometheus.test.int - grafana: - image: - # -- The docker image repository to use - repository: "grafana/grafana" - # -- The docker image tag to use - # @default Chart version - tag: "latest" - env: - gfAuthAnonymousEnable: true - gfSecurityAllowEmbedding: true - gfAuthAnonymousOrgRole: Admin - gfSecurityAdminPassword: secure_pass - lokiUrl: http://loki:3100 - prometheusUrl: http://prometheus.mon.svc.cluster.local:9090 - tempoUrl: http://monitoring-capif-tempo:3100 - resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - # -- If grafana.persistence enabled. enable: true, enable: "" = not enabled - persistence: - enable: "true" - storage: 100Mi - storageClass: nfs-01 - service: - type: ClusterIP - port: 3000 - # -- If ingress enabled=true, use monitoring.grafana.ingressRoute.enable="" - ingress: - enabled: true - ingressClassName: nginx - annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: grafana.test.int - paths: - - path: / - pathType: Prefix - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - # -- If ingressRoute enable=true, use monitoring.grafana.ingress.enabled="" - ingressRoute: - enable: "" - host: grafana.5gnacar.int +# -- With fluentbit.enabled: false. It won't be deployed +fluentbit: + enabled: true + +# -- With grafana.enabled: false. It won't be deployed +grafana: + enabled: true + +# -- With loki.enabled: false. It won't be deployed +loki: + enabled: true + +# -- With otelcollector.enabled: false. It won't be deployed +otelcollector: + enabled: true + +# -- With renderer.enabled: false. It won't be deployed +renderer: + enabled: true + +# -- With mongo-express.enabled: false. It won't be deployed +mongo-express: + enabled: true + +# -- With mongo-register-express.enabled: false. It won't be deployed +mongo-register-express: + enabled: true + +# -- With mock-server.enabled: false. It won't be deployed +mock-server: + enabled: true \ No newline at end of file -- GitLab From 6cd68177f1e291f74bcc7642e6b424c6d5733b07 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 08:41:54 +0200 Subject: [PATCH 2/6] enabled false values.yaaml --- helm/capif/values.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index e70b634..b90d7b2 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -16,32 +16,32 @@ tempo: # -- With fluentbit.enabled: false. It won't be deployed fluentbit: - enabled: true + enabled: false # -- With grafana.enabled: false. It won't be deployed grafana: - enabled: true + enabled: false # -- With loki.enabled: false. It won't be deployed loki: - enabled: true + enabled: false # -- With otelcollector.enabled: false. It won't be deployed otelcollector: - enabled: true + enabled: false # -- With renderer.enabled: false. It won't be deployed renderer: - enabled: true + enabled: false # -- With mongo-express.enabled: false. It won't be deployed mongo-express: - enabled: true + enabled: false # -- With mongo-register-express.enabled: false. It won't be deployed mongo-register-express: - enabled: true + enabled: false # -- With mock-server.enabled: false. It won't be deployed mock-server: - enabled: true \ No newline at end of file + enabled: false \ No newline at end of file -- GitLab From 004e22d1873335399f39566791e424a74512d551 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 09:10:34 +0200 Subject: [PATCH 3/6] enabled --- helm/capif/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index b90d7b2..9ecc11e 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -44,4 +44,4 @@ mongo-register-express: # -- With mock-server.enabled: false. It won't be deployed mock-server: - enabled: false \ No newline at end of file + enabled: false -- GitLab From ab607e260361cf9afcd608f05c347040ef4efe21 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 09:30:09 +0200 Subject: [PATCH 4/6] typing deleted --- helm/capif/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index 9ecc11e..b90d7b2 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -44,4 +44,4 @@ mongo-register-express: # -- With mock-server.enabled: false. It won't be deployed mock-server: - enabled: false + enabled: false \ No newline at end of file -- GitLab From da2a614e06efb951c3002ee17f74203c17613448 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 09:34:56 +0200 Subject: [PATCH 5/6] deleting typing --- helm/capif/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index b90d7b2..9ecc11e 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -44,4 +44,4 @@ mongo-register-express: # -- With mock-server.enabled: false. It won't be deployed mock-server: - enabled: false \ No newline at end of file + enabled: false -- GitLab From 0818c59a934cf3c64ad729a1cdf68f19ac038d97 Mon Sep 17 00:00:00 2001 From: andresanaya21 Date: Tue, 25 Jun 2024 09:40:12 +0200 Subject: [PATCH 6/6] deleting typing --- helm/capif/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/capif/values.yaml b/helm/capif/values.yaml index 9ecc11e..b90d7b2 100644 --- a/helm/capif/values.yaml +++ b/helm/capif/values.yaml @@ -44,4 +44,4 @@ mongo-register-express: # -- With mock-server.enabled: false. It won't be deployed mock-server: - enabled: false + enabled: false \ No newline at end of file -- GitLab