Skip to content

Commit

Permalink
add e2e ci for kubernetes with kind
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Liang <[email protected]>
  • Loading branch information
liangyuanpeng committed Aug 18, 2023
1 parent 7ec7abb commit ecdc88d
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/kind.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail


wget -q https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-linux-amd64
chmod +x kind-linux-amd64 && mv kind-linux-amd64 /usr/local/bin/kind

K8SVERSION=${K8SVERSION:-"v1.25.3"}
WORKSPACE=$PWD

sed -i 's/K8SVERSION/'$K8SVERSION'/g' $WORKSPACE/.github/scripts/kind.yaml
sed -i 's#WORKSPACE#'$WORKSPACE'#g' $WORKSPACE/.github/scripts/kind.yaml
kind create cluster --config $WORKSPACE/.github/scripts/kind.yaml
kubectl wait node --all --for condition=ready
17 changes: 17 additions & 0 deletions .github/scripts/kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:K8SVERSION
extraMounts:
- hostPath: /tmp/kind
containerPath: /var/log
- hostPath: WORKSPACE/.github/scripts/xline.yaml
containerPath: /etc/kubernetes/manifests/xline.yaml
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
etcd:
external:
endpoints:
- http://xline:2379
20 changes: 20 additions & 0 deletions .github/scripts/xline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: xline
namespace: kube-system
spec:
containers:
- name: xline
image: datenlord/xline:latest
imagePullPolicy: IfNotPresent
env:
- name: RUST_LOG
value: debug
command:
- /bin/sh
- -c
- xline --name node1 --members node1=172.18.0.2:12379 --data-dir /tmp/xline --storage-engine rocksdb
hostNetwork: true
status: {}
40 changes: 40 additions & 0 deletions .github/workflows/kube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: e2e

on:
schedule:
- cron: "00 * * * *" # run ci periodically at 3 am
push: #enabled after the API is stable
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
kube:
name: e2e_kube
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
k8s:
- v1.25.3
- v1.26.0
- v1.27.3
steps:
- uses: actions/checkout@v2
- name: work with kubernetes
env:
K8SVERSION: ${{ matrix.k8s }}
run: |
./.github/scripts/kind.sh
- name: chmod
if: always()
run: |
sudo chmod -R 777 /tmp/kind
ls /tmp/kind
- name: upload kind logs
if: always()
uses: actions/upload-artifact@v3
with:
name: xline_kind_log_${{ matrix.k8s }}
path: /tmp/kind/

0 comments on commit ecdc88d

Please sign in to comment.