From 564f8c770a7b509d35eda432816e7fb831c46d2b Mon Sep 17 00:00:00 2001 From: Se7en Date: Fri, 9 Aug 2024 08:29:51 +0800 Subject: [PATCH] fix: fix tracing configmap template to handle initial installation (#1191) --- helm/core/templates/_helpers.tpl | 2 +- helm/core/templates/configmap.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 }}