eficode-academy / kubernetes-katas

Deliberate exercises for Kubernetes
265 stars 275 forks source link

Moved to using kubeconform and added exclusions #104

Closed cgorshing closed 1 year ago

cgorshing commented 1 year ago

I was going to submit another PR, but I saw the pipelines where failing. The linting is failing on the blank/template files used for the katas.

I went to look for a way to exclude these files and saw that kubeval is no longer being maintained:

NOTE: This project is https://github.com/instrumenta/kubeval/issues/268#issuecomment-902128481, a good replacement is [kubeconform](https://github.com/yannh/kubeconform)

For excluding files, I know you all have it in the find command, but with that turning into a longer command, I came up with this code. Not sure how you all feel about it, happy for any feedback.

Thanks for the katas - it has definitely helped me.

cgorshing commented 1 year ago

oh! That code doesn't work with sh, only bash. I saw #!/bin/bash at the top of the script and so I thought that is how it was ran (with bash).

But in the line.yaml workflow it uses sh: run: sh .test/lint_kube.sh

So I could look at changing the script to support sh or change to be bash - thoughts?

sofusalbertsen commented 1 year ago

Thanks a lot for this addition @cgorshing ! There is no reason why we use sh for it, so please replace that with bash, and then I'm more than happy to merge it in. Glad you liked our material :1st_place_medal:

cgorshing commented 1 year ago

Done - I also upgraded the checkout action, there was a warning when using v2 .... I'm assuming you all are okay with that.

sofusalbertsen commented 1 year ago

I do not have push rights, but can you paste this in the linting sh?

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
)
cgorshing commented 1 year ago

I got you - added