Skip to content

Commit

Permalink
helm: masq traffic to the mini-qemu-metadata container so that the jo…
Browse files Browse the repository at this point in the history
…in-service can retrieve it's metadata (#2782)

* helm: masq traffic to the mini-qemu-metadata container

* ci: fix waiting for nodes in miniconstellation e2e test
  • Loading branch information
3u13r authored Jan 2, 2024
1 parent 4d8f45c commit 45479b3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
35 changes: 22 additions & 13 deletions e2e/miniconstellation/test-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,29 @@ echo "Done waiting."

export KUBECONFIG="${PWD}/constellation-admin.conf"

# Wait for nodes to actually show up in K8s
count=0
until kubectl wait --for=condition=Ready --timeout=2s nodes control-plane-0 2> /dev/null || [[ ${count} -eq 30 ]]; do
echo "Control-planes are not registered in Kubernetes yet. Waiting..."
sleep 10
count=$((count + 1))
done

count=0
until kubectl wait --for=condition=Ready --timeout=2s nodes worker-0 2> /dev/null || [[ ${count} -eq 30 ]]; do
echo "Worker nodes are not registered in Kubernetes yet. Waiting..."
sleep 10
count=$((count + 1))
# Wait for nodes to actually show up in K8s (taken from .github/actions/constellation_create/action.yml)
echo "::group::Wait for nodes"
NODES_COUNT=2
JOINWAIT=0
JOINTIMEOUT="600" # 10 minutes timeout for all nodes to join
until [[ "$(kubectl get nodes -o json | jq '.items | length')" == "${NODES_COUNT}" ]] || [[ $JOINWAIT -gt $JOINTIMEOUT ]]; do
echo "$(kubectl get nodes -o json | jq '.items | length')/${NODES_COUNT} nodes have joined.. waiting.."
JOINWAIT=$((JOINWAIT + 30))
sleep 30
done
if [[ $JOINWAIT -gt $JOINTIMEOUT ]]; then
echo "Timed out waiting for nodes to join"
exit 1
fi
echo "$(kubectl get nodes -o json | jq '.items | length')/${NODES_COUNT} nodes have joined"
if ! kubectl wait --for=condition=ready --all nodes --timeout=20m; then
kubectl get pods -n kube-system
kubectl get events -n kube-system
echo "::error::kubectl wait timed out before all nodes became ready"
echo "::endgroup::"
exit 1
fi
echo "::endgroup::"

# Wait for deployments
kubectl -n kube-system wait --for=condition=Available=True --timeout=180s deployment coredns
Expand Down
11 changes: 10 additions & 1 deletion internal/constellation/helm/overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ func extraCiliumValues(provider cloudprovider.Provider, conformanceMode bool, ou
extraVals["encryption"] = map[string]any{
"strictMode": strictMode,
}

// On QEMU e.g. the join-service must talk to our mini-qemu-metadata docker container
// This container runs inside the node CIDR, so we need to masq any pod traffic to it
// with the node's IP address. To archive that, we override Cilium's default masq ranges
// with an empty list.
masqCIDRs := []string{}
if provider != cloudprovider.QEMU {
masqCIDRs = append(masqCIDRs, output.IPCidrNode)
}
extraVals["ipMasqAgent"] = map[string]any{
"config": map[string]any{
"nonMasqueradeCIDRs": []string{output.IPCidrNode},
"nonMasqueradeCIDRs": masqCIDRs,
},
}

Expand Down

0 comments on commit 45479b3

Please sign in to comment.