From 9ed4ba0940b487d366dd78efd648bdc677cdff3f Mon Sep 17 00:00:00 2001 From: "asapals@onairent.live" Date: Fri, 20 Sep 2024 18:59:06 +0300 Subject: [PATCH 1/5] Alligning names of service/configmap names with mounts --- charts/meta-monitoring/templates/_helpers.tpl | 25 +++++++++++++++++++ .../templates/grafana/datasources.yaml | 2 +- .../templates/ruler/ruler.yaml | 6 ++--- charts/meta-monitoring/values.yaml | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/charts/meta-monitoring/templates/_helpers.tpl b/charts/meta-monitoring/templates/_helpers.tpl index 04ba0e3..a6c61b8 100644 --- a/charts/meta-monitoring/templates/_helpers.tpl +++ b/charts/meta-monitoring/templates/_helpers.tpl @@ -1,3 +1,28 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "meta-monitoring.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 "meta-monitoring.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 -}} + {{/* Return the appropriate apiVersion for ingress. */}} diff --git a/charts/meta-monitoring/templates/grafana/datasources.yaml b/charts/meta-monitoring/templates/grafana/datasources.yaml index fe3ff7e..254b353 100644 --- a/charts/meta-monitoring/templates/grafana/datasources.yaml +++ b/charts/meta-monitoring/templates/grafana/datasources.yaml @@ -32,7 +32,7 @@ data: uid: loki_ds # Sets the data source's URL, including the # port. - url: http://{{- $.Release.Namespace -}}-loki-gateway.{{- $.Release.Namespace -}}.svc.cluster.local + url: http://{{ $.Release.Name }}-loki-gateway.{{- $.Release.Namespace -}}.svc.cluster.local # Toggles whether the data source is pre-selected # for new panels. You can set only one default # data source per organization. diff --git a/charts/meta-monitoring/templates/ruler/ruler.yaml b/charts/meta-monitoring/templates/ruler/ruler.yaml index 215e29d..96cb1f2 100644 --- a/charts/meta-monitoring/templates/ruler/ruler.yaml +++ b/charts/meta-monitoring/templates/ruler/ruler.yaml @@ -3,7 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $.Release.Namespace }}-mimir-ruler-for-dashboards + name: {{ $.Release.Name }}-mimir-ruler-for-dashboards namespace: {{ $.Release.Namespace }} spec: progressDeadlineSeconds: 600 @@ -111,11 +111,11 @@ spec: items: - key: mimir.yaml path: mimir.yaml - name: {{ $.Release.Namespace }}-mimir-config + name: {{ $.Release.Name }}-mimir-config name: config - configMap: defaultMode: 420 - name: {{ $.Release.Namespace }}-mimir-runtime + name: {{ $.Release.Name }}-mimir-runtime name: runtime-config - emptyDir: {} name: storage diff --git a/charts/meta-monitoring/values.yaml b/charts/meta-monitoring/values.yaml index a030128..950d003 100644 --- a/charts/meta-monitoring/values.yaml +++ b/charts/meta-monitoring/values.yaml @@ -1,3 +1,5 @@ +nameOverride: "" +fullnameOverride: "" # Specify the namespaces to monitor here namespacesToMonitor: - loki From 5fc070837f6bf1c0c648ccf2f5e85133ed2d8ad2 Mon Sep 17 00:00:00 2001 From: "asapals@onairent.live" Date: Fri, 20 Sep 2024 19:15:29 +0300 Subject: [PATCH 2/5] Bumping chart --- charts/meta-monitoring/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/meta-monitoring/Chart.yaml b/charts/meta-monitoring/Chart.yaml index 29ec44b..a201bea 100644 --- a/charts/meta-monitoring/Chart.yaml +++ b/charts/meta-monitoring/Chart.yaml @@ -13,7 +13,7 @@ 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: 1.0.0 +version: 1.0.1 # 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. From 0f092273e1c2122b4494661fc912b956a40726e9 Mon Sep 17 00:00:00 2001 From: andrejshapal Date: Mon, 23 Sep 2024 15:19:45 +0300 Subject: [PATCH 3/5] Delete charts/meta-monitoring/templates/_helpers.tpl --- charts/meta-monitoring/templates/_helpers.tpl | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 charts/meta-monitoring/templates/_helpers.tpl diff --git a/charts/meta-monitoring/templates/_helpers.tpl b/charts/meta-monitoring/templates/_helpers.tpl deleted file mode 100644 index a6c61b8..0000000 --- a/charts/meta-monitoring/templates/_helpers.tpl +++ /dev/null @@ -1,58 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "meta-monitoring.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 "meta-monitoring.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 -}} - -{{/* -Return the appropriate apiVersion for ingress. -*/}} -{{- define "ingress.apiVersion" -}} - {{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} - {{- print "networking.k8s.io/v1" -}} - {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} - {{- print "networking.k8s.io/v1beta1" -}} - {{- else -}} - {{- print "extensions/v1beta1" -}} - {{- end -}} -{{- end -}} - -{{/* -Return if ingress is stable. -*/}} -{{- define "ingress.isStable" -}} - {{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}} -{{- end -}} - -{{/* -Return if ingress supports ingressClassName. -*/}} -{{- define "ingress.supportsIngressClassName" -}} - {{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} -{{- end -}} - -{{/* -Return if ingress supports pathType. -*/}} -{{- define "ingress.supportsPathType" -}} - {{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} -{{- end -}} \ No newline at end of file From aa9a90f3a2e31200e498d1ebd42d1d7a8060c123 Mon Sep 17 00:00:00 2001 From: andrejshapal Date: Mon, 23 Sep 2024 15:20:00 +0300 Subject: [PATCH 4/5] Update values.yaml --- charts/meta-monitoring/values.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/meta-monitoring/values.yaml b/charts/meta-monitoring/values.yaml index 950d003..a030128 100644 --- a/charts/meta-monitoring/values.yaml +++ b/charts/meta-monitoring/values.yaml @@ -1,5 +1,3 @@ -nameOverride: "" -fullnameOverride: "" # Specify the namespaces to monitor here namespacesToMonitor: - loki From 14199c7119a164e7a1800b39c80f00704a672d90 Mon Sep 17 00:00:00 2001 From: "asapals@onairent.live" Date: Mon, 23 Sep 2024 15:22:52 +0300 Subject: [PATCH 5/5] Restore helpers --- charts/meta-monitoring/templates/_helpers.tpl | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 charts/meta-monitoring/templates/_helpers.tpl diff --git a/charts/meta-monitoring/templates/_helpers.tpl b/charts/meta-monitoring/templates/_helpers.tpl new file mode 100644 index 0000000..cb55cf7 --- /dev/null +++ b/charts/meta-monitoring/templates/_helpers.tpl @@ -0,0 +1,33 @@ +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "ingress.apiVersion" -}} + {{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} + {{- print "networking.k8s.io/v1" -}} + {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} + {{- print "networking.k8s.io/v1beta1" -}} + {{- else -}} + {{- print "extensions/v1beta1" -}} + {{- end -}} +{{- end -}} + +{{/* +Return if ingress is stable. +*/}} +{{- define "ingress.isStable" -}} + {{- eq (include "ingress.apiVersion" .) "networking.k8s.io/v1" -}} +{{- end -}} + +{{/* +Return if ingress supports ingressClassName. +*/}} +{{- define "ingress.supportsIngressClassName" -}} + {{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} +{{- end -}} + +{{/* +Return if ingress supports pathType. +*/}} +{{- define "ingress.supportsPathType" -}} + {{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} +{{- end -}}