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 b841857a chore: support customize docker repository name (#1958)
b841857a is described below

commit b841857aae8d7d749ffa6d416dd3ebf71866b8ec
Author: Fucheng Jiang <[email protected]>
AuthorDate: Sat Oct 7 14:12:37 2023 +0800

    chore: support customize docker repository name (#1958)
---
 .github/workflows/e2e-test-ci-v2-cron-dev.yml | 2 +-
 .github/workflows/e2e-test-ci-v2-cron.yml     | 2 +-
 .github/workflows/e2e-test-ci.yml             | 2 +-
 .github/workflows/k8s-timer-ci.yml            | 2 +-
 Makefile                                      | 6 ++++--
 test/e2e/suite-annotations/websocket.go       | 4 ++--
 test/e2e/suite-features/websocket.go          | 2 +-
 test/e2e/suite-gateway/gateway_httproute.go   | 2 +-
 utils/kind-with-registry.sh                   | 5 +++--
 9 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/e2e-test-ci-v2-cron-dev.yml 
b/.github/workflows/e2e-test-ci-v2-cron-dev.yml
index 787d632a..2875dbac 100644
--- a/.github/workflows/e2e-test-ci-v2-cron-dev.yml
+++ b/.github/workflows/e2e-test-ci-v2-cron-dev.yml
@@ -99,7 +99,7 @@ jobs:
           APISIX_ADMIN_API_VERSION: "v3"
           TAG: dev
           ARCH: amd64
-          REGISTRY: localhost:5000
+          REGISTRY: 127.0.0.1:5000
           ENABLE_PROXY: "false"
         run: |
           echo "building images..."
diff --git a/.github/workflows/e2e-test-ci-v2-cron.yml 
b/.github/workflows/e2e-test-ci-v2-cron.yml
index 36707fb3..8e576d7d 100644
--- a/.github/workflows/e2e-test-ci-v2-cron.yml
+++ b/.github/workflows/e2e-test-ci-v2-cron.yml
@@ -99,7 +99,7 @@ jobs:
           APISIX_ADMIN_API_VERSION: "v2"
           TAG: dev
           ARCH: amd64
-          REGISTRY: localhost:5000
+          REGISTRY: 127.0.0.1:5000
           ENABLE_PROXY: "false"
         run: |
           echo "building images..."
diff --git a/.github/workflows/e2e-test-ci.yml 
b/.github/workflows/e2e-test-ci.yml
index 96e10eb8..a827edbb 100644
--- a/.github/workflows/e2e-test-ci.yml
+++ b/.github/workflows/e2e-test-ci.yml
@@ -100,7 +100,7 @@ jobs:
         env:
           TAG: dev
           ARCH: amd64
-          REGISTRY: localhost:5000
+          REGISTRY: 127.0.0.1:5000
           ENABLE_PROXY: "false"
         run: |
           echo "building images..."
diff --git a/.github/workflows/k8s-timer-ci.yml 
b/.github/workflows/k8s-timer-ci.yml
index c4f8925f..28cd9e2b 100644
--- a/.github/workflows/k8s-timer-ci.yml
+++ b/.github/workflows/k8s-timer-ci.yml
@@ -89,7 +89,7 @@ jobs:
         env:
           TAG: dev
           ARCH: amd64
-          REGISTRY: localhost:5000
+          REGISTRY: 127.0.0.1:5000
           ENABLE_PROXY: "false"
         run: |
           echo "building images..."
diff --git a/Makefile b/Makefile
index cc756667..55975ca0 100644
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,9 @@ ifeq ($(APISIX_ADMIN_API_VERSION),"v2")
 endif
 
 RELEASE_SRC = apache-apisix-ingress-controller-${VERSION}-src
+REPOSITORY="127.0.0.1"
 REGISTRY_PORT ?= "5000"
-REGISTRY ?="localhost:$(REGISTRY_PORT)"
+REGISTRY ?="${REPOSITORY}:$(REGISTRY_PORT)"
 IMAGE_TAG ?= dev
 ENABLE_PROXY ?= true
 
@@ -171,7 +172,8 @@ uninstall:
 ### kind-up:              Launch a Kubernetes cluster with a image registry by 
Kind.
 .PHONY: kind-up
 kind-up:
-       ./utils/kind-with-registry.sh $(REGISTRY_PORT)
+       REPOSITORY=${REPOSITORY} ./utils/kind-with-registry.sh $(REGISTRY_PORT)
+
 ### kind-reset:           Delete the Kubernetes cluster created by "make 
kind-up"
 .PHONY: kind-reset
 kind-reset:
diff --git a/test/e2e/suite-annotations/websocket.go 
b/test/e2e/suite-annotations/websocket.go
index 71d1ab25..462de332 100644
--- a/test/e2e/suite-annotations/websocket.go
+++ b/test/e2e/suite-annotations/websocket.go
@@ -57,7 +57,7 @@ spec:
     protocol: TCP
     targetPort: 8080
 `
-               err := s.CreateResourceFromString(resources)
+               err := s.CreateResourceFromString(s.FormatRegistry(resources))
                assert.Nil(ginkgo.GinkgoT(), err)
                time.Sleep(5 * time.Second)
 
@@ -143,7 +143,7 @@ spec:
     protocol: TCP
     targetPort: 8080
 `
-               err := s.CreateResourceFromString(resources)
+               err := s.CreateResourceFromString(s.FormatRegistry(resources))
                assert.Nil(ginkgo.GinkgoT(), err)
                time.Sleep(5 * time.Second)
 
diff --git a/test/e2e/suite-features/websocket.go 
b/test/e2e/suite-features/websocket.go
index 723a86ad..7ba93a20 100644
--- a/test/e2e/suite-features/websocket.go
+++ b/test/e2e/suite-features/websocket.go
@@ -58,7 +58,7 @@ spec:
     protocol: TCP
     targetPort: 8080
 `
-                       err := s.CreateResourceFromString(resources)
+                       err := 
s.CreateResourceFromString(s.FormatRegistry(resources))
                        assert.Nil(ginkgo.GinkgoT(), err)
                        time.Sleep(5 * time.Second)
 
diff --git a/test/e2e/suite-gateway/gateway_httproute.go 
b/test/e2e/suite-gateway/gateway_httproute.go
index 4f8be8b3..78d18968 100644
--- a/test/e2e/suite-gateway/gateway_httproute.go
+++ b/test/e2e/suite-gateway/gateway_httproute.go
@@ -395,7 +395,7 @@ spec:
     protocol: TCP
     targetPort: 8080
 `
-               assert.Nil(ginkgo.GinkgoT(), s.CreateResourceFromString(echo), 
"creating echo server")
+               assert.Nil(ginkgo.GinkgoT(), 
s.CreateResourceFromString(s.FormatRegistry(echo)), "creating echo server")
 
                httproute := fmt.Sprintf(`
 apiVersion: gateway.networking.k8s.io/v1beta1
diff --git a/utils/kind-with-registry.sh b/utils/kind-with-registry.sh
index 90631102..c4bed7e5 100755
--- a/utils/kind-with-registry.sh
+++ b/utils/kind-with-registry.sh
@@ -23,6 +23,7 @@ set -o pipefail
 # desired cluster name; default is "apisix"
 KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-apisix}"
 
K8S_VERSION=${K8S_VERSION:-v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6}
+REPOSITORY=${REPOSITORY:-localhost}
 
 if kind get clusters | grep -q ^apisix$ ; then
   echo "cluster already exists, moving on"
@@ -66,12 +67,12 @@ nodes:
 - role: worker
 containerdConfigPatches:
 - |-
-  
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
+  
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REPOSITORY}:${reg_port}"]
     endpoint = ["http://${reg_host}:5000";]
 EOF
 
 for node in $(kind get nodes --name "${KIND_CLUSTER_NAME}"); do
-  kubectl annotate node "${node}" tilt.dev/registry=localhost:${reg_port};
+  kubectl annotate node "${node}" tilt.dev/registry=${REPOSITORY}:${reg_port};
 done
 
 if [ "${kind_network}" != "bridge" ]; then

Reply via email to