Skip to content

Commit a5e2a9b

Browse files
committed
Strict patch
1 parent d2d944e commit a5e2a9b

14 files changed

+558
-24
lines changed

.github/workflows/build-snap.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Build and test MicroK8s snap
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
4+
- push
75

86
jobs:
97
build:
@@ -58,7 +56,7 @@ jobs:
5856
path: build
5957
- name: Running upgrade path test
6058
run: |
61-
sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
59+
sudo -E STRICT=yes UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
6260
6361
test-addons-core:
6462
name: Test core addons
@@ -81,13 +79,15 @@ jobs:
8179
with:
8280
name: microk8s.snap
8381
path: build
84-
- name: Running addons tests
82+
- name: Running addons tests in strict mode
8583
run: |
8684
set -x
87-
sudo snap install build/microk8s.snap --classic --dangerous
85+
sudo snap install build/microk8s.snap --dangerous
86+
sudo /snap/microk8s/current/connect-all-interfaces.sh
87+
sudo microk8s status --wait-ready --timeout 300
8888
./tests/smoke-test.sh
8989
export UNDER_TIME_PRESSURE="True"
90-
export SKIP_PROMETHEUS="False"
90+
export STRICT="yes"
9191
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py"
9292
9393
test-addons-community:
@@ -117,8 +117,11 @@ jobs:
117117
run: |
118118
set -x
119119
sudo snap install build/microk8s.snap --classic --dangerous
120+
sudo /snap/microk8s/current/connect-all-interfaces.sh
121+
sudo microk8s status --wait-ready --timeout 300
120122
sudo microk8s enable community
121123
export UNDER_TIME_PRESSURE="True"
124+
export STRICT="yes"
122125
sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/; pytest -s -ra ./tests/"
123126
124127
test-addons-core-upgrade:
@@ -148,7 +151,8 @@ jobs:
148151
run: |
149152
set -x
150153
export UNDER_TIME_PRESSURE="True"
151-
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
154+
export STRICT="yes"
155+
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
152156
153157
test-cluster-agent:
154158
name: Cluster agent health check
@@ -173,6 +177,7 @@ jobs:
173177
run: |
174178
set -x
175179
sudo snap install build/microk8s.snap --classic --dangerous
180+
sudo /snap/microk8s/current/connect-all-interfaces.sh
176181
sudo -E bash -c "pytest -s ./tests/test-cluster-agent.py"
177182
178183
test-airgap:

docs/build.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,16 @@ lxc file pull test-build/root/microk8s/microk8s_v1.9.6_amd64.snap .
8383
After copying it, you can install it with:
8484

8585
```shell
86-
snap install microk8s_*_amd64.snap --classic --dangerous
86+
snap install microk8s_*_amd64.snap --dangerous
8787
```
8888

89+
Finally, you need to connect the interfaces. To this end you can use the `connect-all-interfaces.sh`:
90+
91+
```shell
92+
sudo /snap/microk8s/current/connect-all-interfaces.sh
93+
```
94+
95+
8996
## Assembling the Calico CNI manifest
9097

9198
The calico CNI manifest can be found under `upgrade-scripts/000-switch-to-calico/resources/calico.yaml`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -u
4+
5+
if [ "$EUID" -ne 0 ]
6+
then echo "Please run this script as root."
7+
exit 1
8+
fi
9+
10+
for i in account-control \
11+
docker-privileged \
12+
kubernetes-support \
13+
k8s-journald \
14+
k8s-kubelet \
15+
k8s-kubeproxy \
16+
dot-kube \
17+
network \
18+
network-bind \
19+
network-control \
20+
network-observe \
21+
firewall-control \
22+
process-control \
23+
kernel-module-observe \
24+
mount-observe \
25+
hardware-observe \
26+
system-observe \
27+
home \
28+
opengl \
29+
home-read-all \
30+
login-session-observe \
31+
log-observe \
32+
dot-config-helm
33+
do
34+
snap connect microk8s:$i
35+
done

snap/hooks/connect-plug-configuration

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
5+
cp "$SNAP/content-interface/launcher/configuration/"*.yaml "$SNAP_COMMON/etc/launcher/" || true
6+
cp "$SNAP/content-interface/launcher/sideload/"*.tar "$SNAP_COMMON/etc/sideload/" || true
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux

snap/hooks/install

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ if ! is_strict && cat /proc/1/environ | grep "container=lxc" &> /dev/null
2525
fi
2626
fi
2727

28-
cp -r --preserve=mode ${SNAP}/default-args ${SNAP_DATA}/args
28+
mkdir -p ${SNAP_DATA}/args
29+
cp -r --preserve=mode ${SNAP}/default-args/* ${SNAP_DATA}/args
2930
mv ${SNAP_DATA}/args/certs.d/localhost__32000 ${SNAP_DATA}/args/certs.d/localhost:32000
3031

3132
SNAP_DATA_CURRENT=`echo "${SNAP_DATA}" | sed -e "s,${SNAP_REVISION},current,"`

0 commit comments

Comments
 (0)