Improve/adapt Knative defaulting and validation for K8s object types
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 1.2k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 2
Description
# Problem description
Kubernetes has a lot of defaulting and validation implemented for its own types, e.g. https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/v1/zz_generated.defaults.go#L305 for a container. Knative implements its own defaulting like [here](https://github.com/knative/serving/blob/main/pkg/apis/serving/v1/revision_defaults.go#L1). This is useful for stuff where Knative has other defaults or additional values.
This works in most cases, but we loose a lot of defaulting that K8s would do and have to reimplement, e.g. with probes: https://github.com/knative/serving/blob/main/pkg/apis/serving/v1/revision_defaults.go#L157
Also it causes issues like https://github.com/knative/serving/issues/14771 and we are lacking to default fields that are newly introduced in K8s like `StartupProbes`.
So it might be good to think about re-using K8s defaulting and validation doing the Knative stuff afterwards.
This is also related to the discussion in: https://github.com/knative/serving/issues/13204
Contributor guide
Research direction
Start by comparing Kubernetes' generated defaults with Knative's pkg/apis/serving/v1/revision_defaults.go, especially the probe handling, and read the discussion in issues 14771 and 13204. Define the scope for applying Kubernetes defaulting and validation alongside Knative behavior, including newly introduced fields such as StartupProbes, then identify regression coverage before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100