kubernetes/pkg/registry/apps/deployment
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
..
storage Bump k8s.io/kube-openapi to latest SHA (f3f2b991d03b) 2025-07-14 07:24:48 -04:00
doc.go remove import doc comments 2024-12-02 16:59:34 +01:00
strategy.go apiserver: pass context with ReqInfo to AllowUnconditionalUpdate and AllowCreateOnUpdate 2026-05-05 12:48:19 +02:00
strategy_test.go Always check for Immutable selector in Deployment Replicaset Daemonset (#131017) 2025-04-23 15:58:37 -07:00