save
This commit is contained in:
parent
6b25e8c6b2
commit
45a5eb0c43
1 changed files with 9 additions and 47 deletions
56
.github/workflows/k8s_traefik_init_setup.yml
vendored
56
.github/workflows/k8s_traefik_init_setup.yml
vendored
|
|
@ -7,31 +7,27 @@ jobs:
|
||||||
bootstrap:
|
bootstrap:
|
||||||
runs-on: mealcraft-runners
|
runs-on: mealcraft-runners
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# REQUIRED: Use Docker DinD job container
|
|
||||||
# -----------------------------------------------------
|
|
||||||
container:
|
container:
|
||||||
image: docker:24.0-dind
|
image: docker:24.0-dind
|
||||||
options: --privileged
|
options: --privileged
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# -----------------------------------------------------
|
|
||||||
# Checkout Repo
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# -----------------------------------------------------
|
# Start the docker daemon manually (REQUIRED)
|
||||||
# Install kubectl
|
- 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
|
- name: Install kubectl
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache curl ca-certificates bash
|
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"
|
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
|
install -m 0755 kubectl /usr/local/bin/kubectl
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Configure kubeconfig via ARC pod token
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Configure kubeconfig
|
- name: Configure kubeconfig
|
||||||
run: |
|
run: |
|
||||||
KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT"
|
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 set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE"
|
||||||
kubectl config use-context runner-context
|
kubectl config use-context runner-context
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Docker Login
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Build & Push Docker Image (Docker-in-Docker)
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Build and Push Traefik Image
|
- name: Build and Push Traefik Image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -66,17 +56,11 @@ jobs:
|
||||||
docker.io/kimjunte/edge_router:${{ github.sha }}
|
docker.io/kimjunte/edge_router:${{ github.sha }}
|
||||||
docker.io/kimjunte/edge_router:latest
|
docker.io/kimjunte/edge_router:latest
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Apply Storage Classes + PVCs
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Apply StorageClass + PV
|
- name: Apply StorageClass + PV
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f traefik/storageclass/storageclass.yaml
|
kubectl apply -f traefik/storageclass/storageclass.yaml
|
||||||
kubectl apply -f traefik/storageclass/certs-pv.yaml
|
kubectl apply -f traefik/storageclass/certs-pv.yaml
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Install Traefik CRDs (idempotent)
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Install Traefik CRDs
|
- name: Install Traefik CRDs
|
||||||
run: |
|
run: |
|
||||||
if ! kubectl get crd ingressroutes.traefik.containo.us >/dev/null 2>&1; then
|
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
|
kubectl apply -f https://raw.githubusercontent.com/traefik/traefik/v2.10/docs/content/user-guides/crd-acme/05-tlsoption.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Deploy Traefik
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Deploy Traefik
|
- name: Deploy Traefik
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f traefik/edge-router/pvc.yaml
|
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/secret-dashboard.yml
|
||||||
kubectl apply -f traefik/edge-router/traefik-ingressroute.yml
|
kubectl apply -f traefik/edge-router/traefik-ingressroute.yml
|
||||||
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Deploy whoami test service
|
|
||||||
# -----------------------------------------------------
|
|
||||||
- name: Deploy whoami
|
- name: Deploy whoami
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f traefik/who-am-i/whoami-deployment.yml
|
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-servi
|
||||||
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 -
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue