yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.07k stars 116 forks source link

[Bug] -skip uses first element in comma separated list only #256

Closed PatDyn closed 2 months ago

PatDyn commented 6 months ago

Background: Using traefik we recently introduced rate limiting for a project in my company. This requires the use of kind: Middleware.

Description: Calling

kubeconform -summary -skip "Certificate, Middleware" path/to/app.yaml 

always yields:

stdin - Middleware ratelimit failed validation: could not find schema for Middleware
Summary: 35 resources found parsing stdin - Valid: 33, Invalid: 0, Errors: 1, Skipped: 1

or when calling

kubeconform -summary -skip "Middleware, Certificate" path/to/app.yaml 

we get:

stdin - Certificate forgejo-service failed validation: could not find schema for Certificate
Summary: 35 resources found parsing stdin - Valid: 33, Invalid: 0, Errors: 1, Skipped: 1

Additional Info: This happens on v0.6.4 on Kubuntu 22.04. Go Version is: go1.21.3 linux/amd64

PatDyn commented 6 months ago

The culprit was a " ".

kubeconform -summary -skip "Middleware,Certificate" path/to/app.yaml Works just fine, without the space in the list. But it maybe worth a quickfix, as the behavior is quite unexpected :)

yannh commented 6 months ago

yeah it seems like it should work with a space too ;) I'll fix this next time I work on Kubeconform, or feel free to send a patch (with a test :pray: ) it should be pretty straightforward :+1: