diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4a563f..449d295 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/justfile b/justfile index 0846449..46170a7 100644 --- a/justfile +++ b/justfile @@ -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() @@ -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/ @@ -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 @@ -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: @@ -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]