Deprecate SelfLink + featuregate for setting it
Kubernetes-commit: 3bf4eb70723340cf84abec11e9ce14dfcc02a148
This commit is contained in:
parent
f03b723bf5
commit
e603adaf68
|
@ -224,12 +224,7 @@ func PatchResource(r rest.Patcher, scope *RequestScope, admit admission.Interfac
|
|||
}
|
||||
trace.Step("Object stored in database")
|
||||
|
||||
requestInfo, ok := request.RequestInfoFrom(ctx)
|
||||
if !ok {
|
||||
scope.err(fmt.Errorf("missing requestInfo"), w, req)
|
||||
return
|
||||
}
|
||||
if err := setSelfLink(result, requestInfo, scope.Namer); err != nil {
|
||||
if err := setObjectSelfLink(ctx, result, req, scope.Namer); err != nil {
|
||||
scope.err(err, w, req)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ import (
|
|||
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
|
||||
"k8s.io/apiserver/pkg/endpoints/metrics"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
|
@ -318,6 +320,10 @@ func checkName(obj runtime.Object, name, namespace string, namer ScopeNamer) err
|
|||
// TODO: remove the need for the namer LinkSetters by requiring objects implement either Object or List
|
||||
// interfaces
|
||||
func setObjectSelfLink(ctx context.Context, obj runtime.Object, req *http.Request, namer ScopeNamer) error {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.RemoveSelfLink) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// We only generate list links on objects that implement ListInterface - historically we duck typed this
|
||||
// check via reflection, but as we move away from reflection we require that you not only carry Items but
|
||||
// ListMeta into order to be identified as a list.
|
||||
|
|
|
@ -132,6 +132,12 @@ const (
|
|||
//
|
||||
// Enables managing request concurrency with prioritization and fairness at each server
|
||||
RequestManagement featuregate.Feature = "RequestManagement"
|
||||
|
||||
// owner: @wojtek-t
|
||||
// alpha: v1.16
|
||||
//
|
||||
// Deprecates and removes SelfLink from ObjectMeta and ListMeta.
|
||||
RemoveSelfLink featuregate.Feature = "RemoveSelfLink"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -156,4 +162,5 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||
WinDSR: {Default: false, PreRelease: featuregate.Alpha},
|
||||
WatchBookmark: {Default: true, PreRelease: featuregate.Beta},
|
||||
RequestManagement: {Default: false, PreRelease: featuregate.Alpha},
|
||||
RemoveSelfLink: {Default: false, PreRelease: featuregate.Alpha},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue