Skip to content

Commit 41486f3

Browse files
committed
Add dind/pink CI test.yml scenario (requires registry)
1 parent ee4876b commit 41486f3

File tree

5 files changed

+121
-3
lines changed

5 files changed

+121
-3
lines changed

.github/workflows/test.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
- main
5656
- auth
5757
- helm
58+
test-variation:
59+
- ""
5860
include:
5961
# Chart.yaml contains the chart's oldest supported k8s version, we
6062
# test against that and the oldest known supported helm cli version
@@ -70,19 +72,56 @@ jobs:
7072
# upgrade-from represents a release channel, see: https://jupyterhub.github.io/helm-chart/info.json
7173
upgrade-from: dev
7274
upgrade-from-extra-args: ""
75+
- k3s-channel: v1.25
76+
test: helm
77+
test-variation: dind
78+
local-chart-extra-args: >-
79+
--values testing/k8s-binder-k8s-hub/binderhub-chart+dind.yaml
80+
--set config.BinderHub.image_prefix=$REGISTRY_HOST/test/
81+
--set registry.url=http://$REGISTRY_HOST
82+
- k3s-channel: v1.25
83+
test: helm
84+
test-variation: pink
85+
local-chart-extra-args: >-
86+
--values testing/k8s-binder-k8s-hub/binderhub-chart+pink.yaml
87+
--set config.BinderHub.image_prefix=$REGISTRY_HOST/test/
88+
--set registry.url=http://$REGISTRY_HOST
89+
90+
services:
91+
registry:
92+
image: docker.io/library/registry:latest
93+
ports:
94+
- 5000:5000
95+
7396
steps:
7497
- uses: actions/checkout@v3
7598
with:
7699
# chartpress requires the full history
77100
fetch-depth: 0
78101

102+
- name: Set registry host
103+
if: matrix.test-variation == 'dind' || matrix.test-variation == 'pink'
104+
run: |
105+
REGISTRY_HOST=$(hostname -I | awk '{print $1}'):5000
106+
echo REGISTRY_HOST="$REGISTRY_HOST" >> $GITHUB_ENV
107+
108+
# Allow k3s to pull from private registry
109+
# https://docs.k3s.io/installation/private-registry
110+
sudo mkdir -p /etc/rancher/k3s/
111+
cat << EOF | sudo tee /etc/rancher/k3s/registries.yaml
112+
mirrors:
113+
"$REGISTRY_HOST":
114+
endpoint:
115+
- "http://$REGISTRY_HOST"
116+
EOF
117+
79118
- uses: jupyterhub/action-k3s-helm@v3
80119
with:
81120
k3s-channel: ${{ matrix.k3s-channel }}
82121
helm-version: ${{ matrix.helm-version }}
83122
metrics-enabled: false
84123
traefik-enabled: false
85-
docker-enabled: true
124+
docker-enabled: ${{ matrix.test-variation != 'dind' && matrix.test-variation != 'pink' }}
86125

87126
- name: Setup OS level dependencies
88127
run: |
@@ -145,9 +184,17 @@ jobs:
145184
run: |
146185
export DOCKER_BUILDKIT=1
147186
187+
CHARTPRESS_ARGS=
188+
if [ "${{ matrix.test-variation }}" = "dind" -o "${{ matrix.test-variation }}" = "pink" ]; then
189+
CHARTPRESS_ARGS="--image-prefix localhost:5000/binderhub- --push"
190+
191+
# Allow the pods to push to the non-https GitHub workflow registry
192+
envsubst < testing/k8s-binder-k8s-hub/cm-insecure-registries-${{ matrix.test-variation }}.yaml | kubectl apply -f -
193+
fi
194+
148195
# Use chartpress to create the helm chart and build its images
149196
helm dependency update ./helm-chart/binderhub
150-
(cd helm-chart && chartpress)
197+
(cd helm-chart && chartpress $CHARTPRESS_ARGS)
151198
git --no-pager diff --color=always
152199
153200
- name: Generate values.schema.json from schema.yaml
@@ -286,7 +333,12 @@ jobs:
286333
uses: jupyterhub/action-k8s-namespace-report@v1
287334
if: always()
288335
with:
289-
important-workloads: deploy/binder deploy/hub deploy/proxy
336+
important-workloads: >
337+
deploy/binder
338+
deploy/hub
339+
deploy/proxy
340+
daemonset/binderhub-test-dind
341+
daemonset/binderhub-test-pink
290342
291343
# GitHub action reference: https://github.com/codecov/codecov-action
292344
- name: Upload coverage stats
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Additional configuration for testing dind
2+
# You must create configmap/insecure-registries-dind first to allow testing with an
3+
# insecure http registry
4+
# https://docs.docker.com/registry/insecure/
5+
6+
config:
7+
BinderHub:
8+
use_registry: true
9+
10+
imageBuilderType: dind
11+
12+
dind:
13+
daemonset:
14+
extraVolumeMounts:
15+
- name: insecure-registries-dind
16+
mountPath: /etc/docker/daemon.json
17+
subPath: daemon.json
18+
extraVolumes:
19+
- name: insecure-registries-dind
20+
configMap:
21+
name: insecure-registries-dind
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Additional configuration for testing podman
2+
# You must create configmap/insecure-registries-pink first to allow testing with an
3+
# insecure http registry
4+
5+
config:
6+
BinderHub:
7+
use_registry: true
8+
9+
imageBuilderType: pink
10+
11+
pink:
12+
daemonset:
13+
extraArgs:
14+
- --log-level=debug
15+
extraVolumeMounts:
16+
- name: insecure-registries-pink
17+
mountPath: /etc/containers/registries.conf.d/100-insecure-registries-pink.conf
18+
subPath: 100-insecure-registries-pink.conf
19+
extraVolumes:
20+
- name: insecure-registries-pink
21+
configMap:
22+
name: insecure-registries-pink
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# REGISTRY_HOST='HOST:PORT' envsubst < cm-insecure-registries-dind.yaml | kubectl apply -f -
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: insecure-registries-dind
6+
data:
7+
daemon.json: |
8+
{
9+
"insecure-registries": ["$REGISTRY_HOST"],
10+
"debug": true
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# REGISTRY_HOST='HOST:PORT' envsubst < cm-insecure-registries-pink.yaml | kubectl apply -f -
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: insecure-registries-pink
6+
data:
7+
100-insecure-registries-pink.conf: |
8+
# https://www.redhat.com/sysadmin/manage-container-registries
9+
unqualified-search-registries = ["docker.io"]
10+
[[registry]]
11+
location="$REGISTRY_HOST"
12+
insecure=true

0 commit comments

Comments
 (0)