kubeval icon indicating copy to clipboard operation
kubeval copied to clipboard

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

Open muhammedsaidkaya opened this issue 1 year ago • 1 comments

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 avatar Aug 12 '22 11:08 muhammedsaidkaya

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/

muhammedsaidkaya avatar Aug 12 '22 14:08 muhammedsaidkaya