Skip to content

Commit

Permalink
fix metadata checks when looking for existing Prometheus & Grafana in…
Browse files Browse the repository at this point in the history
…stallations (#43)
  • Loading branch information
kondratyevd authored Feb 14, 2025
1 parent f2e5031 commit 5eaf9d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helm/supersonic/templates/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Check if service exists - takes service name as parameter
{{- $exists := "" -}}
{{- if (lookup "apps/v1" "Deployment" .root.Release.Namespace "") -}}
{{- range (lookup "apps/v1" "Deployment" .root.Release.Namespace "").items -}}
{{- if eq (index .metadata.labels "app.kubernetes.io/name") $serviceName -}}
{{- if and .metadata .metadata.labels (eq (index .metadata.labels "app.kubernetes.io/name") $serviceName) -}}
{{- $exists = "true" -}}
{{- end -}}
{{- end -}}
Expand All @@ -68,7 +68,7 @@ Get service details - takes service type and root context as parameters
{{- /* Try to get details from ingress first */ -}}
{{- if (lookup "networking.k8s.io/v1" "Ingress" $root.Release.Namespace "") -}}
{{- range (lookup "networking.k8s.io/v1" "Ingress" $root.Release.Namespace "").items -}}
{{- if eq (index .metadata.labels "app.kubernetes.io/name") $serviceType -}}
{{- if and .metadata .metadata.labels (eq (index .metadata.labels "app.kubernetes.io/name") $serviceType) -}}
{{- if .spec.rules -}}
{{- $details = merge $details (dict "host" (index .spec.rules 0).host) -}}
{{- if .spec.tls -}}
Expand All @@ -86,7 +86,7 @@ Get service details - takes service type and root context as parameters
{{- if (not $found) -}}
{{- if (lookup "v1" "Service" $root.Release.Namespace "") -}}
{{- range (lookup "v1" "Service" $root.Release.Namespace "").items -}}
{{- if eq (index .metadata.labels "app.kubernetes.io/name") $serviceType -}}
{{- if and .metadata .metadata.labels (eq (index .metadata.labels "app.kubernetes.io/name") $serviceType) -}}
{{- $details = merge $details (dict "host" (printf "%s.%s.svc.cluster.local" .metadata.name $root.Release.Namespace)) -}}
{{- end -}}
{{- end -}}
Expand Down

0 comments on commit 5eaf9d6

Please sign in to comment.