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

fix: fix the kind join script #890

Merged
merged 2 commits into from
Jul 26, 2024
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
11 changes: 6 additions & 5 deletions docs/getting-started/kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ export REGISTRY="mcr.microsoft.com/aks/fleet"
export FLEET_VERSION=$(curl "https://api.github.com/repos/Azure/fleet/tags" | jq -r '.[0].name')
export HUB_AGENT_IMAGE="hub-agent"

# Clone the Fleet repository from GitHub.
# Clone the Fleet repository from GitHub if not already done.
git clone https://github.com/Azure/fleet.git
cd fleet

# Install the helm chart for running Fleet agents on the hub cluster.
helm install hub-agent fleet/charts/hub-agent/ \
helm install hub-agent ./charts/hub-agent/ \
--set image.pullPolicy=Always \
--set image.repository=$REGISTRY/$HUB_AGENT_IMAGE \
--set image.tag=$FLEET_VERSION \
--set logVerbosity=2 \
--set logVerbosity=5 \
--set namespace=fleet-system \
--set enableWebhook=true \
--set webhookClientConnectionType=service \
Expand Down Expand Up @@ -123,8 +124,8 @@ export HUB_CLUSTER_ADDRESS="https://$(docker inspect $HUB_CLUSTER-control-plane
export MEMBER_CLUSTER_CONTEXT=kind-$MEMBER_CLUSTER

# Run the script.
chmod +x fleet/hack/membership/join.sh
./fleet/hack/membership/join.sh
chmod +x ./hack/membership/join.sh
./hack/membership/join.sh
```

It may take a few minutes for the script to finish running. Once it is completed, verify
Expand Down
9 changes: 5 additions & 4 deletions docs/getting-started/on-prem.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ export HUB_AGENT_IMAGE="hub-agent"

# Clone the Fleet repository from GitHub.
git clone https://github.com/Azure/fleet.git
cd fleet

# Install the helm chart for running Fleet agents on the hub cluster.
helm install hub-agent fleet/charts/hub-agent/ \
helm install hub-agent ./charts/hub-agent/ \
--set image.pullPolicy=Always \
--set image.repository=$REGISTRY/$HUB_AGENT_IMAGE \
--set image.tag=$FLEET_VERSION \
--set logVerbosity=2 \
--set logVerbosity=5 \
--set namespace=fleet-system \
--set enableWebhook=true \
--set webhookClientConnectionType=service \
Expand Down Expand Up @@ -107,8 +108,8 @@ export MEMBER_CLUSTER=YOUR-MEMBER-CLUSTER
export MEMBER_CLUSTER_CONTEXT=YOUR-MEMBER-CLUSTER-CONTEXT

# Run the script.
chmod +x fleet/hack/membership/join.sh
./fleet/hack/membership/join.sh
chmod +x ./hack/Azure/setup/joinMC.sh
./hack/Azure/setup/joinMC.sh
```

It may take a few minutes for the script to finish running. Once it is completed, verify
Expand Down
20 changes: 14 additions & 6 deletions hack/membership/join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ FLEET_VERSION="${FLEET_VERSION:-$(curl "https://api.github.com/repos/Azure/fleet
MEMBER_AGENT_IMAGE="${MEMBER_AGENT_NAME:-member-agent}"
REFRESH_TOKEN_IMAGE="${REFRESH_TOKEN_NAME:-refresh-token}"

echo "Preparing to join a cluster into a fleet..."
echo "docker pull images and load to kind"
docker image pull --platform linux/amd64 $REGISTRY/$MEMBER_AGENT_IMAGE:$FLEET_VERSION
docker image pull --platform linux/amd64 $REGISTRY/$REFRESH_TOKEN_IMAGE:$FLEET_VERSION
kind load docker-image --name $MEMBER_CLUSTER $REGISTRY/$MEMBER_AGENT_IMAGE:$FLEET_VERSION
kind load docker-image --name $MEMBER_CLUSTER $REGISTRY/$REFRESH_TOKEN_IMAGE:$FLEET_VERSION

echo "Preparing to join a cluster into a fleet..."
kubectl config use-context $HUB_CLUSTER_CONTEXT

echo "Setting up a service account..."

export SERVICE_ACCOUNT="$MEMBER_CLUSTER-hub-cluster-access"
kubectl delete serviceaccount $SERVICE_ACCOUNT -n fleet-system --ignore-not-found
kubectl create serviceaccount $SERVICE_ACCOUNT -n fleet-system

echo "Creating a secret..."
Expand Down Expand Up @@ -101,23 +107,25 @@ spec:
kind: ServiceAccount
namespace: fleet-system
apiGroup: ""
heartbeatPeriodSeconds: 60
heartbeatPeriodSeconds: 15
EOF

echo "Installing the member agent..."

kubectl config use-context $MEMBER_CLUSTER_CONTEXT
kubectl delete secret hub-kubeconfig-secret --ignore-not-found --wait
kubectl create secret generic hub-kubeconfig-secret --from-literal=token=$TOKEN
helm install member-agent fleet/charts/member-agent/ \
helm uninstall member-agent --ignore-not-found --wait
helm install member-agent charts/member-agent/ \
--set config.hubURL=$HUB_CLUSTER_ADDRESS \
--set image.repository=$REGISTRY/$MEMBER_AGENT_IMAGE \
--set image.tag=$FLEET_VERSION \
--set image.pullPolicy=Never \
--set refreshtoken.repository=$REGISTRY/$REFRESH_TOKEN_IMAGE \
--set refreshtoken.tag=$FLEET_VERSION \
--set image.pullPolicy=Always \
--set refreshtoken.pullPolicy=Always \
--set refreshtoken.pullPolicy=Never \
--set config.memberClusterName="$MEMBER_CLUSTER" \
--set logVerbosity=5 \
--set logVerbosity=6 \
--set namespace=fleet-system \
--set enableV1Alpha1APIs=false \
--set enableV1Beta1APIs=true
Loading