Skip to content

Commit 0c7c974

Browse files
ktsakalozosHomayoonAlimohammadi
authored andcommitted
Strict patch
1 parent edf41ff commit 0c7c974

File tree

14 files changed

+558
-24
lines changed

14 files changed

+558
-24
lines changed

.github/workflows/build-snap.yml

Lines changed: 13 additions & 8 deletions
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:
@@ -54,7 +52,7 @@ jobs:
5452
uses: ./.github/actions/test-prep
5553
- name: Running upgrade path test
5654
run: |
57-
sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
55+
sudo -E STRICT=yes UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
5856
5957
test-addons-core:
6058
name: Test core addons
@@ -69,18 +67,20 @@ jobs:
6967
uses: actions/checkout@v4
7068
- name: Prepare test prerequisites
7169
uses: ./.github/actions/test-prep
72-
- name: Running addons tests
70+
- name: Running addons tests in strict mode
7371
env:
7472
UNDER_TIME_PRESSURE: ${{ !contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}
7573
run: |
7674
set -x
77-
sudo snap install build/microk8s.snap --classic --dangerous
75+
sudo snap install build/microk8s.snap --dangerous
76+
sudo /snap/microk8s/current/connect-all-interfaces.sh
77+
sudo microk8s status --wait-ready --timeout 300
7878
./tests/smoke-test.sh
7979
# The GitHub runner is using the 10.1.0.0/16 CIDR, which would conflict with
8080
# kube-ovn's default POD_CIDR. They have to be different.
81+
export STRICT="yes"
8182
export POD_CIDR="10.200.0.0/16"
8283
export POD_GATEWAY="10.200.0.1"
83-
export SKIP_PROMETHEUS="False"
8484
export UNDER_TIME_PRESSURE=${UNDER_TIME_PRESSURE@u}
8585
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py"
8686
@@ -100,8 +100,11 @@ jobs:
100100
run: |
101101
set -x
102102
sudo snap install build/microk8s.snap --classic --dangerous
103+
sudo /snap/microk8s/current/connect-all-interfaces.sh
104+
sudo microk8s status --wait-ready --timeout 300
103105
sudo microk8s enable community
104106
export UNDER_TIME_PRESSURE=${UNDER_TIME_PRESSURE@u}
107+
export STRICT="yes"
105108
sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/; pytest -s -ra ./tests/"
106109
107110
test-addons-core-upgrade:
@@ -120,7 +123,8 @@ jobs:
120123
run: |
121124
set -x
122125
export UNDER_TIME_PRESSURE=${UNDER_TIME_PRESSURE@u}
123-
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
126+
export STRICT="yes"
127+
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
124128
125129
test-cluster-agent:
126130
name: Cluster agent health check
@@ -136,6 +140,7 @@ jobs:
136140
run: |
137141
set -x
138142
sudo snap install build/microk8s.snap --classic --dangerous
143+
sudo /snap/microk8s/current/connect-all-interfaces.sh
139144
sudo -E bash -c "pytest -s ./tests/test-cluster-agent.py"
140145
141146
test-airgap:

docs/build.md

Lines changed: 8 additions & 1 deletion
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`.
Lines changed: 35 additions & 0 deletions
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
Lines changed: 6 additions & 0 deletions
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
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux

snap/hooks/install

Lines changed: 2 additions & 1 deletion
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)