Skip to content
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

Dev scripts use same docker network #3205

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/scripts/register-downstream-clusters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ctx=$(kubectl config current-context)
# hardcoded token, cluster is ephemeral and private
token="token-ci:zfllcbdr4677rkj4hmlr8rsmljg87l7874882928khlfs2pmmcq7l5"

user=$(kubectl get users -o go-template='{{range .items }}{{.metadata.name}}{{"\n"}}{{end}}' | tail -1)
user=$(kubectl get users -l authz.management.cattle.io/bootstrapping=admin-user -o go-template='{{range .items }}{{.metadata.name}}{{"\n"}}{{end}}' | tail -1)
sed "s/user-zvnsr/$user/" <<'EOF' | kubectl apply -f -
apiVersion: management.cattle.io/v3
kind: Token
Expand Down Expand Up @@ -42,10 +42,8 @@ rancher clusters create second --import
until rancher cluster ls --format json | jq -r 'select(.Name=="second") | .ID' | grep -Eq "c-[a-z0-9]" ; do sleep 1; done
id=$( rancher cluster ls --format json | jq -r 'select(.Name=="second") | .ID' )

until rancher cluster import "$id" | grep -q curl; do sleep 1; done
kubectl config use-context "$cluster_downstream"
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user $user

until [ -n "$(rancher cluster import "$id" | grep curl)" ]; do sleep 1; done
rancher cluster import "$id" | grep curl | sh

until rancher cluster ls --format json | jq -r 'select(.Name=="second") | .Cluster.state' | grep -q active; do
Expand Down
5 changes: 3 additions & 2 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export FLEET_E2E_CLUSTER_DOWNSTREAM=k3d-upstream

# running multi-cluster tests in k3d (setup-k3d;setup-k3ds-downstream)
export FLEET_E2E_CLUSTER=k3d-upstream
export FLEET_E2E_CLUSTER_DOWNSTREAM=k3d-downstream
export FLEET_E2E_CLUSTER_DOWNSTREAM=k3d-downstream1

# for running tests on darwin/arm64
export GOARCH=arm64
Expand Down Expand Up @@ -222,11 +222,12 @@ The local infra setup creates pods for:
To build and run the infra setup command do:

```
dev/import-images-tests-k3d
# ./dev/create-zot-certs 'FleetCI-RootCA'
pushd e2e/testenv/infra
go build
popd
./e2e/testenv/infra/infra setup

```

The resulting deployments use a loadbalancer service, which means the host must be able to reach the loadbalancer IP.
Expand Down
2 changes: 1 addition & 1 deletion dev/env.multi-cluster-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export FLEET_E2E_NS=fleet-local
export FLEET_E2E_NS_DOWNSTREAM=fleet-default

export FLEET_E2E_CLUSTER=k3d-upstream
export FLEET_E2E_CLUSTER_DOWNSTREAM=k3d-downstream
export FLEET_E2E_CLUSTER_DOWNSTREAM=k3d-downstream1

export GIT_HTTP_USER=fleet-ci
export GIT_HTTP_PASSWORD=foo
Expand Down
2 changes: 1 addition & 1 deletion dev/import-images-k3d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euxo pipefail
upstream_ctx="${FLEET_E2E_CLUSTER-k3d-upstream}"

# The single downstream cluster to import the agent image to.
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream1}"

# If multi-cluster is enabled, import the agent image to all downstream clusters.
FLEET_E2E_DS_CLUSTER_COUNT="${FLEET_E2E_DS_CLUSTER_COUNT:-1}"
Expand Down
2 changes: 1 addition & 1 deletion dev/remove-fleet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Warning: do not use this script on a production system!

upstream_ctx="${FLEET_E2E_CLUSTER-k3d-upstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream1}"

ctx=$(kubectl config current-context)

Expand Down
2 changes: 1 addition & 1 deletion dev/setup-fleet-downstream
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ ! -d ./charts/fleet ]; then
fi

upstream_ctx="${FLEET_E2E_CLUSTER-k3d-upstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream1}"
ns="${FLEET_E2E_NS_DOWNSTREAM-fleet-local}"

kubectl create ns "$ns"|| true
Expand Down
2 changes: 1 addition & 1 deletion dev/setup-k3d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euxo pipefail
# https://hub.docker.com/r/rancher/k3s/tags
# k3d_args="-i docker.io/rancher/k3s:v1.22.15-k3s1"

args=${k3d_args-}
args=${k3d_args---network fleet}
docker_mirror=${docker_mirror-}
unique_api_port=${unique_api_port-36443}
unique_tls_port=${unique_tls_port-443}
Expand Down
2 changes: 1 addition & 1 deletion dev/setup-rancher-clusters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

public_hostname="${public_hostname-172.18.0.1.sslip.io}"
upstream_ctx="${FLEET_E2E_CLUSTER-k3d-upstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream1}"
rancherpassword="${RANCHER_PASSWORD-rancherpassword}"

version="${1-}"
Expand Down
3 changes: 2 additions & 1 deletion dev/setup-rancher-with-dev-fleet
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ip=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalanc
#fi

helm repo update
helm install cert-manager jetstack/cert-manager \
helm upgrade --install cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--set crds.enabled=true \
Expand Down Expand Up @@ -63,6 +63,7 @@ until kubectl get bundles -n fleet-local | grep -q "fleet-agent-local.*1/1"; do
helm list -A

export public_hostname=$ip.sslip.io
export cluster_downstream="k3d-downstream1"

./.github/scripts/wait-for-loadbalancer.sh
./.github/scripts/register-downstream-clusters.sh
Loading