Skip to content

Commit

Permalink
Add git workflow for a test that submits a k8s job
Browse files Browse the repository at this point in the history
Signed-off-by: Shinae Woo <[email protected]>
  • Loading branch information
shinae-woo committed May 16, 2024
1 parent a6f0d0c commit fea509a
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/test_k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Test k8s

on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
push:
branches:
- main

env:
KWOK_REPO: kubernetes-sigs/kwok
KWOK_LATEST_RELEASE: v0.5.2

jobs:
test-k8s:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: make build

- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.14.4

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1

- name: Install KWOK node simulator
run: |
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml"
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml"
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-init-container-running-failed.yaml
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-container-running-failed.yaml
kubectl apply -f charts/overrides/kwok/pod-complete.yml
- name: Add virtual nodes to the cluster
run: |
helm install virtual-nodes charts/virtual-nodes -f charts/virtual-nodes/values-example.yaml
kubectl get nodes
- name: Run knavigator with an example test
run: |
kubectl create ns k8s-test
./bin/knavigator -tasks resources/tests/k8s/test-job.yml
kubectl get job -n k8s-test

0 comments on commit fea509a

Please sign in to comment.