Rename cluster

This commit is contained in:
ChristopherHX
2026-03-19 11:01:02 +00:00
parent 24863ef249
commit 91348eb00b

View File

@ -2,6 +2,8 @@ on: pull_request
jobs:
k8s-test:
runs-on: ubuntu-latest
env:
CLUSTER_NAME: helm-actions-cluster
steps:
- uses: actions/checkout@v4
@ -20,7 +22,7 @@ jobs:
- name: Create kind cluster
run: |
docker inspect test-cluster-control-plane && mkdir -p ~/.kube && kind get kubeconfig --name test-cluster > ~/.kube/config || kind create cluster --name test-cluster --wait 5m
docker inspect ${CLUSTER_NAME}-control-plane && mkdir -p ~/.kube && kind get kubeconfig --name ${CLUSTER_NAME} > ~/.kube/config || kind create cluster --name ${CLUSTER_NAME} --wait 5m
- name: Connect kind to the job container's network and fix kubeconfig
if: always()
@ -36,7 +38,7 @@ jobs:
echo "Job container network: $NETWORK_NAME"
# 2. Get the kind control-plane container name
KIND_CONTAINER="test-cluster-control-plane"
KIND_CONTAINER="${CLUSTER_NAME}-control-plane"
echo "KIND_CONTAINER=$KIND_CONTAINER" >> $GITHUB_ENV
@ -51,12 +53,12 @@ jobs:
# 5. Rewrite the kubeconfig to use the kind container's IP
# kind's API server listens on port 6443 inside the container
kubectl config set-cluster kind-test-cluster \
kubectl config set-cluster kind-${CLUSTER_NAME} \
--server="https://${KIND_IP}:6443"
# 6. Since the TLS cert won't match the new IP, use insecure mode
# OR set insecure-skip-tls-verify
kubectl config set-cluster kind-test-cluster \
kubectl config set-cluster kind-${CLUSTER_NAME} \
--insecure-skip-tls-verify=true
- name: Verify cluster access