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-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a8658d  fix: add initContainers to verify if apisix is ready (#660)
6a8658d is described below

commit 6a8658db1788c687c70c9f235601cc8224e0b38c
Author: kv <[email protected]>
AuthorDate: Sun Sep 5 09:00:18 2021 +0800

    fix: add initContainers to verify if apisix is ready (#660)
---
 Makefile                                 |  4 ++++
 docs/en/latest/practices/the-hard-way.md |  4 ++++
 pkg/api/validation/apisix_route_test.go  | 10 ++++++++++
 test/e2e/scaffold/ingress.go             |  6 +++++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8b4b4a1..1697554 100644
--- a/Makefile
+++ b/Makefile
@@ -104,6 +104,10 @@ ifeq ($(E2E_SKIP_BUILD), 0)
        docker pull jmalloc/echo-server:latest
        docker tag  jmalloc/echo-server:latest 
$(LOCAL_REGISTRY)/jmalloc/echo-server:latest
        docker push $(LOCAL_REGISTRY)/jmalloc/echo-server:latest
+
+       docker pull busybox:1.28
+       docker tag  busybox:1.28 $(LOCAL_REGISTRY)/busybox:1.28
+       docker push $(LOCAL_REGISTRY)/busybox:1.28
 endif
 
 ### kind-up:              Launch a Kubernetes cluster with a image registry by 
Kind.
diff --git a/docs/en/latest/practices/the-hard-way.md 
b/docs/en/latest/practices/the-hard-way.md
index 5442af6..5b990cb 100644
--- a/docs/en/latest/practices/the-hard-way.md
+++ b/docs/en/latest/practices/the-hard-way.md
@@ -750,6 +750,10 @@ spec:
             items:
               - key: config.yaml
                 path: config.yaml
+      initContainers:
+        - name: wait-apisix-admin
+          image: busybox:1.28
+          command: ['sh', '-c', "until nc -z 
apisix-service.apisix.svc.cluster.local 9180 ; do echo waiting for 
apisix-admin; sleep 2; done;"]
       containers:
         - name: ingress-controller
           command:
diff --git a/pkg/api/validation/apisix_route_test.go 
b/pkg/api/validation/apisix_route_test.go
index 2e01c0e..90a5e0a 100644
--- a/pkg/api/validation/apisix_route_test.go
+++ b/pkg/api/validation/apisix_route_test.go
@@ -41,6 +41,16 @@ func (c fakeSchemaClient) GetPluginSchema(ctx 
context.Context, name string) (*ap
        return nil, fmt.Errorf("can't find the plugin schema")
 }
 
+func (c fakeSchemaClient) GetRouteSchema(context.Context) (*api.Schema, error) 
{
+       return nil, nil
+}
+func (c fakeSchemaClient) GetUpstreamSchema(context.Context) (*api.Schema, 
error) {
+       return nil, nil
+}
+func (c fakeSchemaClient) GetConsumerSchema(context.Context) (*api.Schema, 
error) {
+       return nil, nil
+}
+
 func newFakeSchemaClient() apisix.Schema {
        testData := map[string]string{
                "api-breaker": 
`{"required":["break_response_code"],"$comment":"this is a mark for our 
injected plugin 
schema","type":"object","properties":{"healthy":{"properties":{"successes":{"minimum":1,"type":"integer","default":3},"http_statuses":{"items":{"minimum":200,"type":"integer","maximum":499},"uniqueItems":true,"type":"array","minItems":1,"default":[200]}},"type":"object","default":{"successes":3,"http_statuses":[200]}},"break_response_code":{"minimum":200,"type":"integer","maximum":599
 [...]
diff --git a/test/e2e/scaffold/ingress.go b/test/e2e/scaffold/ingress.go
index 85f448c..c31bfde 100644
--- a/test/e2e/scaffold/ingress.go
+++ b/test/e2e/scaffold/ingress.go
@@ -214,6 +214,10 @@ spec:
         app: ingress-apisix-controller-deployment-e2e-test
     spec:
       terminationGracePeriodSeconds: 0
+      initContainers:
+      - name: wait-apisix-admin
+        image: localhost:5000/busybox:1.28
+        command: ['sh', '-c', "until nc -z 
apisix-service-e2e-test.%s.svc.cluster.local 9180 ; do echo waiting for 
apisix-admin; sleep 2; done;"]
       containers:
         - livenessProbe:
             failureThreshold: 3
@@ -343,7 +347,7 @@ func (s *Scaffold) newIngressAPISIXController() error {
                assert.Nil(s.t, err, "deleting ClusterRole")
        })
 
-       ingressAPISIXDeployment := 
fmt.Sprintf(_ingressAPISIXDeploymentTemplate, s.opts.IngressAPISIXReplicas, 
s.namespace, s.opts.APISIXRouteVersion, _webhookCertSecret)
+       ingressAPISIXDeployment := 
fmt.Sprintf(_ingressAPISIXDeploymentTemplate, s.opts.IngressAPISIXReplicas, 
s.namespace, s.namespace, s.opts.APISIXRouteVersion, _webhookCertSecret)
        err = k8s.KubectlApplyFromStringE(s.t, s.kubectlOptions, 
ingressAPISIXDeployment)
        assert.Nil(s.t, err, "create deployment")
 

Reply via email to