mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-23 10:29:27 -04:00
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
}
|
||
|---|---|---|
| .. | ||
| controllerrevision | ||
| daemonset | ||
| deployment | ||
| replicaset | ||
| rest | ||
| statefulset | ||
| OWNERS | ||