mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Deprecate SelfLink + featuregate for setting it
This commit is contained in:
parent
399d09ce4a
commit
3bf4eb7072
@ -61,6 +61,10 @@ type ListMeta struct {
|
|||||||
// selfLink is a URL representing this object.
|
// selfLink is a URL representing this object.
|
||||||
// Populated by the system.
|
// Populated by the system.
|
||||||
// Read-only.
|
// Read-only.
|
||||||
|
//
|
||||||
|
// DEPRECATED
|
||||||
|
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||||
|
// to be removed in 1.21 release.
|
||||||
// +optional
|
// +optional
|
||||||
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
|
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,1,opt,name=selfLink"`
|
||||||
|
|
||||||
@ -148,6 +152,10 @@ type ObjectMeta struct {
|
|||||||
// SelfLink is a URL representing this object.
|
// SelfLink is a URL representing this object.
|
||||||
// Populated by the system.
|
// Populated by the system.
|
||||||
// Read-only.
|
// Read-only.
|
||||||
|
//
|
||||||
|
// DEPRECATED
|
||||||
|
// Kubernetes will stop propagating this field in 1.20 release and the field is planned
|
||||||
|
// to be removed in 1.21 release.
|
||||||
// +optional
|
// +optional
|
||||||
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
|
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,4,opt,name=selfLink"`
|
||||||
|
|
||||||
|
@ -224,12 +224,7 @@ func PatchResource(r rest.Patcher, scope *RequestScope, admit admission.Interfac
|
|||||||
}
|
}
|
||||||
trace.Step("Object stored in database")
|
trace.Step("Object stored in database")
|
||||||
|
|
||||||
requestInfo, ok := request.RequestInfoFrom(ctx)
|
if err := setObjectSelfLink(ctx, result, req, scope.Namer); err != nil {
|
||||||
if !ok {
|
|
||||||
scope.err(fmt.Errorf("missing requestInfo"), w, req)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := setSelfLink(result, requestInfo, scope.Namer); err != nil {
|
|
||||||
scope.err(err, w, req)
|
scope.err(err, w, req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,9 @@ import (
|
|||||||
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
|
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
|
||||||
"k8s.io/apiserver/pkg/endpoints/metrics"
|
"k8s.io/apiserver/pkg/endpoints/metrics"
|
||||||
"k8s.io/apiserver/pkg/endpoints/request"
|
"k8s.io/apiserver/pkg/endpoints/request"
|
||||||
|
"k8s.io/apiserver/pkg/features"
|
||||||
"k8s.io/apiserver/pkg/registry/rest"
|
"k8s.io/apiserver/pkg/registry/rest"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/klog"
|
"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
|
// TODO: remove the need for the namer LinkSetters by requiring objects implement either Object or List
|
||||||
// interfaces
|
// interfaces
|
||||||
func setObjectSelfLink(ctx context.Context, obj runtime.Object, req *http.Request, namer ScopeNamer) error {
|
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
|
// 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
|
// 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.
|
// 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
|
// Enables managing request concurrency with prioritization and fairness at each server
|
||||||
RequestManagement featuregate.Feature = "RequestManagement"
|
RequestManagement featuregate.Feature = "RequestManagement"
|
||||||
|
|
||||||
|
// owner: @wojtek-t
|
||||||
|
// alpha: v1.16
|
||||||
|
//
|
||||||
|
// Deprecates and removes SelfLink from ObjectMeta and ListMeta.
|
||||||
|
RemoveSelfLink featuregate.Feature = "RemoveSelfLink"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -156,4 +162,5 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
WinDSR: {Default: false, PreRelease: featuregate.Alpha},
|
WinDSR: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
WatchBookmark: {Default: true, PreRelease: featuregate.Beta},
|
WatchBookmark: {Default: true, PreRelease: featuregate.Beta},
|
||||||
RequestManagement: {Default: false, PreRelease: featuregate.Alpha},
|
RequestManagement: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
RemoveSelfLink: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user