mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Remove GetSingularName for subresources
This commit is contained in:
parent
672e0b1e01
commit
1abf94bec3
@ -100,9 +100,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -115,9 +115,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -168,12 +168,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// RollbackREST implements the REST endpoint for initiating the rollback of a deployment
|
// RollbackREST implements the REST endpoint for initiating the rollback of a deployment
|
||||||
type RollbackREST struct {
|
type RollbackREST struct {
|
||||||
store *genericregistry.Store
|
store *genericregistry.Store
|
||||||
@ -204,12 +198,6 @@ func (r *RollbackREST) Destroy() {
|
|||||||
// we don't destroy it here explicitly.
|
// we don't destroy it here explicitly.
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &RollbackREST{}
|
|
||||||
|
|
||||||
func (r *RollbackREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/rollback"
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = rest.NamedCreater(&RollbackREST{})
|
var _ = rest.NamedCreater(&RollbackREST{})
|
||||||
|
|
||||||
// Create runs rollback for deployment
|
// Create runs rollback for deployment
|
||||||
@ -354,12 +342,6 @@ func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, t
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ScaleREST{}
|
|
||||||
|
|
||||||
func (r *ScaleREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/scale"
|
|
||||||
}
|
|
||||||
|
|
||||||
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
||||||
return func(ctx context.Context, obj runtime.Object) error {
|
return func(ctx context.Context, obj runtime.Object) error {
|
||||||
scale, err := scaleFromDeployment(obj.(*apps.Deployment))
|
scale, err := scaleFromDeployment(obj.(*apps.Deployment))
|
||||||
|
@ -164,12 +164,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScaleREST implements a Scale for ReplicaSet.
|
// ScaleREST implements a Scale for ReplicaSet.
|
||||||
type ScaleREST struct {
|
type ScaleREST struct {
|
||||||
store *genericregistry.Store
|
store *genericregistry.Store
|
||||||
@ -244,12 +238,6 @@ func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, t
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ScaleREST{}
|
|
||||||
|
|
||||||
func (r *ScaleREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/scale"
|
|
||||||
}
|
|
||||||
|
|
||||||
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
||||||
return func(ctx context.Context, obj runtime.Object) error {
|
return func(ctx context.Context, obj runtime.Object) error {
|
||||||
scale, err := scaleFromReplicaSet(obj.(*apps.ReplicaSet))
|
scale, err := scaleFromReplicaSet(obj.(*apps.ReplicaSet))
|
||||||
|
@ -152,12 +152,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implement ShortNamesProvider
|
// Implement ShortNamesProvider
|
||||||
var _ rest.ShortNamesProvider = &REST{}
|
var _ rest.ShortNamesProvider = &REST{}
|
||||||
|
|
||||||
@ -238,12 +232,6 @@ func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, t
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ScaleREST{}
|
|
||||||
|
|
||||||
func (r *ScaleREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/scale"
|
|
||||||
}
|
|
||||||
|
|
||||||
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
||||||
return func(ctx context.Context, obj runtime.Object) error {
|
return func(ctx context.Context, obj runtime.Object) error {
|
||||||
scale, err := scaleFromStatefulSet(obj.(*apps.StatefulSet))
|
scale, err := scaleFromStatefulSet(obj.(*apps.StatefulSet))
|
||||||
|
@ -115,9 +115,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -113,9 +113,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -156,9 +156,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -117,12 +117,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = rest.Patcher(&StatusREST{})
|
var _ = rest.Patcher(&StatusREST{})
|
||||||
|
|
||||||
// ApprovalREST implements the REST endpoint for changing the approval state of a CSR.
|
// ApprovalREST implements the REST endpoint for changing the approval state of a CSR.
|
||||||
@ -158,10 +152,4 @@ func (r *ApprovalREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set
|
|||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ApprovalREST{}
|
|
||||||
|
|
||||||
func (r *ApprovalREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/approval"
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = rest.Patcher(&ApprovalREST{})
|
var _ = rest.Patcher(&ApprovalREST{})
|
||||||
|
@ -39,7 +39,7 @@ func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
|
|||||||
NewFunc: func() runtime.Object { return &api.Endpoints{} },
|
NewFunc: func() runtime.Object { return &api.Endpoints{} },
|
||||||
NewListFunc: func() runtime.Object { return &api.EndpointsList{} },
|
NewListFunc: func() runtime.Object { return &api.EndpointsList{} },
|
||||||
DefaultQualifiedResource: api.Resource("endpoints"),
|
DefaultQualifiedResource: api.Resource("endpoints"),
|
||||||
SingularQualifiedResource: api.Resource("endpoint"),
|
SingularQualifiedResource: api.Resource("endpoints"),
|
||||||
|
|
||||||
CreateStrategy: endpoint.Strategy,
|
CreateStrategy: endpoint.Strategy,
|
||||||
UpdateStrategy: endpoint.Strategy,
|
UpdateStrategy: endpoint.Strategy,
|
||||||
|
@ -339,12 +339,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *FinalizeREST) New() runtime.Object {
|
func (r *FinalizeREST) New() runtime.Object {
|
||||||
return r.store.New()
|
return r.store.New()
|
||||||
}
|
}
|
||||||
@ -366,9 +360,3 @@ func (r *FinalizeREST) Update(ctx context.Context, name string, objInfo rest.Upd
|
|||||||
func (r *FinalizeREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
func (r *FinalizeREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &FinalizeREST{}
|
|
||||||
|
|
||||||
func (r *FinalizeREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/finalize"
|
|
||||||
}
|
|
||||||
|
@ -66,12 +66,6 @@ func (r *ProxyREST) NewConnectOptions() (runtime.Object, bool, string) {
|
|||||||
return &api.NodeProxyOptions{}, true, "path"
|
return &api.NodeProxyOptions{}, true, "path"
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ProxyREST{}
|
|
||||||
|
|
||||||
func (r *ProxyREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect returns a handler for the node proxy
|
// Connect returns a handler for the node proxy
|
||||||
func (r *ProxyREST) Connect(ctx context.Context, id string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
func (r *ProxyREST) Connect(ctx context.Context, id string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||||
proxyOpts, ok := opts.(*api.NodeProxyOptions)
|
proxyOpts, ok := opts.(*api.NodeProxyOptions)
|
||||||
|
@ -93,12 +93,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewStorage returns a NodeStorage object that will work against nodes.
|
// NewStorage returns a NodeStorage object that will work against nodes.
|
||||||
func NewStorage(optsGetter generic.RESTOptionsGetter, kubeletClientConfig client.KubeletClientConfig, proxyTransport http.RoundTripper) (*NodeStorage, error) {
|
func NewStorage(optsGetter generic.RESTOptionsGetter, kubeletClientConfig client.KubeletClientConfig, proxyTransport http.RoundTripper) (*NodeStorage, error) {
|
||||||
store := &genericregistry.Store{
|
store := &genericregistry.Store{
|
||||||
|
@ -110,9 +110,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -154,9 +154,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -133,9 +133,3 @@ func (r *LogREST) OverrideMetricsVerb(oldVerb string) (newVerb string) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &LogREST{}
|
|
||||||
|
|
||||||
func (r *LogREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/log"
|
|
||||||
}
|
|
||||||
|
@ -80,12 +80,6 @@ func (r *ProxyREST) Connect(ctx context.Context, id string, opts runtime.Object,
|
|||||||
return newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder), nil
|
return newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ProxyREST{}
|
|
||||||
|
|
||||||
func (r *ProxyREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Support both GET and POST methods. We must support GET for browsers that want to use WebSockets.
|
// Support both GET and POST methods. We must support GET for browsers that want to use WebSockets.
|
||||||
var upgradeableMethods = []string{"GET", "POST"}
|
var upgradeableMethods = []string{"GET", "POST"}
|
||||||
|
|
||||||
@ -132,12 +126,6 @@ func (r *AttachREST) ConnectMethods() []string {
|
|||||||
return upgradeableMethods
|
return upgradeableMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &AttachREST{}
|
|
||||||
|
|
||||||
func (r *AttachREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/attach"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExecREST implements the exec subresource for a Pod
|
// ExecREST implements the exec subresource for a Pod
|
||||||
type ExecREST struct {
|
type ExecREST struct {
|
||||||
Store *genericregistry.Store
|
Store *genericregistry.Store
|
||||||
@ -181,12 +169,6 @@ func (r *ExecREST) ConnectMethods() []string {
|
|||||||
return upgradeableMethods
|
return upgradeableMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ExecREST{}
|
|
||||||
|
|
||||||
func (r *ExecREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/exec"
|
|
||||||
}
|
|
||||||
|
|
||||||
// PortForwardREST implements the portforward subresource for a Pod
|
// PortForwardREST implements the portforward subresource for a Pod
|
||||||
type PortForwardREST struct {
|
type PortForwardREST struct {
|
||||||
Store *genericregistry.Store
|
Store *genericregistry.Store
|
||||||
@ -231,12 +213,6 @@ func (r *PortForwardREST) Connect(ctx context.Context, name string, opts runtime
|
|||||||
return newThrottledUpgradeAwareProxyHandler(location, transport, false, true, responder), nil
|
return newThrottledUpgradeAwareProxyHandler(location, transport, false, true, responder), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &PortForwardREST{}
|
|
||||||
|
|
||||||
func (r *PortForwardREST) GetSingularName() string {
|
|
||||||
return r.Store.GetSingularName() + "/portforward"
|
|
||||||
}
|
|
||||||
|
|
||||||
func newThrottledUpgradeAwareProxyHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder rest.Responder) *proxy.UpgradeAwareHandler {
|
func newThrottledUpgradeAwareProxyHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder rest.Responder) *proxy.UpgradeAwareHandler {
|
||||||
handler := proxy.NewUpgradeAwareHandler(location, transport, wrapTransport, upgradeRequired, proxy.NewErrorResponder(responder))
|
handler := proxy.NewUpgradeAwareHandler(location, transport, wrapTransport, upgradeRequired, proxy.NewErrorResponder(responder))
|
||||||
handler.MaxBytesPerSec = capabilities.Get().PerConnectionBandwidthLimitBytesPerSec
|
handler.MaxBytesPerSec = capabilities.Get().PerConnectionBandwidthLimitBytesPerSec
|
||||||
|
@ -103,12 +103,6 @@ func (r *EvictionREST) Destroy() {
|
|||||||
// we don't destroy it here explicitly.
|
// we don't destroy it here explicitly.
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &EvictionREST{}
|
|
||||||
|
|
||||||
func (r *EvictionREST) GetSingularName() string {
|
|
||||||
return "pod/eviction"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Propagate dry-run takes the dry-run option from the request and pushes it into the eviction object.
|
// Propagate dry-run takes the dry-run option from the request and pushes it into the eviction object.
|
||||||
// It returns an error if they have non-matching dry-run options.
|
// It returns an error if they have non-matching dry-run options.
|
||||||
func propagateDryRun(eviction *policy.Eviction, options *metav1.CreateOptions) (*metav1.DeleteOptions, error) {
|
func propagateDryRun(eviction *policy.Eviction, options *metav1.CreateOptions) (*metav1.DeleteOptions, error) {
|
||||||
|
@ -164,12 +164,6 @@ func (r *BindingREST) Destroy() {
|
|||||||
// we don't destroy it here explicitly.
|
// we don't destroy it here explicitly.
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &BindingREST{}
|
|
||||||
|
|
||||||
func (r *BindingREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/binding"
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = rest.NamedCreater(&BindingREST{})
|
var _ = rest.NamedCreater(&BindingREST{})
|
||||||
|
|
||||||
// Create ensures a pod is bound to a specific host.
|
// Create ensures a pod is bound to a specific host.
|
||||||
@ -338,12 +332,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// EphemeralContainersREST implements the REST endpoint for adding EphemeralContainers
|
// EphemeralContainersREST implements the REST endpoint for adding EphemeralContainers
|
||||||
type EphemeralContainersREST struct {
|
type EphemeralContainersREST struct {
|
||||||
store *genericregistry.Store
|
store *genericregistry.Store
|
||||||
@ -373,9 +361,3 @@ func (r *EphemeralContainersREST) Update(ctx context.Context, name string, objIn
|
|||||||
// subresources should never allow create on update.
|
// subresources should never allow create on update.
|
||||||
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)
|
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &EphemeralContainersREST{}
|
|
||||||
|
|
||||||
func (r *EphemeralContainersREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/ephemeralcontainers"
|
|
||||||
}
|
|
||||||
|
@ -159,12 +159,6 @@ func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object,
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
type ScaleREST struct {
|
type ScaleREST struct {
|
||||||
store *genericregistry.Store
|
store *genericregistry.Store
|
||||||
}
|
}
|
||||||
@ -223,12 +217,6 @@ func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, t
|
|||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ScaleREST{}
|
|
||||||
|
|
||||||
func (r *ScaleREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/scale"
|
|
||||||
}
|
|
||||||
|
|
||||||
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
|
||||||
return func(ctx context.Context, obj runtime.Object) error {
|
return func(ctx context.Context, obj runtime.Object) error {
|
||||||
return f(ctx, scaleFromRC(obj.(*api.ReplicationController)))
|
return f(ctx, scaleFromRC(obj.(*api.ReplicationController)))
|
||||||
|
@ -109,9 +109,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -77,12 +77,6 @@ func (r *ProxyREST) Connect(ctx context.Context, id string, opts runtime.Object,
|
|||||||
return newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder), nil
|
return newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &ProxyREST{}
|
|
||||||
|
|
||||||
func (r *ProxyREST) GetSingularName() string {
|
|
||||||
return "service/proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
func newThrottledUpgradeAwareProxyHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder rest.Responder) *proxy.UpgradeAwareHandler {
|
func newThrottledUpgradeAwareProxyHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder rest.Responder) *proxy.UpgradeAwareHandler {
|
||||||
handler := proxy.NewUpgradeAwareHandler(location, transport, wrapTransport, upgradeRequired, proxy.NewErrorResponder(responder))
|
handler := proxy.NewUpgradeAwareHandler(location, transport, wrapTransport, upgradeRequired, proxy.NewErrorResponder(responder))
|
||||||
handler.MaxBytesPerSec = capabilities.Get().PerConnectionBandwidthLimitBytesPerSec
|
handler.MaxBytesPerSec = capabilities.Get().PerConnectionBandwidthLimitBytesPerSec
|
||||||
|
@ -196,12 +196,6 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have a lot of functions that take a pair of "before" and "after" or
|
// We have a lot of functions that take a pair of "before" and "after" or
|
||||||
// "oldSvc" and "newSvc" args. Convention across the codebase is to pass them
|
// "oldSvc" and "newSvc" args. Convention across the codebase is to pass them
|
||||||
// as (new, old), but it's easy to screw up when they are the same type.
|
// as (new, old), but it's easy to screw up when they are the same type.
|
||||||
|
@ -49,12 +49,6 @@ func (r *TokenREST) Destroy() {
|
|||||||
// here explicitly.
|
// here explicitly.
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &TokenREST{}
|
|
||||||
|
|
||||||
func (r *TokenREST) GetSingularName() string {
|
|
||||||
return "serviceaccount/token"
|
|
||||||
}
|
|
||||||
|
|
||||||
type TokenREST struct {
|
type TokenREST struct {
|
||||||
svcaccts getter
|
svcaccts getter
|
||||||
pods getter
|
pods getter
|
||||||
|
@ -108,9 +108,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -108,9 +108,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -107,9 +107,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -105,9 +105,3 @@ func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.Updat
|
|||||||
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -104,9 +104,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -112,9 +112,3 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
|||||||
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
|
||||||
return r.store.ConvertToTable(ctx, object, tableOptions)
|
return r.store.ConvertToTable(ctx, object, tableOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -218,9 +218,3 @@ func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.Updat
|
|||||||
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rest.SingularNameProvider = &StatusREST{}
|
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
@ -1080,11 +1080,13 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
if categoriesProvider, ok := storage.(rest.CategoriesProvider); ok {
|
if categoriesProvider, ok := storage.(rest.CategoriesProvider); ok {
|
||||||
apiResource.Categories = categoriesProvider.Categories()
|
apiResource.Categories = categoriesProvider.Categories()
|
||||||
}
|
}
|
||||||
singularNameProvider, ok := storage.(rest.SingularNameProvider)
|
if !isSubresource {
|
||||||
if !ok {
|
singularNameProvider, ok := storage.(rest.SingularNameProvider)
|
||||||
return nil, nil, fmt.Errorf("resource %s must implement SingularNameProvider", resource)
|
if !ok {
|
||||||
|
return nil, nil, fmt.Errorf("resource %s must implement SingularNameProvider", resource)
|
||||||
|
}
|
||||||
|
apiResource.SingularName = singularNameProvider.GetSingularName()
|
||||||
}
|
}
|
||||||
apiResource.SingularName = singularNameProvider.GetSingularName()
|
|
||||||
|
|
||||||
if gvkProvider, ok := storage.(rest.GroupVersionKindProvider); ok {
|
if gvkProvider, ok := storage.(rest.GroupVersionKindProvider); ok {
|
||||||
gvk := gvkProvider.GroupVersionKind(a.group.GroupVersion)
|
gvk := gvkProvider.GroupVersionKind(a.group.GroupVersion)
|
||||||
|
@ -170,7 +170,3 @@ func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.Updat
|
|||||||
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
|
||||||
return r.store.GetResetFields()
|
return r.store.GetResetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *StatusREST) GetSingularName() string {
|
|
||||||
return r.store.GetSingularName() + "/status"
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user