instrumenta / kubeval

Validate your Kubernetes configuration files, supports multiple Kubernetes versions
https://kubeval.com
Other
3.16k stars 229 forks source link

Issues with Kustomization Files #232

Open mmckane opened 4 years ago

mmckane commented 4 years ago

Kustomization.yaml files currently throws errors when scanned. This may be expected but seeing some strange behavior with several of the switches when I try and ignore them.

Error I am seeing consistently: ERR - path/kustomization.yaml: Missing 'metadata' key

Things tried to resolve missing metadata key: --ignore-missing-schemas = Still results in above error --skip-kinds Kustomization = Does not appear to be working, would be nice to have this work as there are a few types of possible names for these types of files.

Current Workaround: --ignored-filename-patterns kustomization.yaml seems to be the only way to ignore these files.

example file for reference:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- github.com/argoproj/argo-cd/manifests/ha/cluster-install?ref=v1.5.2
blaggacao commented 4 years ago

I was searching for the schema to check what might be actually happening; found https://github.com/instrumenta/kubeval/issues/209#issue-558193908 , but the link is dead. Anyone can point to the schema to help fix this?

cprivitere commented 3 years ago

@blaggacao It looks like the json schema site isn't being updated anymore (last update 17 months ago!). Here's a go based version, would this work? https://pkg.go.dev/sigs.k8s.io/kustomize/api/types or https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/kustomization.go

seh commented 2 years ago

You can use this command-line flag and argument to ignore these files: --ignored-filename-patterns='^(?:.+/)?(?:Kustomization|kustomization\.ya?ml)$'