From 64bd0e45894bbd97fe0c455a7d3350f5be5d15da Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Mon, 30 Jul 2018 19:19:21 -0700 Subject: [PATCH] Fix scope.Kind of CONNECT subresources. Make scope.Kind of pod/attach, pod/exec, pod/portforward, node/proxy, service/proxy to their respective subresource Kind, instead of the parent Kind. The kind is used by the admission webhook controller to determine how to convert the object. --- pkg/registry/core/node/rest/proxy.go | 4 ++-- pkg/registry/core/pod/rest/subresources.go | 16 ++++++++-------- pkg/registry/core/service/proxy.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/registry/core/node/rest/proxy.go b/pkg/registry/core/node/rest/proxy.go index 2701d3c0457..40b069978d1 100644 --- a/pkg/registry/core/node/rest/proxy.go +++ b/pkg/registry/core/node/rest/proxy.go @@ -45,9 +45,9 @@ var _ = rest.Connecter(&ProxyREST{}) var proxyMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"} -// New returns an empty service resource +// New returns an empty nodeProxyOptions object. func (r *ProxyREST) New() runtime.Object { - return &api.Node{} + return &api.NodeProxyOptions{} } // ConnectMethods returns the list of HTTP methods that can be proxied diff --git a/pkg/registry/core/pod/rest/subresources.go b/pkg/registry/core/pod/rest/subresources.go index 641237367a7..c914450ee6c 100644 --- a/pkg/registry/core/pod/rest/subresources.go +++ b/pkg/registry/core/pod/rest/subresources.go @@ -46,9 +46,9 @@ var _ = rest.Connecter(&ProxyREST{}) var proxyMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"} -// New returns an empty pod resource +// New returns an empty podProxyOptions object. func (r *ProxyREST) New() runtime.Object { - return &api.Pod{} + return &api.PodProxyOptions{} } // ConnectMethods returns the list of HTTP methods that can be proxied @@ -88,9 +88,9 @@ type AttachREST struct { // Implement Connecter var _ = rest.Connecter(&AttachREST{}) -// New creates a new Pod object +// New creates a new podAttachOptions object. func (r *AttachREST) New() runtime.Object { - return &api.Pod{} + return &api.PodAttachOptions{} } // Connect returns a handler for the pod exec proxy @@ -125,9 +125,9 @@ type ExecREST struct { // Implement Connecter var _ = rest.Connecter(&ExecREST{}) -// New creates a new Pod object +// New creates a new podExecOptions object. func (r *ExecREST) New() runtime.Object { - return &api.Pod{} + return &api.PodExecOptions{} } // Connect returns a handler for the pod exec proxy @@ -162,9 +162,9 @@ type PortForwardREST struct { // Implement Connecter var _ = rest.Connecter(&PortForwardREST{}) -// New returns an empty pod object +// New returns an empty podPortForwardOptions object func (r *PortForwardREST) New() runtime.Object { - return &api.Pod{} + return &api.PodPortForwardOptions{} } // NewConnectOptions returns the versioned object that represents the diff --git a/pkg/registry/core/service/proxy.go b/pkg/registry/core/service/proxy.go index 2ddf87df9ea..ced40db39dd 100644 --- a/pkg/registry/core/service/proxy.go +++ b/pkg/registry/core/service/proxy.go @@ -43,7 +43,7 @@ var proxyMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OP // New returns an empty service resource func (r *ProxyREST) New() runtime.Object { - return &api.Service{} + return &api.ServiceProxyOptions{} } // ConnectMethods returns the list of HTTP methods that can be proxied