Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Dec 26, 2022
1 parent d995247 commit b82d61c
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

workflow_dispatch:

jobs:
test:
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ matrix.kube-version }}
cancel-in-progress: true

# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
strategy:
fail-fast: false
matrix:
kube-release:
- 1.23

continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install conntrack
run: |
sudo apt update
sudo apt install -y conntrack
# Install Kubernetes use apt source with specified version
- name: Install Kubernetes
run: |
sudo snap install kubelet --channel=${{ matrix.kube-release }}/stable --classic
sudo snap install kubectl --channel=${{ matrix.kube-release }}/stable --classic
sudo snap install kubeadm --channel=${{ matrix.kube-release }}/stable --classic
wget -O crictl-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/v${{ matrix.kube-release }}.0/crictl-v${{ matrix.kube-release }}.0-linux-amd64.tar.gz && \
sudo tar zxvf crictl-linux-amd64.tar.gz -C /usr/local/bin && \
rm -f crictl-linux-amd64.tar.gz
- name: Swap off
run: |
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
- name: Start Kubelet
run: |
sudo wget -O /etc/systemd/system/kubelet.service https://github.com/kubernetes/release/raw/master/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service
sudo mkdir /etc/systemd/system/kubelet.service.d/
sudo wget -O /etc/systemd/system/kubelet.service.d/10-kubeadm.conf https://github.com/kubernetes/release/raw/master/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf
sudo echo 'KUBELET_KUBEADM_ARGS=""' > /var/lib/kubelet/kubeadm-flags.env
sudo systemctl daemon-reload
sudo systemctl restart kubelet
sudo journalctl -u kubelet
sudo systemctl status kubelet
- name: Initialize Kubernetes
run: |
sudo kubeadm init || {
journalctl -xeu kubelet
exit 1
}
- name: Setup kubeconfig
run: |
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
- name: Get pods
run: |
kubectl get pods -o wide --all-namespaces
- name: Get nodes
run: |
kubectl get nodes -o wide

0 comments on commit b82d61c

Please sign in to comment.