Skip to content

Commit

Permalink
Add e2e for karmadactl init
Browse files Browse the repository at this point in the history
Signed-off-by: jwcesign <[email protected]>
  • Loading branch information
jwcesign committed Mar 15, 2023
1 parent e523977 commit 0988b7e
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
82 changes: 82 additions & 0 deletions .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CLI
on:
# Run this workflow every time a new commit pushed to upstream/fork repository.
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
push:
pull_request:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
init:
name: init
runs-on: ubuntu-20.04
strategy:
matrix:
# Here support the latest three minor releases of Kubernetes, this can be considered to be roughly
# the same as the End of Life of the Kubernetes release: https://kubernetes.io/releases/
# Please remember to update the CI Schedule Workflow when we add a new version.
k8s: [ v1.24.2, v1.25.0, v1.26.0 ]
steps:
- name: checkout code
uses: actions/checkout@v3
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# We need to guess version via git tags.
fetch-depth: 0
- name: install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.5
- uses: engineerd/[email protected]
with:
version: "v0.17.0"
- name: build cli
run: |
set -x
# tar the newest crds
cd charts/karmada/
cp -r _crds crds
tar -zcvf ../../crds.tar.gz crds
cd -
# prepare karmadactl
make karmadactl
cp _output/bin/linux/amd64/karmadactl /usr/local/bin/
- name: run karmadactl init test
run: |
set -x
source hack/util.sh
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
# create host/member1/member2 cluster
hack/create-cluster.sh host $HOME/.kube/host.config > /dev/null 2>&1 &
hack/create-cluster.sh member1 $HOME/.kube/member1.config > /dev/null 2>&1 &
hack/create-cluster.sh member2 $HOME/.kube/member2.config > /dev/null 2>&1 &
# wait cluster ready
util::wait_file_exist $HOME/.kube/host.config 300
util::wait_file_exist $HOME/.kube/member1.config 300
util::wait_file_exist $HOME/.kube/member2.config 300
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${HOME}/.kube/host.config
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${HOME}/.kube/member1.config
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${HOME}/.kube/member2.config
# init Karmada control plane
karmadactl init --kubeconfig=${HOME}/.kube/host.config \
--karmada-data=${HOME}/karmada \
--karmada-pki=${HOME}/karmada/pki \
--crds='./crds.tar.gz'
# join cluster
karmadactl --kubeconfig ${HOME}/karmada/karmada-apiserver.config join member1 --cluster-kubeconfig=${HOME}/.kube/member1.config
karmadactl --kubeconfig ${HOME}/karmada/karmada-apiserver.config join member2 --cluster-kubeconfig=${HOME}/.kube/member2.config
kubectl wait --for=condition=Ready clusters --all --timeout=800s --kubeconfig=${HOME}/karmada/karmada-apiserver.config
# run a single e2e
export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo
ginkgo -v --race --trace -p --focus="deployment propagation testing" ./test/e2e/
1 change: 0 additions & 1 deletion artifacts/kindClusterConfig/general-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ networking:
serviceSubnet: {{service_cidr}}
nodes:
- role: control-plane
- role: worker

0 comments on commit 0988b7e

Please sign in to comment.