Skip to content

Commit

Permalink
Run cluster-class e2e test in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Apr 24, 2024
1 parent 1de53ae commit 486a5fe
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ jobs:
- uses: actions/checkout@v4
- name: Test
run: just test-unit
test-e2e:
runs-on: ubuntu-latest
steps:
- name: Install just
uses: extractions/setup-just@v2
- name: Install kind
uses: helm/kind-action@v1
with:
install_only: true
- uses: actions/checkout@v4
- name: Test
run: just test-cluster-class-import
30 changes: 27 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ ORG := "ghcr.io/rancher-sandbox"
TAG := "dev"
HOME_DIR := env_var('HOME')
YQ_VERSION := "v4.43.1"
CLUSTERCTL_VERSION := "v1.7.1"
YQ_BIN := "_out/yq"
OUT_DIR := "_out"
KOPIUM_BIN := "_out/bin/kopium"
KUSTOMIZE_VERSION := "v5.4.1"
KUSTOMIZE_BIN := "_out/kustomize"
CLUSTERCTL_BIN := "_out/clusterctl"
ARCH := if arch() == "aarch64" { "arm64"} else { "amd64" }
DIST := os()

Expand Down Expand Up @@ -97,10 +99,14 @@ stop-dev:
deploy-crs:
kubectl --context kind-dev apply -f testdata/crs.yaml

# Deploy child cluster using docker & kubead,
# Deploy child cluster using docker & kubeadm
deploy-child-cluster:
kubectl --context kind-dev apply -f testdata/cluster_docker_kcp.yaml

# Deploy child cluster-call based cluster using docker & kubeadm
deploy-child-cluster-class:
kubectl --context kind-dev apply -f testdata/capi-quickstart.yaml

# Add and update helm repos used
update-helm-repos:
#helm repo add gitea-charts https://dl.gitea.com/charts/
Expand All @@ -120,8 +126,8 @@ install-fleet: _create-out-dir
helm install --create-namespace -n cattle-fleet-system --set apiServerURL=$API_SERVER_URL --set-file apiServerCA=_out/ca.pem fleet fleet/fleet --wait
# Install cluster api and any providers
install-capi:
EXP_CLUSTER_RESOURCE_SET=true CLUSTER_TOPOLOGY=true clusterctl init -i docker
install-capi: _download-clusterctl
EXP_CLUSTER_RESOURCE_SET=true CLUSTER_TOPOLOGY=true {{CLUSTERCTL_BIN}} init -i docker

# Deploy will deploy the operator
deploy: _download-kustomize load-base
Expand All @@ -138,6 +144,12 @@ test-import: start-dev deploy deploy-child-cluster deploy-crs
kubectl wait pods --for=condition=Ready --timeout=300s --all --all-namespaces
kubectl wait clusters.fleet.cattle.io --timeout=300s --for=condition=Imported docker-demo

# Full e2e test of importing cluster in fleet
test-cluster-class-import: start-dev deploy deploy-child-cluster-class deploy-crs
kubectl wait pods --for=condition=Ready --timeout=300s --all --all-namespaces
kubectl wait clustergroups.fleet.cattle.io --timeout=300s --for=jsonpath='{.status.clusterCount}=1' quick-start
kubectl wait clusters.fleet.cattle.io --timeout=300s --for=condition=Imported capi-quickstart

# Install kopium
[private]
_install-kopium:
Expand All @@ -152,6 +164,18 @@ _download-kustomize:
tar -xzf {{KUSTOMIZE_BIN}}.tar.gz -C _out
chmod +x {{KUSTOMIZE_BIN}}

[private]
[linux]
_download-clusterctl:
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/{{CLUSTERCTL_VERSION}}/clusterctl-linux-amd64 -o {{CLUSTERCTL_BIN}}
chmod +x {{CLUSTERCTL_BIN}}

[private]
[macos]
_download-clusterctl:
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/{{CLUSTERCTL_VERSION}}/clusterctl-darwin-amd64 -o {{CLUSTERCTL_BIN}}
chmod +x {{CLUSTERCTL_BIN}}

# Download yq
[private]
[linux]
Expand Down

0 comments on commit 486a5fe

Please sign in to comment.