Skip to content

Commit

Permalink
chore: support customize docker repository name (apache#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangfucheng authored Oct 7, 2023
1 parent d2b6f93 commit b841857
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-ci-v2-cron-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-ci-v2-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/k8s-timer-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/suite-annotations/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-features/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-gateway/gateway_httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions utils/kind-with-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b841857

Please sign in to comment.