kubernetes/pkg/registry/apps
Patrick Ohly 163211ee45 apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate
This enables implementing different behavior for AllowUnconditionalUpdate and
AllowCreateOnUpdate depending on the API version, which can be found in
ReqInfo.APIVersion. The specific need for this is to switch from
AllowUnconditionalUpdate=true (not recommended!) to false in v1 of
resource.k8s.io DeviceTaintRule.

This is done by adding the missing context parameter to the existing methods
instead of adding a new optional interface because a) the resulting
implementation is simpler and gets checked by the compiler and b) the Go API
guarantees of k8s.io/apiserver are more relaxed than in other modules because
it's less used downstream.

Example implementation:

    func (*deviceTaintRuleStrategy) AllowUnconditionalUpdate(ctx context.Context) bool {
           reqInfo, _ := request.RequestInfoFrom(ctx)
           if reqInfo != nil && reqInfo.APIVersion == "v1" {
                   // Should have done that already earlier. Better late than never...
                   return false
           }
           // Historic behavior for v1beta2 and older, cannot change that anymore.
           return true
    }
2026-05-05 12:48:19 +02:00
..
controllerrevision apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
daemonset apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
deployment apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
replicaset apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
rest reduce API surface area of whether a resource is enabled 2022-02-23 13:36:33 -05:00
statefulset apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
OWNERS Add sig OWNERS to registry packages 2023-10-31 01:20:16 +00:00