kubernetes-sigs / kubernetes-sigs/controller-tools

APIs embedding batchv1.JobSpec get rejected due to missing k8s:maxItems implementation

Open
#1,473 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
868
Forks
482
Avg merge
1d 11h
Merged PRs (30d)
8

Description

Controller-tools implementing `+k8s:immutable` and not implementing `k8s:maxItems` results in CRDs embedding `batchv1.JobSpec` to get rejected by the apiserver due to exceeding the CEL cost budget with an error like the below:

```
CustomResourceDefinition.apiextensions.k8s.io "clustertrainingruntimes.trainer.kubeflow.org" is invalid:
[spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec]
.properties[replicatedJobs].items.properties[template].properties[spec].properties[scheduling]
.properties[resourceClaims].x-kubernetes-validations[0].rule: Forbidden: estimated rule cost
exceeds budget by factor of more than 100x (try simplifying the rule, or adding maxItems,
maxProperties, and maxLength where arrays, maps, and strings are declared),
...
spec.validation.openAPIV3Schema: Forbidden: x-kubernetes-validations estimated rule cost total
for entire OpenAPIv3 schema exceeds budget by factor of more than 100x]
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing controller-tools handling of k8s:immutable and the missing k8s:maxItems implementation, then reproduce the failure with a CRD embedding batchv1.JobSpec. Done means generated CRD schemas include appropriate collection bounds so the apiserver no longer rejects them for exceeding the CEL cost budget.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.