You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2022/08/13 06:18:31 UTC
[apisix-helm-chart] branch master updated: feat: Allow `fullnameOverride`s to work correctly (#316)
This is an automated email from the ASF dual-hosted git repository.
zhangjintao 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 f2b3d51 feat: Allow `fullnameOverride`s to work correctly (#316)
f2b3d51 is described below
commit f2b3d5173287b226f7f444927bd0ec646d6a91aa
Author: Nassos Michas <na...@me.com>
AuthorDate: Sat Aug 13 09:18:26 2022 +0300
feat: Allow `fullnameOverride`s to work correctly (#316)
---
.gitignore | 1 +
charts/apisix-ingress-controller/templates/configmap.yaml | 4 ++++
charts/apisix-ingress-controller/templates/deployment.yaml | 5 +++++
charts/apisix-ingress-controller/values.yaml | 2 ++
charts/apisix/templates/configmap.yaml | 4 ++++
charts/apisix/templates/daemonset.yaml | 4 ++++
charts/apisix/templates/deployment.yaml | 4 ++++
docs/en/latest/apisix-ingress-controller.md | 2 ++
8 files changed, 26 insertions(+)
diff --git a/.gitignore b/.gitignore
index dcee972..084301c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.idea/
.DS_Store
test_**.yaml
+.history
\ No newline at end of file
diff --git a/charts/apisix-ingress-controller/templates/configmap.yaml b/charts/apisix-ingress-controller/templates/configmap.yaml
index f861d58..2380117 100644
--- a/charts/apisix-ingress-controller/templates/configmap.yaml
+++ b/charts/apisix-ingress-controller/templates/configmap.yaml
@@ -55,7 +55,11 @@ data:
apisix_route_version: {{ .Values.config.kubernetes.apisixRouteVersion | quote }}
enable_gateway_api: {{ .Values.config.kubernetes.enableGatewayAPI }}
apisix:
+ {{ if .Values.config.apisix.serviceFullname }}
+ default_cluster_base_url: http://{{ .Values.config.apisix.serviceFullname }}:{{ .Values.config.apisix.servicePort }}/apisix/admin
+ {{ else }}
default_cluster_base_url: http://{{ .Values.config.apisix.serviceName }}.{{ .Values.config.apisix.serviceNamespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.config.apisix.servicePort }}/apisix/admin
+ {{ end}}
default_cluster_admin_key: {{ .Values.config.apisix.adminKey | quote }}
default_cluster_name: {{ .Values.config.apisix.clusterName | quote }}
kind: ConfigMap
diff --git a/charts/apisix-ingress-controller/templates/deployment.yaml b/charts/apisix-ingress-controller/templates/deployment.yaml
index 7f809b6..2d983a1 100644
--- a/charts/apisix-ingress-controller/templates/deployment.yaml
+++ b/charts/apisix-ingress-controller/templates/deployment.yaml
@@ -55,7 +55,12 @@ spec:
initContainers:
- name: wait-apisix-admin
image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
+ {{ if .Values.config.apisix.serviceFullname }}
+ command: ['sh', '-c', "until nc -z {{ .Values.config.apisix.serviceFullname }} {{ .Values.config.apisix.servicePort }} ; do echo waiting for apisix-admin; sleep 2; done;"]
+ {{ else }}
command: ['sh', '-c', "until nc -z {{ .Values.config.apisix.serviceName }}.{{ .Values.config.apisix.serviceNamespace }}.svc.{{ .Values.clusterDomain }} {{ .Values.config.apisix.servicePort }} ; do echo waiting for apisix-admin; sleep 2; done;"]
+ {{ end}}
+
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
containers:
diff --git a/charts/apisix-ingress-controller/values.yaml b/charts/apisix-ingress-controller/values.yaml
index ad0ee8b..456e108 100644
--- a/charts/apisix-ingress-controller/values.yaml
+++ b/charts/apisix-ingress-controller/values.yaml
@@ -122,6 +122,8 @@ config:
enableGatewayAPI: false
# APISIX related configurations.
apisix:
+ # Enabling this value, overrides serviceName and serviceNamespace.
+ # serviceFullname: "apisix-admin.apisix.svc.local"
serviceName: apisix-admin
serviceNamespace: ingress-apisix
servicePort: 9180
diff --git a/charts/apisix/templates/configmap.yaml b/charts/apisix/templates/configmap.yaml
index ab36473..f7e272a 100644
--- a/charts/apisix/templates/configmap.yaml
+++ b/charts/apisix/templates/configmap.yaml
@@ -214,7 +214,11 @@ data:
etcd:
{{- 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 }}"
+ {{- else }}
- "http://{{ .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.
{{- range $value := .Values.etcd.host }}
diff --git a/charts/apisix/templates/daemonset.yaml b/charts/apisix/templates/daemonset.yaml
index f68d8d4..cc4f894 100644
--- a/charts/apisix/templates/daemonset.yaml
+++ b/charts/apisix/templates/daemonset.yaml
@@ -143,7 +143,11 @@ spec:
initContainers:
- name: wait-etcd
image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
+ {{- if .Values.etcd.fullnameOverride }}
+ command: ['sh', '-c', "until nc -z {{ .Values.etcd.fullnameOverride }} {{ .Values.etcd.service.port }}; do echo waiting for etcd `date`; sleep 2; done;"]
+ {{ else }}
command: ['sh', '-c', "until nc -z {{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }} {{ .Values.etcd.service.port }}; do echo waiting for etcd `date`; sleep 2; done;"]
+ {{- end }}
{{- end }}
volumes:
- configMap:
diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/deployment.yaml
index c1fa1c2..c6afc3c 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/deployment.yaml
@@ -154,7 +154,11 @@ spec:
initContainers:
- name: wait-etcd
image: {{ .Values.initContainer.image }}:{{ .Values.initContainer.tag }}
+ {{- if .Values.etcd.fullnameOverride }}
+ command: ['sh', '-c', "until nc -z {{ .Values.etcd.fullnameOverride }} {{ .Values.etcd.service.port }}; do echo waiting for etcd `date`; sleep 2; done;"]
+ {{- else }}
command: ['sh', '-c', "until nc -z {{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.etcd.clusterDomain }} {{ .Values.etcd.service.port }}; do echo waiting for etcd `date`; sleep 2; done;"]
+ {{- end }}
{{- end }}
volumes:
- configMap:
diff --git a/docs/en/latest/apisix-ingress-controller.md b/docs/en/latest/apisix-ingress-controller.md
index 06a326b..1510066 100644
--- a/docs/en/latest/apisix-ingress-controller.md
+++ b/docs/en/latest/apisix-ingress-controller.md
@@ -37,6 +37,8 @@ helm repo update
helm install apisix-ingress-controller apisix/apisix-ingress-controller --namespace ingress-apisix --create-namespace
```
+Note: APISIX Ingress Controller will try to establish a connection with APISIX admin in the location specified by `apisix.serviceName` and `apisix.serviceNamespace` values following the naming convention `<serviceName.serviceNamespace.svc.clusterDomain>`. You can override this behavior to specify a fully custom location by setting the `apisix.serviceFullname` value.
+
## Uninstall
To uninstall/delete the `apisix-ingress-controller` release: