You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2022/10/18 09:27:20 UTC

[apisix-helm-chart] branch master updated: fix: use https scheme when etcd.auth.tls.enabled (#372)

This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new fdd19c9  fix: use https scheme when etcd.auth.tls.enabled (#372)
fdd19c9 is described below

commit fdd19c935466462fb2b670fe5774b6373e6e330a
Author: hadican <ab...@gmail.com>
AuthorDate: Tue Oct 18 12:27:14 2022 +0300

    fix: use https scheme when etcd.auth.tls.enabled (#372)
    
    Co-authored-by: Abdulhadi Celenlioglu <ab...@intenseye.com>
---
 charts/apisix/templates/_helpers.tpl   | 11 +++++++++++
 charts/apisix/templates/configmap.yaml |  8 ++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/charts/apisix/templates/_helpers.tpl b/charts/apisix/templates/_helpers.tpl
index 181e5ee..c3c2fb0 100644
--- a/charts/apisix/templates/_helpers.tpl
+++ b/charts/apisix/templates/_helpers.tpl
@@ -96,3 +96,14 @@ prometheus:
 {{- define "apisix.pluginAttrs" -}}
 {{- merge .Values.pluginAttrs (include "apisix.basePluginAttrs" . | fromYaml) | toYaml -}}
 {{- end -}}
+
+{{/*
+Scheme to use while connecting etcd
+*/}}
+{{- define "apisix.etcd.auth.scheme" -}}
+{{- if .Values.etcd.auth.tls.enabled }}
+{{- "https" }}
+{{- else }}
+{{- "http" }}
+{{- end }}
+{{- end }}
diff --git a/charts/apisix/templates/configmap.yaml b/charts/apisix/templates/configmap.yaml
index 03eb3c0..ffe2b86 100644
--- a/charts/apisix/templates/configmap.yaml
+++ b/charts/apisix/templates/configmap.yaml
@@ -278,9 +278,9 @@ data:
         {{- if .Values.etcd.enabled }}
           host:                                 # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
             {{- if .Values.etcd.fullnameOverride }}
-            - "http://{{ .Values.etcd.fullnameOverride }}:{{ .Values.etcd.service.port }}"
+            - "{{ include "apisix.etcd.auth.scheme" . }}://{{ .Values.etcd.fullnameOverride }}:{{ .Values.etcd.service.port }}"
             {{- else }}
-            - "http://{{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }}:{{ .Values.etcd.service.port }}"
+            - "{{ include "apisix.etcd.auth.scheme" . }}://{{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }}:{{ .Values.etcd.service.port }}"
             {{- end}}
         {{- else }}
           host:                                 # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
@@ -499,9 +499,9 @@ data:
       {{- if .Values.etcd.enabled }}
         host:                                 # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
           {{- if .Values.etcd.fullnameOverride }}
-          - "http://{{ .Values.etcd.fullnameOverride }}:{{ .Values.etcd.service.port }}"
+          - "{{ include "apisix.etcd.auth.scheme" . }}://{{ .Values.etcd.fullnameOverride }}:{{ .Values.etcd.service.port }}"
           {{- else }}
-          - "http://{{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }}:{{ .Values.etcd.service.port }}"
+          - "{{ include "apisix.etcd.auth.scheme" . }}://{{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }}:{{ .Values.etcd.service.port }}"
           {{- end}}
       {{- else }}
         host:                                 # it's possible to define multiple etcd hosts addresses of the same etcd cluster.