Skip to content

Commit

Permalink
Merge pull request #104 from cgorshing/kubeconform
Browse files Browse the repository at this point in the history
Moved to using kubeconform and added exclusions
  • Loading branch information
sofusalbertsen committed Sep 1, 2023
2 parents f87cfec + 1d8da09 commit 536df51
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,11 +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_kubeval.sh

run: bash .test/lint_kube.sh
37 changes: 37 additions & 0 deletions .test/lint_kube.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/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
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
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
9 changes: 0 additions & 9 deletions .test/lint_kubeval.sh

This file was deleted.

0 comments on commit 536df51

Please sign in to comment.