knative / serving

Kubernetes-based, scale-to-zero, request-driven compute
https://knative.dev/docs/serving/
Apache License 2.0
5.46k stars 1.14k forks source link

Improve/adapt Knative defaulting and validation for K8s object types #14774

Open ReToCode opened 5 months ago

ReToCode commented 5 months ago

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. 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

ReToCode commented 5 months ago

cc @skonto @dprotaso

ReToCode commented 5 months ago

See also discussion in https://github.com/knative/serving/pull/14853#discussion_r1479453847

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.