This commit is contained in:
Jun-te Kim 2025-12-06 21:42:41 +00:00
parent 6b25e8c6b2
commit 45a5eb0c43

View file

@ -7,31 +7,27 @@ jobs:
bootstrap:
runs-on: mealcraft-runners
# -----------------------------------------------------
# REQUIRED: Use Docker DinD job container
# -----------------------------------------------------
container:
image: docker:24.0-dind
options: --privileged
steps:
# -----------------------------------------------------
# Checkout Repo
# -----------------------------------------------------
- uses: actions/checkout@v4
# -----------------------------------------------------
# Install kubectl
# -----------------------------------------------------
# Start the docker daemon manually (REQUIRED)
- name: Start Docker daemon
run: |
dockerd-entrypoint.sh >/tmp/dockerd.log 2>&1 &
echo "Waiting for Docker to start..."
sleep 10
docker info
- name: Install kubectl
run: |
apk add --no-cache curl ca-certificates bash
curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install -m 0755 kubectl /usr/local/bin/kubectl
# -----------------------------------------------------
# Configure kubeconfig via ARC pod token
# -----------------------------------------------------
- name: Configure kubeconfig
run: |
KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT"
@ -44,18 +40,12 @@ jobs:
kubectl config set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE"
kubectl config use-context runner-context
# -----------------------------------------------------
# Docker Login
# -----------------------------------------------------
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
# -----------------------------------------------------
# Build & Push Docker Image (Docker-in-Docker)
# -----------------------------------------------------
- name: Build and Push Traefik Image
uses: docker/build-push-action@v5
with:
@ -66,17 +56,11 @@ jobs:
docker.io/kimjunte/edge_router:${{ github.sha }}
docker.io/kimjunte/edge_router:latest
# -----------------------------------------------------
# Apply Storage Classes + PVCs
# -----------------------------------------------------
- name: Apply StorageClass + PV
run: |
kubectl apply -f traefik/storageclass/storageclass.yaml
kubectl apply -f traefik/storageclass/certs-pv.yaml
# -----------------------------------------------------
# Install Traefik CRDs (idempotent)
# -----------------------------------------------------
- name: Install Traefik CRDs
run: |
if ! kubectl get crd ingressroutes.traefik.containo.us >/dev/null 2>&1; then
@ -85,9 +69,6 @@ jobs:
kubectl apply -f https://raw.githubusercontent.com/traefik/traefik/v2.10/docs/content/user-guides/crd-acme/05-tlsoption.yml
fi
# -----------------------------------------------------
# Deploy Traefik
# -----------------------------------------------------
- name: Deploy Traefik
run: |
kubectl apply -f traefik/edge-router/pvc.yaml
@ -97,26 +78,7 @@ jobs:
kubectl apply -f traefik/edge-router/secret-dashboard.yml
kubectl apply -f traefik/edge-router/traefik-ingressroute.yml
# -----------------------------------------------------
# Deploy whoami test service
# -----------------------------------------------------
- name: Deploy whoami
run: |
kubectl apply -f traefik/who-am-i/whoami-deployment.yml
kubectl apply -f traefik/who-am-i/whoami-service.yml
kubectl apply -f traefik/who-am-i/whoami-ingressroute.yml
# -----------------------------------------------------
# Registry secrets
# -----------------------------------------------------
- name: Create registry secret (default)
run: kubectl apply -f traefik/docker-registry-credentials/docker-credentials.yml
- name: Create staging namespace
run: kubectl get ns staging >/dev/null 2>&1 || kubectl create namespace staging
- name: Registry secret to staging
run: |
sed 's/namespace: default/namespace: staging/' \
traefik/docker-registry-credentials/docker-credentials.yml \
| kubectl apply -f -
kubectl apply -f traefik/who-am-i/whoami-servi