Skip to content

Commit 7e49226

Browse files
authored
Merge pull request #11 from Bregor/features/cni/registry-proxy
Enable registry-proxy for CNI users
2 parents 26a2ffe + 4cc19e2 commit 7e49226

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

charts/registry-proxy/templates/registry-proxy-daemon.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ spec:
1919
heritage: deis
2020
app: deis-registry-proxy
2121
spec:
22+
{{- if (.Values.global.use_cni) }}
23+
hostNetwork: true
24+
{{- end}}
2225
containers:
2326
- name: deis-registry-proxy
2427
image: quay.io/{{.Values.org}}/registry-proxy:{{.Values.docker_tag}}
@@ -38,7 +41,15 @@ spec:
3841
value: $(DEIS_REGISTRY_SERVICE_HOST)
3942
- name: REGISTRY_PORT
4043
value: $(DEIS_REGISTRY_SERVICE_PORT)
44+
- name: BIND_ADDR
45+
{{- if (.Values.global.use_cni) }}
46+
value: {{ default "127.0.0.1:5555" .Values.global.registry_proxy_bind_addr | quote }}
47+
{{- else }}
48+
value: {{ default "80" .Values.global.registry_proxy_bind_addr | quote }}
49+
{{- end }}
50+
{{- if not (.Values.global.use_cni) }}
4151
ports:
4252
- containerPort: 80
4353
hostPort: {{.Values.global.host_port}}
4454
{{- end }}
55+
{{- end }}

charts/registry-proxy/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,13 @@ global:
1515
registry_location: "on-cluster"
1616
# The host port to which registry proxy binds to
1717
host_port: 5555
18+
# Set the `listen` variable for registry-proxy's NGINX
19+
#
20+
# Valid values are:
21+
# - 80: If you're on flannel or kubenet
22+
# - 127.0.0.1:5555: If you're with CNI
23+
#
24+
# In case of CNI you can not use `hostPort` notation due to https://github.com/kubernetes/kubernetes/issues/23920
25+
# registry_proxy_bind_addr: "80"
26+
# If the Kubernetes cluster uses CNI
27+
# use_cni: true

rootfs/bin/boot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# fail if no hostname is provided
44
REGISTRY_HOST=${REGISTRY_HOST:?no host}
55
REGISTRY_PORT=${REGISTRY_PORT:-80}
6+
BIND_ADDR=${BIND_ADDR:-80}
67

78
# we are always listening on port 80
89
# https://github.com/nginxinc/docker-nginx/blob/43c112100750cbd1e9f2160324c64988e7920ac9/stable/jessie/Dockerfile#L25
9-
PORT=80
1010

1111
sed -e "s/%HOST%/$REGISTRY_HOST/g" \
1212
-e "s/%PORT%/$REGISTRY_PORT/g" \
13-
-e "s/%BIND_PORT%/$PORT/g" \
13+
-e "s/%BIND_PORT%/$BIND_ADDR/g" \
1414
</etc/nginx/conf.d/default.conf.in >/etc/nginx/conf.d/default.conf
1515

1616
# wait for registry to come online

0 commit comments

Comments
 (0)