Skip to content

In a CRD's schema, invalid schemas for array elements are accepted #128033

Open
@MikeSpreitzer

Description

@MikeSpreitzer

What happened?

I accidentally wrote an invalid OpenAPI v3.0 schema for the elements of an array in a CRD's schema. kubectl create --validate=strict accepted my CRD definition without complaint, and silently discarded my invalid schema property. I have attached two files that demonstrate the problem. test1.yaml.txt gets rejected, while test2.yaml.txt is accepted but the {propertyNames: {pattern: foo}} gets silently transformed to {}.

test2.yaml.txt

test1.yaml.txt

What did you expect to happen?

I expected my schema to be implemented or rejected.

How can we reproduce it (as minimally and precisely as possible)?

Shown above.

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2

Cloud provider

none

OS version

MacOS 15.0.1
container runtime is docker in Rancher Desktop.
Inside the VM guest, /etc/os-release says:

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.20.3
PRETTY_NAME="Alpine Linux v3.20"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
BUILD_ID="v0.2.39.rd4"
VARIANT_ID="rd"

Install tools

kind v0.22.0

Container runtime (CRI) and version (if applicable)

docker in Rancher Desktop; client v27.2.1-rd; server engine 26.1.5, containerd v1.7.17, runc 1.1.14, docker-init 0.19.0

Related plugins (CNI, CSI, ...) and versions (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions