From 19dc84c9d79a88be3e78d8a308128b72b83033db Mon Sep 17 00:00:00 2001 From: Chad Gorshing Date: Tue, 22 Aug 2023 09:44:43 -0500 Subject: [PATCH 1/3] Moved to using kubeconform and added exclusions --- .github/workflows/lint.yaml | 3 +-- .test/lint_kube.sh | 20 ++++++++++++++++++++ .test/lint_kubeval.sh | 9 --------- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 .test/lint_kube.sh delete mode 100644 .test/lint_kubeval.sh diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2301fd4..320bd8d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -40,5 +40,4 @@ jobs: run: sh .test/extract_all_k8s_from_md.sh - name: Lint Kubernetes Resources - run: sh .test/lint_kubeval.sh - + run: sh .test/lint_kube.sh diff --git a/.test/lint_kube.sh b/.test/lint_kube.sh new file mode 100644 index 0000000..e00f99a --- /dev/null +++ b/.test/lint_kube.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Select all yaml files, except the Helmsman related ones. These are +# detected by exluding files with filenames starting with "helmfile." or "values-". +KUBERNETES_RESOURCE_FILES=$(find * -type f \( -iname '*.yml' -or -iname '*.yaml' \) -and ! \( -iname "helmfile.yaml" -or -iname "values-*.yaml" -or -iname "*docker-compose*" \)) + +excludes=( + deployments-loadbalancing/start/frontend-deployment.yaml + deployments-loadbalancing/start/backend-deployment.yaml + manifests/start/frontend-pod.yaml + services/start/backend-svc.yaml + services/start/frontend-svc.yaml +) +for exclude in ${excludes[@]} +do + KUBERNETES_RESOURCE_FILES=("${KUBERNETES_RESOURCE_FILES[@]/$exclude}") +done + +# Run all files through kubeconform +docker run --rm -v ${PWD}:/fixtures -w /fixtures ghcr.io/yannh/kubeconform -summary $KUBERNETES_RESOURCE_FILES diff --git a/.test/lint_kubeval.sh b/.test/lint_kubeval.sh deleted file mode 100644 index 3f9c44d..0000000 --- a/.test/lint_kubeval.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Select all yaml files, except the Helmsman related ones. These are -# detected by exluding files with filenames starting with "helmfile." or "values-". -KUBERNETES_RESOURCE_FILES=$(find * -type f \( -iname '*.yml' -or -iname '*.yaml' \) -and ! \( -iname "helmfile.yaml" -or -iname "values-*.yaml" -or -iname "*docker-compose*" \)) - -# Run all files through kubeval -docker run --rm -v `pwd`:/fixtures -w /fixtures garethr/kubeval $KUBERNETES_RESOURCE_FILES - From 655467669eab8ab9be6e76e1b5f80f2dc48a3d57 Mon Sep 17 00:00:00 2001 From: Chad Gorshing Date: Wed, 30 Aug 2023 12:56:18 -0500 Subject: [PATCH 2/3] Use bash now, and upgraded checkout action --- .github/workflows/lint.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 320bd8d..6bd6103 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -13,7 +13,7 @@ jobs: kubernetes-version: [ '1.16.0', '1.21.0' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract K8s YAML from Markdown files run: sh .test/extract_all_k8s_from_md.sh @@ -34,10 +34,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Extract K8s YAML from Markdown files - run: sh .test/extract_all_k8s_from_md.sh + run: bash .test/extract_all_k8s_from_md.sh - name: Lint Kubernetes Resources - run: sh .test/lint_kube.sh + run: bash .test/lint_kube.sh From 1d8da09fd221b99a9131e6e25247f6e3da1be03b Mon Sep 17 00:00:00 2001 From: Chad Gorshing Date: Wed, 30 Aug 2023 13:49:17 -0500 Subject: [PATCH 3/3] Added additional files to ignore --- .test/lint_kube.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.test/lint_kube.sh b/.test/lint_kube.sh index e00f99a..d8926ff 100644 --- a/.test/lint_kube.sh +++ b/.test/lint_kube.sh @@ -10,6 +10,23 @@ excludes=( manifests/start/frontend-pod.yaml services/start/backend-svc.yaml services/start/frontend-svc.yaml + old/support-files/traefik-rbac-serviceaccount.yaml + old/ingress-nginx/ingress.yml + old/support-files/traefik-service.yaml + old/extras/08-ingress-gke.md.yaml + old/extras/08-ingress-gke.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/support-files/traefik-rbac-serviceaccount.yaml + old/extras/08-ingress-traefik.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/extras/08-ingress-traefik.md.yaml + old/ingress-gke/ingress.yml + old/ingress-traefik/traefik-rbac.yaml + old/ingress-traefik/traefik-rbac.yaml + old/ingress-traefik/traefik-webui-ingress.yaml + old/ingress-traefik/example-ingress.yaml + old/ingress-traefik/my-ingress.yml + old/ingress-traefik/traefik-ingress-controller.yml ) for exclude in ${excludes[@]} do