Skip to content

CRD CEL validation fails: undefined field 'namespace' on apply #3154

@Shekharrajak

Description

@Shekharrajak

What happened?

When applying E2E manifests (kubectl apply --server-side -k artifacts/e2e/manifests), three CRDs fail because their CEL validation rule references
t.metadata.namespace, which is not defined in the CEL schema for that path:
• clustertrainingruntimes.trainer.kubeflow.org
• jobsets.jobset.x-k8s.io
• trainingruntimes.trainer.kubeflow.org

Error :

CustomResourceDefinition.apiextensions.k8s.io "clustertrainingruntimes.trainer.kubeflow.org" is invalid: spec.validation.openAPIV3Schema.properties[s
pec].properties[template].properties[spec].properties[volumeClaimPolicies].items.x-kubernetes-validations[0].rule: Invalid value: ... compilation
failed: ERROR: :1:27: undefined field 'namespace'
| self.templates.all(t, !has(t.metadata.namespace) || size(t.metadata.namespace) == 0)
| ..........................^
ERROR: :1:68: undefined field 'namespace'
| self.templates.all(t, !has(t.metadata.namespace) || size(t.metadata.namespace) == 0)
| ...................................................................^

What did you expect to happen?

Rule: self.templates.all(t, !has(t.metadata.namespace) || size(t.metadata.namespace) == 0)
Message: "namespace cannot be set for VolumeClaimPolicies templates"
Repro: Run make test-e2e-setup-cluster (e.g. with Kind v1.30.0). Fails during kubectl apply -k artifacts/e2e/manifests.
Expected: CRDs apply successfully.
Actual: CEL compiler reports undefined field 'namespace' and the CRDs are rejected.
Suggested fix: Adjust or remove this CEL rule so it does not rely on t.metadata.namespace in a schema context where that field is not defined (or use
a CEL expression that is valid for the OpenAPI schema for volumeClaimPolicies items).

Environment

github CI check in SDK kubeflow/sdk#225

Impacted by this bug?

Give it a 👍 We prioritize the issues with most 👍

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions