Check that lookup result is not empty

If monitoring was enabled on a setup without a rancher service,
such as a docker install, monitoring would fail to install due
to a dereference issue.
pull/1768/head
Ricardo Weir 2022-02-24 15:05:51 -07:00
parent 6f04b50d75
commit 4f04899cee
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,9 @@
{{- $chartLabel := .Values.chartLabel }}
{{- if eq $chartLabel "" }}
{{- $chartLabel = (index (lookup "apps/v1" "Deployment" "cattle-system" "rancher").metadata.labels "chart") }}
{{- $rancherDeployment := (lookup "apps/v1" "Deployment" "cattle-system" "rancher") }}
{{- if $rancherDeployment }}
{{- $chartLabel = (index $rancherDeployment.metadata.labels "chart") }}
{{- end }}
{{- end }}
{{- if ne $chartLabel "" }}
apiVersion: monitoring.coreos.com/v1