Add kustomize testing

This extends our test coverages for kured-* manifest changes on PRs,
and any eventual changes in kubernetes/kubectl on periodics.

Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
This commit is contained in:
Jean-Philippe Evrard
2020-08-25 12:26:54 +02:00
parent 596394db79
commit 7f379ac920
3 changed files with 75 additions and 0 deletions

15
.github/kustomize/kured-dev.yaml vendored Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kured
namespace: kube-system
spec:
template:
spec:
containers:
- name: kured
image: docker.io/weaveworks/kured
imagePullPolicy: Always
command:
- /usr/bin/kured
- --period=1m

7
.github/kustomize/kustomization.yaml vendored Normal file
View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- kured-ds.yaml
- kured-rbac.yaml
patchesStrategicMerge:
- kured-dev.yaml

53
.github/workflows/kustomize-test.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
#This tests if our kustomize manifests still work with an update
#of kustomize or with an update of our manifests (keeping the image
# the same).
name: Kustomize deploy
on:
pull_request:
paths:
- "**/kured-*.yaml"
schedule:
- cron: '0 0 1 * *'
jobs:
deploy-with-kustomize:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
# We need to unpin kind-action so we can test is new versions of kind
# and therefore kubernetes will break with our manifests
# This creates a 1 node cluster.
- name: Create a default kind cluster
uses: helm/kind-action@master
# Kustomize won't work with symlinks to resources outside its folder
# kind-action already installed kind and kubectl.
- name: Deploy with kubectl using kustomization
run: |
cp kured-{ds,rbac}.yaml .github/kustomize/
VERSION=$(curl -s https://api.github.com/repos/weaveworks/kured/releases | jq -r .[0].tag_name)
sed -i "s#docker.io/weaveworks/kured#docker.io/weaveworks/kured:$VERSION#g" .github/kustomize/kured-dev.yaml
kubectl apply -k .github/kustomize/
- name: Show kured is deploying
run: |
sleep 10; kubectl describe ds kured -n kube-system
- name: Ensure kured is up
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 10
retry_wait_seconds: 60
# DESIRED CURRENT READY UP-TO-DATE AVAILABLE should all be =1
command: "kubectl get ds -n kube-system | grep -E 'kured.*1.*1.*1.*1.*1' "
- name: Show kured is successfully deployed
run: |
kubectl get ds -n kube-system