mirror of
https://gitea.com/gitea/helm-actions.git
synced 2026-04-05 09:10:46 +00:00
.gitea/workflows/e2e.yml aktualisiert
This commit is contained in:
@ -22,39 +22,35 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "Try to Delete old cluster"
|
echo "Try to Delete old cluster"
|
||||||
kind delete cluster --name test-cluster || echo "No cluster Deleted"
|
kind delete cluster --name test-cluster || echo "No cluster Deleted"
|
||||||
kind create cluster --name test-cluster --wait 5m
|
kind create cluster --name test-cluster
|
||||||
|
|
||||||
- name: Connect kind to the job container's network and fix kubeconfig
|
- name: Attach kind control-plane to job network and wait
|
||||||
run: |
|
run: |
|
||||||
# 1. Find the Docker network the job container is on
|
apt-get update && apt-get install -y jq docker.io
|
||||||
# The job container's hostname is the container ID
|
|
||||||
JOB_CONTAINER_ID=$(hostname)
|
|
||||||
NETWORK_NAME=$(docker inspect "$JOB_CONTAINER_ID" \
|
|
||||||
--format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}')
|
|
||||||
|
|
||||||
echo "Job container network: $NETWORK_NAME"
|
JOB_CONTAINER_ID="$(hostname)"
|
||||||
|
NETWORK_NAME="$(docker inspect "$JOB_CONTAINER_ID" --format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}')"
|
||||||
|
echo "Job network: $NETWORK_NAME"
|
||||||
|
|
||||||
# 2. Get the kind control-plane container name
|
CONTROL_PLANE="test-cluster-control-plane"
|
||||||
KIND_CONTAINER="test-cluster-control-plane"
|
docker network connect "$NETWORK_NAME" "$CONTROL_PLANE" || true
|
||||||
|
|
||||||
# 3. Connect the kind container to the same network
|
KIND_IP="$(docker inspect "$CONTROL_PLANE" --format "{{(index .NetworkSettings.Networks \"$NETWORK_NAME\").IPAddress}}")"
|
||||||
docker network connect "$NETWORK_NAME" "$KIND_CONTAINER"
|
echo "Kind IP: $KIND_IP"
|
||||||
|
|
||||||
# 4. Get the kind container's IP on that network
|
# Point kubectl at the control-plane directly
|
||||||
KIND_IP=$(docker inspect "$KIND_CONTAINER" \
|
kubectl config set-cluster kind-test-cluster --server="https://${KIND_IP}:6443"
|
||||||
--format "{{(index .NetworkSettings.Networks \"$NETWORK_NAME\").IPAddress}}")
|
kubectl config set-cluster kind-test-cluster --insecure-skip-tls-verify=true
|
||||||
|
|
||||||
echo "Kind container IP on shared network: $KIND_IP"
|
# Wait for API and nodes
|
||||||
|
for i in $(seq 1 120); do
|
||||||
# 5. Rewrite the kubeconfig to use the kind container's IP
|
if kubectl get nodes >/dev/null 2>&1; then
|
||||||
# kind's API server listens on port 6443 inside the container
|
break
|
||||||
kubectl config set-cluster kind-test-cluster \
|
fi
|
||||||
--server="https://${KIND_IP}:6443"
|
echo "Waiting for kind API... ($i/120)"
|
||||||
|
sleep 2
|
||||||
# 6. Since the TLS cert won't match the new IP, use insecure mode
|
done
|
||||||
# OR set insecure-skip-tls-verify
|
kubectl get nodes
|
||||||
kubectl config set-cluster kind-test-cluster \
|
|
||||||
--insecure-skip-tls-verify=true
|
|
||||||
|
|
||||||
- name: Verify cluster access
|
- name: Verify cluster access
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user