Skip to content

Commit

Permalink
Strict patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsakalozos committed Jul 21, 2023
1 parent 8f95bf3 commit 3ea12aa
Show file tree
Hide file tree
Showing 13 changed files with 544 additions and 22 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/build-snap.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build and test MicroK8s snap

on:
pull_request:
branches:
- master
- push

jobs:
build:
Expand Down Expand Up @@ -57,7 +55,7 @@ jobs:
path: build
- name: Running upgrade path test
run: |
sudo -E UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
sudo -E STRICT=yes UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade-path.py
test-addons-core:
name: Test core addons
Expand All @@ -80,13 +78,15 @@ jobs:
with:
name: microk8s.snap
path: build
- name: Running addons tests
- name: Running addons tests in strict mode
run: |
set -x
sudo snap install build/microk8s.snap --classic --dangerous
sudo snap install build/microk8s.snap --dangerous
sudo /snap/microk8s/current/connect-all-interfaces.sh
sudo microk8s status --wait-ready --timeout 300
./tests/smoke-test.sh
export UNDER_TIME_PRESSURE="True"
export SKIP_PROMETHEUS="False"
export STRICT="yes"
sudo -E bash -c "cd /var/snap/microk8s/common/addons/core/tests; pytest -s -ra test-addons.py"
test-addons-community:
Expand Down Expand Up @@ -114,7 +114,11 @@ jobs:
run: |
set -x
sudo snap install build/microk8s.snap --classic --dangerous
sudo /snap/microk8s/current/connect-all-interfaces.sh
sudo microk8s status --wait-ready --timeout 300
sudo microk8s enable community
export UNDER_TIME_PRESSURE="True"
export STRICT="yes"
sudo -E bash -c "cd /var/snap/microk8s/common/addons/community/; pytest -s -ra ./tests/"
test-addons-core-upgrade:
Expand Down Expand Up @@ -142,7 +146,8 @@ jobs:
run: |
set -x
export UNDER_TIME_PRESSURE="True"
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
export STRICT="yes"
sudo -E bash -c "UPGRADE_MICROK8S_FROM=latest/edge/strict UPGRADE_MICROK8S_TO=$PWD/build/microk8s.snap pytest -s ./tests/test-upgrade.py"
test-cluster-agent:
name: Cluster agent health check
Expand All @@ -167,6 +172,7 @@ jobs:
run: |
set -x
sudo snap install build/microk8s.snap --classic --dangerous
sudo /snap/microk8s/current/connect-all-interfaces.sh
sudo -E bash -c "pytest -s ./tests/test-cluster-agent.py"
test-airgap:
Expand Down
9 changes: 8 additions & 1 deletion docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,16 @@ lxc file pull test-build/root/microk8s/microk8s_v1.9.6_amd64.snap .
After copying it, you can install it with:

```shell
snap install microk8s_*_amd64.snap --classic --dangerous
sudo snap install microk8s_latest_amd64.snap --dangerous
```

Finally, you need to connect the interfaces. To this end you can use the `connect-all-interfaces.sh`:

```shell
sudo /snap/microk8s/current/connect-all-interfaces.sh
```


## Assembling the Calico CNI manifest

The calico CNI manifest can be found under `upgrade-scripts/000-switch-to-calico/resources/calico.yaml`.
Expand Down
35 changes: 35 additions & 0 deletions microk8s-resources/connect-all-interfaces.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -u

if [ "$EUID" -ne 0 ]
then echo "Please run this script as root."
exit 1
fi

for i in account-control \
docker-privileged \
kubernetes-support \
k8s-journald \
k8s-kubelet \
k8s-kubeproxy \
dot-kube \
network \
network-bind \
network-control \
network-observe \
firewall-control \
process-control \
kernel-module-observe \
mount-observe \
hardware-observe \
system-observe \
home \
opengl \
home-read-all \
login-session-observe \
log-observe \
dot-config-helm
do
snap connect microk8s:$i
done
6 changes: 6 additions & 0 deletions snap/hooks/connect-plug-configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -eux

cp "$SNAP/content-interface/launcher/configuration/"*.yaml "$SNAP_COMMON/etc/launcher/" || true
cp "$SNAP/content-interface/launcher/sideload/"*.tar "$SNAP_COMMON/etc/sideload/" || true
3 changes: 3 additions & 0 deletions snap/hooks/disconnect-plug-configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

set -eux
Loading

0 comments on commit 3ea12aa

Please sign in to comment.