cleanup, add docs

This commit is contained in:
Chris Oloff 2025-01-01 17:26:31 +02:00
parent 6a94eb6279
commit b305152e9f
2 changed files with 25 additions and 8 deletions

View File

@ -3,6 +3,23 @@
This is a [Github Action](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-docker-container-action)
using Docker, with the intention to efficiently deploy to a k3s or k8s cluster using kustomize.
# How to Use
```yaml
jobs:
deploy_staging:
steps:
- name: deploy to staging
id: deploy
uses: https://gitea.uber5.com/Uber5-Public/gha-deploy-to-k3s@v2
with:
kust_config: kustomize/overlays/testing
env:
K3S_YAML: ${{ secrets.K3S_YAML }}
- name: Check output of previous step (kinda dummy)
run: echo "The start time was ${{ steps.deploy.outputs.time }}"
```
# Open Questions
- We use [kustomize](https://kustomize.io/). Is this overkill? As the complexity of deployments is not that high, usually, this may be more technical complexity than necessary. We could go back to using plain kubernetes manifests, and just have different ones for staging and prod.
@ -10,6 +27,6 @@ using Docker, with the intention to efficiently deploy to a k3s or k8s cluster u
- Advantages Github Actions:
- execution time should be faster
- it's closer to the mainstream
- Advantages Woodpecker:
- Current deployments use woodpecker already
- Simpler technology (This is debatable)
- Advantages Woodpecker:
- Current deployments use woodpecker already
- Simpler technology (This is debatable)

View File

@ -31,14 +31,14 @@ echo "K3S_YAML, deserialized:"
cat /tmp/k3s.yaml
cp -r ./kustomize /tmp/ # TODO: we expect the kustomize folder to be present in the root of the repository
find /tmp/kustomize -type f -print0 | xargs -0 sed -i "s/GIT_VERSION/${GITHUB_SHA}/"
echo "try and get nodes and version... (debugging)"
kubectl --kubeconfig /tmp/k3s.yaml get all
kubectl --kubeconfig /tmp/k3s.yaml version
# echo "try and get nodes and version... (debugging)"
# kubectl --kubeconfig /tmp/k3s.yaml get all
# kubectl --kubeconfig /tmp/k3s.yaml version
echo "determine kustomize version..."
KUSTOMIZE_VERSION=$(kubectl --kubeconfig /tmp/k3s.yaml version | grep Kustomize | awk '{ print $3 }')
echo "KUSTOMIZE_VERSION=${KUSTOMIZE_VERSION}"
echo "run kustomize, and print output to console"
kubectl --kubeconfig /tmp/k3s.yaml kustomize "/tmp/${KUST_CONFIG}"
# echo "run kustomize, and print output to console"
# kubectl --kubeconfig /tmp/k3s.yaml kustomize "/tmp/${KUST_CONFIG}"
echo "replace faulty kustomize version (compare https://github.com/kubernetes/kubectl/issues/1495)"
kubectl --kubeconfig /tmp/k3s.yaml kustomize "/tmp/${KUST_CONFIG}" | sed "s/kustomize-(devel)/kustomize-$KUSTOMIZE_VERSION/" >/tmp/manifests.yaml
echo "UPDATED YAML:"