Skip to content

Commit 23b7837

Browse files
authored
Merge pull request #1602 from manics/test-dind-pink
Test dind and pink
2 parents 3afb84c + ff061cb commit 23b7837

File tree

6 files changed

+121
-5
lines changed

6 files changed

+121
-5
lines changed

.github/workflows/test.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ jobs:
5454
test:
5555
- main
5656
- auth
57-
- helm
57+
test-variation:
58+
- ""
5859
include:
5960
# Chart.yaml contains the chart's oldest supported k8s version, we
6061
# test against that and the oldest known supported helm cli version
@@ -64,25 +65,60 @@ jobs:
6465
- k3s-channel: v1.20
6566
helm-version: v3.5.0
6667
test: helm
68+
test-variation: dind
69+
local-chart-extra-args: >-
70+
--values testing/k8s-binder-k8s-hub/binderhub-chart+dind.yaml
71+
--set config.BinderHub.image_prefix=$REGISTRY_HOST/test/
72+
--set registry.url=http://$REGISTRY_HOST
73+
- k3s-channel: latest
74+
test: helm
75+
test-variation: pink
76+
local-chart-extra-args: >-
77+
--values testing/k8s-binder-k8s-hub/binderhub-chart+pink.yaml
78+
--set config.BinderHub.image_prefix=$REGISTRY_HOST/test/
79+
--set registry.url=http://$REGISTRY_HOST
6780
- k3s-channel: latest
6881
test: helm
6982
test-variation: upgrade
7083
# upgrade-from represents a release channel, see: https://jupyterhub.github.io/helm-chart/info.json
7184
upgrade-from: dev
7285
upgrade-from-extra-args: ""
86+
87+
services:
88+
registry:
89+
image: docker.io/library/registry:latest
90+
ports:
91+
- 5000:5000
92+
7393
steps:
7494
- uses: actions/checkout@v3
7595
with:
7696
# chartpress requires the full history
7797
fetch-depth: 0
7898

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

87123
- name: Setup OS level dependencies
88124
run: |
@@ -145,9 +181,17 @@ jobs:
145181
run: |
146182
export DOCKER_BUILDKIT=1
147183
184+
CHARTPRESS_ARGS=
185+
if [ "${{ matrix.test-variation }}" = "dind" -o "${{ matrix.test-variation }}" = "pink" ]; then
186+
CHARTPRESS_ARGS="--image-prefix localhost:5000/binderhub- --push"
187+
188+
# Allow the pods to push to the non-https GitHub workflow registry
189+
envsubst < testing/k8s-binder-k8s-hub/cm-insecure-registries-${{ matrix.test-variation }}.yaml | kubectl apply -f -
190+
fi
191+
148192
# Use chartpress to create the helm chart and build its images
149193
helm dependency update ./helm-chart/binderhub
150-
(cd helm-chart && chartpress)
194+
(cd helm-chart && chartpress $CHARTPRESS_ARGS)
151195
git --no-pager diff --color=always
152196
153197
- name: Generate values.schema.json from schema.yaml
@@ -286,7 +330,12 @@ jobs:
286330
uses: jupyterhub/action-k8s-namespace-report@v1
287331
if: always()
288332
with:
289-
important-workloads: deploy/binder deploy/hub deploy/proxy
333+
important-workloads: >
334+
deploy/binder
335+
deploy/hub
336+
deploy/proxy
337+
daemonset/binderhub-test-dind
338+
daemonset/binderhub-test-pink
290339
291340
# GitHub action reference: https://github.com/codecov/codecov-action
292341
- 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

testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ ingress:
3838
# against which we haven't. We currently only test this through the use of
3939
# lint-and-validate-values.yaml and setting this value explicitly to make sure
4040
# our rendered templates are valid against a k8s api-server.
41-
imageBuilderType: "host"
41+
# This is already the default
42+
# imageBuilderType: "host"
4243

4344
# NOTE: This is a mirror of the jupyterhub section in
4445
# jupyterhub-chart-config.yaml in testing/local-binder-k8s-hub, keep these
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)