Merge pull request #80978 from wojtek-t/selflink_deprecation
Deprecate SelfLink and introduce feature gate to disable its propagation Kubernetes-commit: ef8869466c803fbbe44a411a8a2e3e37c7f1d1d2
This commit is contained in:
commit
55e10d750f
|
|
@ -416,11 +416,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/apimachinery",
|
"ImportPath": "k8s.io/apimachinery",
|
||||||
"Rev": "162a2dabc72f"
|
"Rev": "4a63d48c5dc1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go",
|
"ImportPath": "k8s.io/client-go",
|
||||||
"Rev": "4fd06e107451"
|
"Rev": "dafe3c5e1851"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/component-base",
|
"ImportPath": "k8s.io/component-base",
|
||||||
|
|
|
||||||
8
go.mod
8
go.mod
|
|
@ -53,8 +53,8 @@ require (
|
||||||
gopkg.in/yaml.v2 v2.2.2
|
gopkg.in/yaml.v2 v2.2.2
|
||||||
gotest.tools v2.2.0+incompatible // indirect
|
gotest.tools v2.2.0+incompatible // indirect
|
||||||
k8s.io/api v0.0.0-20190806064354-8b51d7113622
|
k8s.io/api v0.0.0-20190806064354-8b51d7113622
|
||||||
k8s.io/apimachinery v0.0.0-20190806215851-162a2dabc72f
|
k8s.io/apimachinery v0.0.0-20190808140701-4a63d48c5dc1
|
||||||
k8s.io/client-go v0.0.0-20190807061213-4fd06e107451
|
k8s.io/client-go v0.0.0-20190808141243-dafe3c5e1851
|
||||||
k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0
|
k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0
|
||||||
k8s.io/klog v0.3.1
|
k8s.io/klog v0.3.1
|
||||||
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
|
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058
|
||||||
|
|
@ -71,7 +71,7 @@ replace (
|
||||||
golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
|
golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
|
||||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190313210603-aa82965741a9
|
golang.org/x/tools => golang.org/x/tools v0.0.0-20190313210603-aa82965741a9
|
||||||
k8s.io/api => k8s.io/api v0.0.0-20190806064354-8b51d7113622
|
k8s.io/api => k8s.io/api v0.0.0-20190806064354-8b51d7113622
|
||||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190806215851-162a2dabc72f
|
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190808140701-4a63d48c5dc1
|
||||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190807061213-4fd06e107451
|
k8s.io/client-go => k8s.io/client-go v0.0.0-20190808141243-dafe3c5e1851
|
||||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0
|
k8s.io/component-base => k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0
|
||||||
)
|
)
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -222,8 +222,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||||
k8s.io/api v0.0.0-20190806064354-8b51d7113622/go.mod h1:SgXHCRh94q+5GrRf9Dty2ZG8+wCVmqvQbZJXXcAswkw=
|
k8s.io/api v0.0.0-20190806064354-8b51d7113622/go.mod h1:SgXHCRh94q+5GrRf9Dty2ZG8+wCVmqvQbZJXXcAswkw=
|
||||||
k8s.io/apimachinery v0.0.0-20190806215851-162a2dabc72f/go.mod h1:+ntn62igV2hyNj7/0brOvXSMONE2KxcePkSxK7/9FFQ=
|
k8s.io/apimachinery v0.0.0-20190808140701-4a63d48c5dc1/go.mod h1:+ntn62igV2hyNj7/0brOvXSMONE2KxcePkSxK7/9FFQ=
|
||||||
k8s.io/client-go v0.0.0-20190807061213-4fd06e107451/go.mod h1:RW3J3c0otV+R6G3oq1FpjifMKdKu05RyENQ9/UqhBdk=
|
k8s.io/client-go v0.0.0-20190808141243-dafe3c5e1851/go.mod h1:ctmUC94qr+uRHonWS+WhRNFKTxg7XqMA455j7JfWM14=
|
||||||
k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0/go.mod h1:SbX3ww4xiCxqQFA4pJgdbgBGm1776AVbtJDXsfvNRXA=
|
k8s.io/component-base v0.0.0-20190807101431-d6d4632c35d0/go.mod h1:SbX3ww4xiCxqQFA4pJgdbgBGm1776AVbtJDXsfvNRXA=
|
||||||
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||||
|
|
|
||||||
|
|
@ -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