Skip to content

Commit ed64629

Browse files
committed
k3s cert in ci
1 parent 3114292 commit ed64629

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

.github/workflows/backend-ci.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,14 @@ jobs:
4646
export KUBECONFIG=/home/runner/.kube/config
4747
timeout 90 bash -c 'until sudo k3s kubectl cluster-info; do sleep 5; done'
4848
49-
- name: Create kubeconfig for CI
49+
- name: Create kubeconfig for CI Docker containers
5050
run: |
51-
cat > backend/kubeconfig.yaml <<EOF
52-
apiVersion: v1
53-
kind: Config
54-
clusters:
55-
- name: ci-cluster
56-
cluster:
57-
server: https://host.docker.internal:6443
58-
insecure-skip-tls-verify: true
59-
users:
60-
- name: ci-user
61-
user:
62-
token: "ci-token"
63-
contexts:
64-
- name: ci
65-
context:
66-
cluster: ci-cluster
67-
user: ci-user
68-
current-context: ci
69-
EOF
51+
# Copy real k3s kubeconfig with valid credentials, but change server address
52+
# from 127.0.0.1 to host.docker.internal for Docker container networking
53+
# (k3s was started with --tls-san host.docker.internal so the cert is valid)
54+
sed 's|https://127.0.0.1:6443|https://host.docker.internal:6443|g' \
55+
/home/runner/.kube/config > backend/kubeconfig.yaml
56+
chmod 644 backend/kubeconfig.yaml
7057
7158
- name: Setup CI Compose
7259
uses: ./.github/actions/setup-ci-compose

0 commit comments

Comments
 (0)