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 612de1e  feat: add initContainer for apisix-ingress-controller (#143)
612de1e is described below

commit 612de1ec52093894ed31571ff68f6338a0b34384
Author: kv <[email protected]>
AuthorDate: Thu Oct 21 10:10:01 2021 +0800

    feat: add initContainer for apisix-ingress-controller (#143)
    
    Co-authored-by: Jintao Zhang <[email protected]>
    Co-authored-by: Alex Zhang <[email protected]>
---
 .github/workflows/release.yaml                             | 1 +
 charts/apisix-ingress-controller/templates/configmap.yaml  | 2 +-
 charts/apisix-ingress-controller/templates/deployment.yaml | 4 ++++
 charts/apisix-ingress-controller/values.yaml               | 9 ++++++++-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index aba75a2..877f501 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -36,3 +36,4 @@ jobs:
           charts_dir: .
         env:
           CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+          CR_SKIP_EXISTING: true
diff --git a/charts/apisix-ingress-controller/templates/configmap.yaml 
b/charts/apisix-ingress-controller/templates/configmap.yaml
index 86fd021..8b7450d 100644
--- a/charts/apisix-ingress-controller/templates/configmap.yaml
+++ b/charts/apisix-ingress-controller/templates/configmap.yaml
@@ -35,7 +35,7 @@ data:
       ingress_version: {{ .Values.config.kubernetes.ingressVersion | quote }}
       apisix_route_version: {{ .Values.config.kubernetes.apisixRouteVersion | 
quote }}
     apisix:
-      base_url: {{ .Values.config.apisix.baseURL | quote }}
+      base_url: http://{{ .Values.config.apisix.serviceName }}.{{ 
.Values.config.apisix.serviceNamespace }}.svc.{{ .Values.clusterDomain }}:{{ 
.Values.config.apisix.servicePort }}/apisix/admin
       admin_key: {{ .Values.config.apisix.adminKey | quote }}
 kind: ConfigMap
 metadata:
diff --git a/charts/apisix-ingress-controller/templates/deployment.yaml 
b/charts/apisix-ingress-controller/templates/deployment.yaml
index c87a5ff..93db4d3 100644
--- a/charts/apisix-ingress-controller/templates/deployment.yaml
+++ b/charts/apisix-ingress-controller/templates/deployment.yaml
@@ -46,6 +46,10 @@ spec:
             items:
               - key: config.yaml
                 path: config.yaml
+      initContainers:
+        - name: wait-apisix-admin
+          image: {{ .Values.initContainer.image }}:{{ 
.Values.initContainer.tag }}
+          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;"]
       containers:
         - name: {{ .Chart.Name }}
           command:
diff --git a/charts/apisix-ingress-controller/values.yaml 
b/charts/apisix-ingress-controller/values.yaml
index 6de288b..f58e7e0 100644
--- a/charts/apisix-ingress-controller/values.yaml
+++ b/charts/apisix-ingress-controller/values.yaml
@@ -45,6 +45,7 @@ image:
   tag: "1.3.0"
 
 imagePullSecrets: []
+clusterDomain: cluster.local
 
 service:
   port: 80
@@ -96,11 +97,17 @@ config:
     apisixRouteVersion: "apisix.apache.org/v2beta1"
   # APISIX related configurations.
   apisix:
-    baseURL: "http://apisix-admin:9180/apisix/admin";
+    serviceName: apisix-admin
+    serviceNamespace: ingress-apisix
+    servicePort: 9180
     adminKey: "edd1c9f034335f136f87ad84b625c8f1"
 
 resources: {}
 
+initContainer:
+  image: busybox
+  tag: 1.28
+
 autoscaling:
   enabled: false
   minReplicas: 1

Reply via email to