diff --git a/helm/core/templates/_helpers.tpl b/helm/core/templates/_helpers.tpl index 752133f4b..ec992a390 100644 --- a/helm/core/templates/_helpers.tpl +++ b/helm/core/templates/_helpers.tpl @@ -97,7 +97,7 @@ higress: {{ include "controller.name" . }} {{- end }} {{- define "skywalking.enabled" -}} -{{- if and .Values.tracing.enable (hasKey .Values.tracing "skywalking") .Values.tracing.skywalking.service }} +{{- if and (hasKey .Values "tracing") .Values.tracing.enable (hasKey .Values.tracing "skywalking") .Values.tracing.skywalking.service }} true {{- end }} {{- end }} diff --git a/helm/core/templates/configmap.yaml b/helm/core/templates/configmap.yaml index 6623dd8dc..02d0f3ad3 100644 --- a/helm/core/templates/configmap.yaml +++ b/helm/core/templates/configmap.yaml @@ -107,9 +107,12 @@ metadata: data: higress: |- {{- $existingConfig := lookup "v1" "ConfigMap" .Release.Namespace "higress-config" }} - {{- $existingData := index $existingConfig.data "higress" | default "{}" | fromYaml }} + {{- $existingData := dict }} + {{- if $existingConfig }} + {{- $existingData = index $existingConfig.data "higress" | default "{}" | fromYaml }} + {{- end }} {{- $newData := dict }} - {{- if .Values.tracing.enable }} + {{- if and (hasKey .Values "tracing") .Values.tracing.enable }} {{- $_ := set $newData "tracing" .Values.tracing }} {{- end }} {{- toYaml (merge $existingData $newData) | nindent 4 }}