kubeval
kubeval copied to clipboard
Invalid namespace file passes kubeval
apiVersion: v1 kind: Namespace metadata: creationTimestamp: null name: Test2 spec: {} status: {}
Trying to validate a namespace YAML file that has an invalid name. If I apply it with dry-run=server flag it throws error "The Namespace "Test2" is invalid: metadata.name: Invalid value: "Test2": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is 'a-z0-9?')" but kubeval doesn't detect this as an error.
just use the --strict flag.
kubeval --version
Version: 0.16.1
Commit: f5dba6b486fa18b9179b91e15eb6f2b0f7a5a69e
Date: 2021-03-30T15:16:16Z
@ivan-penchev also passes with --strict
unfortunately
the below namespace is also considered valid, while it's not
apiVersion: v1
kind: Namespace
metadata:
name: .dummy
PASS - ns.yaml contains a valid Namespace (.dummy)
CC: @hasheddan might be you are also interested in this as well