instrumenta / kubeval

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

Missing 'kind' key && getting Failed to decode YAML Errors #352

Closed muhammedsaidkaya closed 6 months ago

muhammedsaidkaya commented 2 years ago

I am trying to run the below command on our kustomization base and overlay files.

kubeval --ignore-missing-schemas patch_issuer.yaml and kubeval --ignore-missing-schemas kustomization.yaml

You can see the content of files and also the error messages.

can you suggest how can I validate our kustomization base and overlay files with kubeval?

image

muhammedsaidkaya commented 2 years ago

You can reproduce it with the below files.

base/resources/kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- issuer.yaml

base/resources/issuer.yaml

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-issuer
  namespace: default
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: email
    privateKeySecretRef:
      name: letsencrypt-production
    solvers:
      - http01:
          ingress:
            class: nginx

overlays/resources/kustomization.yaml

bases:
  - ../../base/resources

patches:
  - path: patch_issuer.yaml
    target:
      group: cert-manager.io
      version: v1
      kind: ClusterIssuer
      name: letsencrypt-issuer

overlays/resources/patch_issuer.yaml

- op: replace
  path: /spec/acme/server
  value: https://acme-staging-v02.api.letsencrypt.org/directory

- op: replace
  path: /spec/acme/privateKeySecretRef/name
  value: letsencrypt-staging

kubeval -d overlays/resources/