From 9734ffeb3e52760690019c9702e3c0b87c4b50bf Mon Sep 17 00:00:00 2001 From: Kent Dong Date: Sun, 21 May 2023 15:44:07 +0800 Subject: [PATCH] feat: Refactor skywalking configuration structure (#333) --- helm/core/templates/_helpers.tpl | 6 ++++++ helm/core/templates/configmap.yaml | 7 +++---- helm/core/templates/deployment.yaml | 6 +++--- helm/core/values.yaml | 9 +++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/helm/core/templates/_helpers.tpl b/helm/core/templates/_helpers.tpl index ceb713dad..392fd04ef 100644 --- a/helm/core/templates/_helpers.tpl +++ b/helm/core/templates/_helpers.tpl @@ -95,3 +95,9 @@ higress: {{ include "controller.name" . }} {{- print "first-party-jwt" }} {{- end }} {{- end }} + +{{- define "skywalking.enabled" -}} +{{- if and .Values.skywalking.enabled .Values.skywalking.service.address }} +true +{{- end }} +{{- end }} diff --git a/helm/core/templates/configmap.yaml b/helm/core/templates/configmap.yaml index 1eb9775e7..bd067a0f5 100644 --- a/helm/core/templates/configmap.yaml +++ b/helm/core/templates/configmap.yaml @@ -122,7 +122,7 @@ data: {{- include "mesh" . }} {{- end }} --- -{{- if .Values.enableSkywalking }} +{{- if include "skywalking.enabled" . }} apiVersion: v1 kind: ConfigMap metadata: @@ -154,7 +154,6 @@ data: "type": "LOGICAL_DNS", "connect_timeout": "5s", "http2_protocol_options": { - }, "dns_lookup_family": "V4_ONLY", "lb_policy": "ROUND_ROBIN", @@ -167,8 +166,8 @@ data: "endpoint": { "address": { "socket_address": { - "address": "{{ .Values.Skywalking.address }}", - "port_value": "{{ .Values.Skywalking.port }}" + "address": "{{ .Values.skywalking.service.address }}", + "port_value": "{{ .Values.skywalking.service.port }}" } } } diff --git a/helm/core/templates/deployment.yaml b/helm/core/templates/deployment.yaml index ad9bc02dd..2cb9cb593 100644 --- a/helm/core/templates/deployment.yaml +++ b/helm/core/templates/deployment.yaml @@ -146,7 +146,7 @@ spec: value: "{{ $.Values.clusterName | default `Kubernetes` }}" - name: INSTANCE_NAME value: "higress-gateway" - {{- if .Values.enableSkywalking }} + {{- if include "skywalking.enabled" . }} - name: ISTIO_BOOTSTRAP_OVERRIDE value: /etc/istio/custom-bootstrap/custom_bootstrap.json {{- end }} @@ -202,7 +202,7 @@ spec: mountPath: /etc/istio/pod - name: proxy-socket mountPath: /etc/istio/proxy - {{- if .Values.enableSkywalking }} + {{- if include "skywalking.enabled" . }} - mountPath: /etc/istio/custom-bootstrap name: custom-bootstrap-volume {{- end }} @@ -242,7 +242,7 @@ spec: - name: config configMap: name: higress-config - {{- if .Values.enableSkywalking }} + {{- if include "skywalking.enabled" . }} - configMap: defaultMode: 420 name: higress-custom-bootstrap diff --git a/helm/core/values.yaml b/helm/core/values.yaml index 42e0cb722..1c31ccb77 100644 --- a/helm/core/values.yaml +++ b/helm/core/values.yaml @@ -610,7 +610,8 @@ pilot: # Skywalking config settings -enableSkywalking: false -Skywalking: - address: "skywalking-oap.higress-system.svc" - port: 11800 +skywalking: + enabled: false + service: + address: ~ + port: 11800