Skip to content

Commit

Permalink
Override Kubernetes node when deploying Fleet to AKS/GKE (rancher#2571)
Browse files Browse the repository at this point in the history
This should prevent CI failures caused by nodes not being created by k3d
on those clusters.
  • Loading branch information
weyfonk authored Jul 2, 2024
1 parent 6f3749e commit b93e21e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/deploy-fleet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euxo pipefail

shards_json=${SHARDS-""}
node=${NODE-k3d-upstream-server-0}

function eventually {
for _ in $(seq 1 3); do
Expand All @@ -24,7 +25,7 @@ else
agentTag="dev"
fi

host=$(kubectl get node k3d-upstream-server-0 -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
host=$(kubectl get node $node -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
ca=$( kubectl config view --flatten -o jsonpath='{.clusters[?(@.name == "k3d-upstream")].cluster.certificate-authority-data}' | base64 -d )
server="https://$host:6443"

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ jobs:
name: Deploy Fleet
run: |
export KUBECONFIG="$GITHUB_WORKSPACE/kubeconfig-fleet-ci"
kc_node=$(kubectl get nodes --no-headers -o name | head -n 1)
node=${kc_node#node/}
echo "${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}"
SHARDS='[{"id":"shard0"},{"id":"shard1"},{"id":"shard2"}]' ./.github/scripts/deploy-fleet.sh \
NODE=$node SHARDS='[{"id":"shard0"},{"id":"shard1"},{"id":"shard2"}]' ./.github/scripts/deploy-fleet.sh \
${{ steps.meta-fleet.outputs.tags }} \
${{ steps.meta-fleet-agent.outputs.tags }}
-
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ jobs:
-
name: Deploy Fleet
run: |
kc_node=$(kubectl get nodes --no-headers -o name | head -n 1)
node=${kc_node#node/}
echo "${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}"
SHARDS='[{"id":"shard0"},{"id":"shard1"},{"id":"shard2"}]' ./.github/scripts/deploy-fleet.sh \
NODE=$node SHARDS='[{"id":"shard0"},{"id":"shard1"},{"id":"shard2"}]' ./.github/scripts/deploy-fleet.sh \
${{ steps.meta-fleet.outputs.tags }} \
${{ steps.meta-fleet-agent.outputs.tags }}
-
Expand Down

0 comments on commit b93e21e

Please sign in to comment.