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 Feb 20, 2023
1 parent e523977 commit df1cab8
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,87 @@ jobs:
with:
name: karmada_e2e_log_${{ matrix.k8s }}
path: ${{ github.workspace }}/karmada-e2e-logs/${{ matrix.k8s }}/
karmadactlinit:
name: karmadactl init installation test
needs: build
runs-on: ubuntu-20.04
strategy:
matrix:
k8s: [ v1.21.10, v1.22.7, v1.23.4, 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: run karmadactl init test
run: |
set -x
# tar the newest crds
cd charts/karmada/
cp -r _crds crds
tar -zcvf ../../crds.tar.gz crds
cd -
# prepare karmadactl and images
make karmadactl
cp _output/bin/linux/amd64/karmadactl /usr/local/bin/
export VERSION=ci-e2e
make images
# create host cluster and load images
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
kind create cluster --name host --kubeconfig=${HOME}/.kube/host.config --image="${CLUSTER_VERSION}"
kubectl wait --for=condition=Ready nodes --all --timeout=600s --kubeconfig=${HOME}/.kube/host.config
# replace ip in kubeconfig
container_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "host-control-plane")
kubectl config set-cluster "kind-host" --server="https://${container_ip}:6443" --kubeconfig=${HOME}/.kube/host.config
# load image to host plane
kind load docker-image karmada/karmada-aggregated-apiserver:ci-e2e --name host
kind load docker-image karmada/karmada-controller-manager:ci-e2e --name host
kind load docker-image karmada/karmada-scheduler:ci-e2e --name host
kind load docker-image karmada/karmada-webhook:ci-e2e --name host
# init Karmada control plane
karmadactl init --kubeconfig=${HOME}/.kube/host.config \
--karmada-data=${HOME}/karmada \
--karmada-pki=${HOME}/karmada/pki \
--crds='./crds.tar.gz' \
--karmada-aggregated-apiserver-image='karmada/karmada-aggregated-apiserver:ci-e2e' \
--karmada-controller-manager-image='karmada/karmada-controller-manager:ci-e2e' \
--karmada-scheduler-image='karmada/karmada-scheduler:ci-e2e' \
--karmada-webhook-image='karmada/karmada-webhook:ci-e2e'
# create member cluster
kind create cluster --name member1 --kubeconfig=${HOME}/.kube/member1.config --image="${CLUSTER_VERSION}"
kind create cluster --name member2 --kubeconfig=${HOME}/.kube/member2.config --image="${CLUSTER_VERSION}"
kubectl wait --for=condition=Ready nodes --all --timeout=600s --kubeconfig=${HOME}/.kube/member1.config
kubectl wait --for=condition=Ready nodes --all --timeout=600s --kubeconfig=${HOME}/.kube/member2.config
# replace ip in kubeconfig
container_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "member1-control-plane")
kubectl config set-cluster "kind-host" --server="https://${container_ip}:6443" --kubeconfig=${HOME}/.kube/member1.config
container_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "member2-control-plane")
kubectl config set-cluster "kind-host" --server="https://${container_ip}:6443" --kubeconfig=${HOME}/.kube/member2.config
# 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=600s --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/

0 comments on commit df1cab8

Please sign in to comment.