@@ -62,7 +62,7 @@ outputs:
6262 description : " Installed k8s version, such as v1.29.0"
6363 value : " ${{ steps.set-output.outputs.k8s-version }}"
6464 calico-version :
65- description : " Installed calico version, such as v3.27.3 "
65+ description : " Installed calico version, such as v3.28.1 "
6666 value : " ${{ steps.set-output.outputs.calico-version }}"
6767 helm-version :
6868 description : " Installed helm version, such as v3.13.0"
@@ -146,37 +146,30 @@ runs:
146146 shell : bash
147147
148148 # Install calico as a CNI to enforce our NetworkPolicies. Note that canal
149- # could do this job as well, but we failed to set it up in Travis CI.
150- #
151- # Below we download the calico.yaml Kubernetes manifest and insert a
152- # container_settings section just below the phrase '"type": "calico"' and
153- # then `kubectl apply` it.
149+ # could do this job as well.
154150 #
155151 # ref: https://rancher.com/docs/k3s/latest/en/installation/network-options/
156152 #
157- # With k3s 1.29 of recent versions, and calico v3.27.3, we have added
158- # DirectoryOrCreate to the hostPath volume to avoid
159- # https://github.com/jupyterhub/action-k3s-helm/issues/112. This is reported
160- # to calcio in https://github.com/projectcalico/calico/issues/8773, and
161- # could perhaps be closed if we bump to a calico version having resolve
162- # this.
163- #
164153 - name : Setup calico
165154 run : |
166155 echo "::group::Setup calico"
167- curl -sfL --output /tmp/calico.yaml https://raw.githubusercontent.com/projectcalico/calico/v3.27.3/manifests/calico.yaml
168- cat /tmp/calico.yaml \
169- | sed '/"type": "calico"/a\
170- "container_settings": {\
171- "allow_ip_forwarding": true\
172- },' \
173- | sed '/path: \/opt\/cni\/bin/a\
174- type: DirectoryOrCreate' \
175- | sed '/path: \/var\/run\/calico/a\
176- type: DirectoryOrCreate' \
177- | sed '/path: \/var\/lib\/calico/a\
178- type: DirectoryOrCreate' \
179- | kubectl apply -f -
156+ # Download calico.yaml k8s and split into separate manifests
157+ curl -sfL --output /tmp/calico.yaml https://raw.githubusercontent.com/projectcalico/calico/v3.28.1/manifests/calico.yaml
158+ mkdir calico
159+ cd calico
160+ yq -s '"\(.kind)-\(.metadata.name).yaml"' /tmp/calico.yaml
161+
162+ # Modify ConfigMap/calico-config: Look for `"type": "calico"` and add
163+ # `"container_settings": ...` on the next line
164+ sed -i.bak '/"type": "calico"/a\
165+ "container_settings": {"allow_ip_forwarding": true},'\
166+ ConfigMap-calico-config.yaml
167+
168+ for f in *.yaml.bak; do
169+ diff -u "$f" "${f%.bak}" || :
170+ done
171+
172+ cat ./*.yaml | kubectl apply -f -
180173 echo "::endgroup::"
181174 shell : bash
182175
0 commit comments