-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add attachedcluater e2e test #594
Merged
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
330429e
add attachedcluater e2e test
LiZhenCheng9527 84d9716
change kurator clusters exist wait time
LiZhenCheng9527 320a72f
add install cert-manager and fluxcd
LiZhenCheng9527 9d15200
use go code to write kurator e2e test
LiZhenCheng9527 b10a840
use commit ID as the VERSION
LiZhenCheng9527 6558d00
fix create kurator-host cluster timeout
LiZhenCheng9527 851e93a
Added script to create two clusters as e2e test environments
LiZhenCheng9527 1bb3d78
Scoping for go test in pkg and cmd
LiZhenCheng9527 31f126f
fix Fixed kurator-member.config file path error
LiZhenCheng9527 fe94542
add fleet status check and delete resource when finish e2e test
LiZhenCheng9527 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: E2E | ||
on: | ||
pull_request: | ||
jobs: | ||
e2e-test: | ||
runs-on: ubuntu-22.04 | ||
name: E2E Test | ||
timeout-minutes: 40 | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.x | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Build Clusters | ||
uses: helm/[email protected] | ||
with: | ||
version: v0.18.0 | ||
install_only: true | ||
- name: Set Up Clusters | ||
run: | | ||
hack/local-dev-setup.sh | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: v3.10.1 | ||
- name: Init kurator cluster | ||
run: | | ||
hack/e2e-test/install.sh | ||
- name: fleet-clusters e2e test | ||
run: | | ||
hack/e2e-test/fleet-clusters/e2e-run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
KUBECONFIG_PATH=${KUBECONFIG_PATH:-"${HOME}/.kube"} | ||
MAIN_KUBECONFIG=${MAIN_KUBECONFIG:-"${KUBECONFIG_PATH}/kurator-host.config"} | ||
export KUBECONFIG=${MAIN_KUBECONFIG} | ||
|
||
kubectl create secret generic kurator-member1 --from-file=kurator-member1.config=${KUBECONFIG_PATH}/kurator-member1.config | ||
kubectl create secret generic kurator-member2 --from-file=kurator-member2.config=${KUBECONFIG_PATH}/kurator-member2.config | ||
|
||
cat <<EOF | kubectl apply -f - | ||
apiVersion: cluster.kurator.dev/v1alpha1 | ||
kind: AttachedCluster | ||
metadata: | ||
name: kurator-member1 | ||
namespace: default | ||
spec: | ||
kubeconfig: | ||
name: kurator-member1 | ||
key: kurator-member1.config | ||
EOF | ||
|
||
ok=false | ||
sleep 10 | ||
kubectl get attachedclusters.cluster.kurator.dev kurator-member1 -o yaml | grep 'ready: true' && ok=true || ok=false | ||
if [ ${ok} = false ]; then | ||
echo "create attachedCluster member1 resources failed" | ||
exit 1 | ||
fi | ||
|
||
cat <<EOF | kubectl apply -f - | ||
apiVersion: cluster.kurator.dev/v1alpha1 | ||
kind: AttachedCluster | ||
metadata: | ||
name: kurator-member2 | ||
namespace: default | ||
spec: | ||
kubeconfig: | ||
name: kurator-member2 | ||
key: kurator-member2.config | ||
EOF | ||
|
||
ok=false | ||
sleep 5 | ||
kubectl get attachedclusters.cluster.kurator.dev kurator-member1 -o yaml | grep 'ready: true' && ok=true || ok=false | ||
if [ ${ok} = false ]; then | ||
echo "create attachedCluster member2 resources failed" | ||
exit 1 | ||
fi | ||
|
||
cat <<EOF | kubectl apply -f - | ||
apiVersion: fleet.kurator.dev/v1alpha1 | ||
kind: Fleet | ||
metadata: | ||
name: quickstart | ||
namespace: default | ||
spec: | ||
clusters: | ||
# add your AttachedCluster here | ||
- name: kurator-member1 | ||
kind: AttachedCluster | ||
- name: kurator-member2 | ||
kind: AttachedCluster | ||
EOF | ||
|
||
sleep 5 | ||
|
||
ok=false | ||
kubectl get fleet | grep 'Ready' && ok=true || ok=false | ||
if [ ${ok} = false ]; then | ||
echo "create Fleet resources failed" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
|
||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
"$DIR"/attachedcluster.sh | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# This script installs Kurator cluster-operater and fleet-manager. | ||
|
||
KUBECONFIG_PATH=${KUBECONFIG_PATH:-"${HOME}/.kube"} | ||
MAIN_KUBECONFIG=${MAIN_KUBECONFIG:-"${KUBECONFIG_PATH}/kurator-host.config"} | ||
export KUBECONFIG=${MAIN_KUBECONFIG} | ||
VERSION=${VERSION:-"0.95.27"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change to using the commit id |
||
|
||
sleep 5s | ||
|
||
VERSION=${VERSION} make docker | ||
kind load docker-image ghcr.io/kurator-dev/cluster-operator:${VERSION} --name kurator-host | ||
kind load docker-image ghcr.io/kurator-dev/fleet-manager:${VERSION} --name kurator-host | ||
|
||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo update | ||
kubectl create namespace cert-manager | ||
helm install -n cert-manager cert-manager jetstack/cert-manager --set installCRDs=true | ||
|
||
helm repo add fluxcd-community https://fluxcd-community.github.io/helm-charts | ||
cat <<EOF | helm install fluxcd fluxcd-community/flux2 --version 2.7.0 -n fluxcd-system --create-namespace -f - | ||
imageAutomationController: | ||
create: false | ||
imageReflectionController: | ||
create: false | ||
notificationController: | ||
create: false | ||
EOF | ||
|
||
sleep 5s | ||
|
||
VERSION=${VERSION} make gen-chart | ||
cd out/charts | ||
helm install --create-namespace kurator-cluster-operator cluster-operator-${VERSION}.tgz -n kurator-system | ||
helm install --create-namespace kurator-fleet-manager fleet-manager-${VERSION}.tgz -n kurator-system | ||
|
||
echo "install kurator successful" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use go code to write it