Skip to content

microk8s test strict #3

microk8s test strict

microk8s test strict #3

name: microk8s test strict
on:
workflow_dispatch:
jobs:
self-host:
name: self-hosted large
runs-on: [self-hosted, X64, edge, jammy]
strategy:
fail-fast: false
matrix:
index: [0, 1, 2]
steps:
- name: Set up microk8s
timeout-minutes: 5
run: |
sudo apt-get update
sudo apt-get install retry -y
sudo snap install microk8s --channel='1.31-strict/stable'
sudo adduser "$USER" 'snap_microk8s'
- name: (IS hosted) Configure microk8s Docker Hub mirror
timeout-minutes: 5
run: |
sudo tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml << EOF
server = "$DOCKERHUB_MIRROR"
[host."${DOCKERHUB_MIRROR#'https://'}"]
capabilities = ["pull", "resolve"]
EOF
sudo microk8s stop
sudo microk8s start
- name: Set up microk8s
id: microk8s-setup
timeout-minutes: 15
run: |
# `newgrp` does not work in GitHub Actions; use `sg` instead
sg 'snap_microk8s' -c "microk8s status --wait-ready"
sg 'snap_microk8s' -c "retry --times 3 --delay 5 -- sudo microk8s enable dns"
sg 'snap_microk8s' -c "microk8s status --wait-ready"
sg 'snap_microk8s' -c "microk8s.kubectl rollout status --namespace kube-system --watch --timeout=5m deployments/coredns"
sg 'snap_microk8s' -c "retry --times 3 --delay 5 -- sudo microk8s enable hostpath-storage"
sg 'snap_microk8s' -c "microk8s.kubectl rollout status --namespace kube-system --watch --timeout=5m deployments/hostpath-provisioner"
mkdir ~/.kube/
# Used by lightkube and kubernetes (Python package)
sg 'snap_microk8s' -c "microk8s config > ~/.kube/config"
- name: Test coredns
run: nslookup api.charmhub.io 10.152.183.10
- name: Setup tmate session
if: failure()
uses: canonical/action-tmate@main