This repository has been archived on 2026-10-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
coredns-deployment/.gitea/workflows/deploy.yml
T
feedc0de 0e79333802
Validate and deploy CoreDNS scheduling / validate (push) Successful in 13s
Validate and deploy CoreDNS scheduling / deploy (push) Successful in 23s
Strip sha256 hash
2026-10-14 20:17:09 +02:00

46 lines
2.3 KiB
YAML

name: Validate and deploy CoreDNS scheduling
on: [push, pull_request]
env:
KUBECTL_VERSION: v1.36.3
KUBERNETES_API: https://host.containers.internal:6443
KUBERNETES_TLS_SERVER_NAME: 192.168.0.2
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash test.sh
deploy:
if: gitea.ref == 'refs/heads/main'
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install kubectl
run: |
curl -fsSL -o "${RUNNER_TEMP}/kubectl" "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod 0700 "${RUNNER_TEMP}/kubectl"
- name: Configure Kubernetes access
env:
KUBE_CONFIG_BASE64: ${{ secrets.KUBE_CONFIG_BASE64 }}
run: |
test -n "${KUBE_CONFIG_BASE64}"
printf '%s' "${KUBE_CONFIG_BASE64}" | base64 -d > "${RUNNER_TEMP}/kubeconfig"
chmod 0600 "${RUNNER_TEMP}/kubeconfig"
export KUBECONFIG="${RUNNER_TEMP}/kubeconfig"
"${RUNNER_TEMP}/kubectl" config set-cluster cluster --server="${KUBERNETES_API}" --tls-server-name="${KUBERNETES_TLS_SERVER_NAME}"
- name: Apply and verify
run: |
export KUBECONFIG="${RUNNER_TEMP}/kubeconfig"
"${RUNNER_TEMP}/kubectl" -n kube-system patch deployment coredns --type=strategic --patch-file coredns-scheduling-patch.yaml --dry-run=server
"${RUNNER_TEMP}/kubectl" apply --server-side --force-conflicts --dry-run=server -f coredns-pdb.yaml
"${RUNNER_TEMP}/kubectl" -n kube-system patch deployment coredns --type=strategic --patch-file coredns-scheduling-patch.yaml
"${RUNNER_TEMP}/kubectl" apply --server-side --force-conflicts -f coredns-pdb.yaml
for attempt in {1..60}; do
state=$("${RUNNER_TEMP}/kubectl" -n kube-system get deployment coredns -o jsonpath='{.metadata.generation}|{.status.observedGeneration}|{.spec.replicas}|{.status.updatedReplicas}|{.status.readyReplicas}|{.status.availableReplicas}')
IFS='|' read -r generation observed desired updated ready available <<< "$state"
[[ "$generation" == "$observed" && "$desired" == "$updated" && "$desired" == "$ready" && "$desired" == "$available" ]] && exit 0
sleep 5
done
exit 1