mirror of
https://gitea.com/gitea/helm-actions.git
synced 2026-04-05 01:00:48 +00:00
Rename cluster
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user