From 929a84808f4dca88074e36da8bb21cc75549130c Mon Sep 17 00:00:00 2001 From: deads2k Date: Wed, 18 Jan 2017 16:23:46 -0500 Subject: [PATCH 1/4] update client-go --- .../k8s.io/client-go/kubernetes/clientset.go | 30 +- .../src/k8s.io/client-go/kubernetes/doc.go | 2 +- .../kubernetes/fake/clientset_generated.go | 17 +- .../k8s.io/client-go/kubernetes/fake/doc.go | 2 +- .../kubernetes/typed/apps/v1beta1/doc.go | 2 +- .../kubernetes/typed/apps/v1beta1/fake/doc.go | 2 +- .../typed/authentication/v1beta1/doc.go | 2 +- .../typed/authentication/v1beta1/fake/doc.go | 2 +- .../typed/authorization/v1beta1/doc.go | 2 +- .../typed/authorization/v1beta1/fake/doc.go | 2 +- .../kubernetes/typed/autoscaling/v1/doc.go | 2 +- .../typed/autoscaling/v1/fake/doc.go | 2 +- .../kubernetes/typed/batch/v1/doc.go | 2 +- .../kubernetes/typed/batch/v1/fake/doc.go | 2 +- .../kubernetes/typed/batch/v2alpha1/doc.go | 2 +- .../typed/batch/v2alpha1/fake/doc.go | 2 +- .../typed/certificates/v1alpha1/doc.go | 2 +- .../typed/certificates/v1alpha1/fake/doc.go | 2 +- .../client-go/kubernetes/typed/core/v1/doc.go | 2 +- .../kubernetes/typed/core/v1/fake/doc.go | 2 +- .../typed/extensions/v1beta1/doc.go | 2 +- .../typed/extensions/v1beta1/fake/doc.go | 2 +- .../kubernetes/typed/policy/v1beta1/doc.go | 2 +- .../typed/policy/v1beta1/fake/doc.go | 2 +- .../kubernetes/typed/rbac/v1alpha1/doc.go | 2 +- .../typed/rbac/v1alpha1/fake/doc.go | 2 +- .../typed/rbac/v1beta1/clusterrole.go | 146 + .../typed/rbac/v1beta1/clusterrolebinding.go | 146 + .../kubernetes/typed/rbac/v1beta1/doc.go | 20 + .../kubernetes/typed/rbac/v1beta1/fake/doc.go | 20 + .../rbac/v1beta1/fake/fake_clusterrole.go | 111 + .../v1beta1/fake/fake_clusterrolebinding.go | 111 + .../rbac/v1beta1/fake/fake_rbac_client.go | 50 + .../typed/rbac/v1beta1/fake/fake_role.go | 119 + .../rbac/v1beta1/fake/fake_rolebinding.go | 119 + .../typed/rbac/v1beta1/generated_expansion.go | 25 + .../typed/rbac/v1beta1/rbac_client.go | 112 + .../kubernetes/typed/rbac/v1beta1/role.go | 156 + .../typed/rbac/v1beta1/rolebinding.go | 156 + .../kubernetes/typed/storage/v1beta1/doc.go | 2 +- .../typed/storage/v1beta1/fake/doc.go | 2 +- .../src/k8s.io/client-go/pkg/api/helpers.go | 38 - staging/src/k8s.io/client-go/pkg/api/json.go | 40 + .../pkg/apis/rbac/install/install.go | 4 +- .../k8s.io/client-go/pkg/apis/rbac/types.go | 6 +- .../pkg/apis/rbac/v1alpha1/generated.pb.go | 176 +- .../pkg/apis/rbac/v1alpha1/generated.proto | 5 - .../pkg/apis/rbac/v1alpha1/types.generated.go | 336 +- .../client-go/pkg/apis/rbac/v1alpha1/types.go | 5 - .../v1alpha1/types_swagger_doc_generated.go | 13 +- .../rbac/v1alpha1/zz_generated.conversion.go | 102 +- .../rbac/v1alpha1/zz_generated.deepcopy.go | 5 - .../pkg/apis/rbac/v1beta1/defaults.go | 40 + .../client-go/pkg/apis/rbac/v1beta1/doc.go | 18 + .../pkg/apis/rbac/v1beta1/generated.pb.go | 2817 ++++++++++ .../pkg/apis/rbac/v1beta1/generated.proto | 198 + .../pkg/apis/rbac/v1beta1/helpers.go | 146 + .../pkg/apis/rbac/v1beta1/register.go | 61 + .../pkg/apis/rbac/v1beta1/types.generated.go | 4879 +++++++++++++++++ .../client-go/pkg/apis/rbac/v1beta1/types.go | 202 + .../v1beta1/types_swagger_doc_generated.go | 148 + .../rbac/v1beta1/zz_generated.conversion.go | 353 ++ .../rbac/v1beta1/zz_generated.deepcopy.go | 262 + .../rbac/v1beta1/zz_generated.defaults.go | 58 + .../pkg/apis/rbac/zz_generated.deepcopy.go | 8 - 65 files changed, 10789 insertions(+), 521 deletions(-) create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go create mode 100644 staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go create mode 100644 staging/src/k8s.io/client-go/pkg/api/json.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.proto create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go create mode 100644 staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go diff --git a/staging/src/k8s.io/client-go/kubernetes/clientset.go b/staging/src/k8s.io/client-go/kubernetes/clientset.go index d05d1ec0f0..05fef0cc67 100644 --- a/staging/src/k8s.io/client-go/kubernetes/clientset.go +++ b/staging/src/k8s.io/client-go/kubernetes/clientset.go @@ -30,6 +30,7 @@ import ( v1beta1extensions "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" v1beta1policy "k8s.io/client-go/kubernetes/typed/policy/v1beta1" v1alpha1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" + v1beta1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" v1beta1storage "k8s.io/client-go/kubernetes/typed/storage/v1beta1" "k8s.io/client-go/pkg/util/flowcontrol" _ "k8s.io/client-go/plugin/pkg/client/auth" @@ -67,9 +68,11 @@ type Interface interface { PolicyV1beta1() v1beta1policy.PolicyV1beta1Interface // Deprecated: please explicitly pick a version if possible. Policy() v1beta1policy.PolicyV1beta1Interface - RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface + RbacV1beta1() v1beta1rbac.RbacV1beta1Interface // Deprecated: please explicitly pick a version if possible. - Rbac() v1alpha1rbac.RbacV1alpha1Interface + Rbac() v1beta1rbac.RbacV1beta1Interface + RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface + StorageV1beta1() v1beta1storage.StorageV1beta1Interface // Deprecated: please explicitly pick a version if possible. Storage() v1beta1storage.StorageV1beta1Interface @@ -89,6 +92,7 @@ type Clientset struct { *v1alpha1certificates.CertificatesV1alpha1Client *v1beta1extensions.ExtensionsV1beta1Client *v1beta1policy.PolicyV1beta1Client + *v1beta1rbac.RbacV1beta1Client *v1alpha1rbac.RbacV1alpha1Client *v1beta1storage.StorageV1beta1Client } @@ -254,17 +258,25 @@ func (c *Clientset) Policy() v1beta1policy.PolicyV1beta1Interface { return c.PolicyV1beta1Client } -// RbacV1alpha1 retrieves the RbacV1alpha1Client -func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface { +// RbacV1beta1 retrieves the RbacV1beta1Client +func (c *Clientset) RbacV1beta1() v1beta1rbac.RbacV1beta1Interface { if c == nil { return nil } - return c.RbacV1alpha1Client + return c.RbacV1beta1Client } // Deprecated: Rbac retrieves the default version of RbacClient. // Please explicitly pick a version. -func (c *Clientset) Rbac() v1alpha1rbac.RbacV1alpha1Interface { +func (c *Clientset) Rbac() v1beta1rbac.RbacV1beta1Interface { + if c == nil { + return nil + } + return c.RbacV1beta1Client +} + +// RbacV1alpha1 retrieves the RbacV1alpha1Client +func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface { if c == nil { return nil } @@ -344,6 +356,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.RbacV1beta1Client, err = v1beta1rbac.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -375,6 +391,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c) cs.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c) cs.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c) + cs.RbacV1beta1Client = v1beta1rbac.NewForConfigOrDie(c) cs.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c) cs.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c) @@ -395,6 +412,7 @@ func New(c rest.Interface) *Clientset { cs.CertificatesV1alpha1Client = v1alpha1certificates.New(c) cs.ExtensionsV1beta1Client = v1beta1extensions.New(c) cs.PolicyV1beta1Client = v1beta1policy.New(c) + cs.RbacV1beta1Client = v1beta1rbac.New(c) cs.RbacV1alpha1Client = v1alpha1rbac.New(c) cs.StorageV1beta1Client = v1beta1storage.New(c) diff --git a/staging/src/k8s.io/client-go/kubernetes/doc.go b/staging/src/k8s.io/client-go/kubernetes/doc.go index 5c74fd7129..1f456969be 100644 --- a/staging/src/k8s.io/client-go/kubernetes/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated clientset. package kubernetes diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go index fe707f61c4..cba1cc1df0 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go @@ -44,6 +44,8 @@ import ( fakev1beta1policy "k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake" v1alpha1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" fakev1alpha1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake" + v1beta1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" + fakev1beta1rbac "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake" v1beta1storage "k8s.io/client-go/kubernetes/typed/storage/v1beta1" fakev1beta1storage "k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake" "k8s.io/client-go/pkg/api" @@ -178,13 +180,18 @@ func (c *Clientset) Policy() v1beta1policy.PolicyV1beta1Interface { return &fakev1beta1policy.FakePolicyV1beta1{Fake: &c.Fake} } -// RbacV1alpha1 retrieves the RbacV1alpha1Client -func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface { - return &fakev1alpha1rbac.FakeRbacV1alpha1{Fake: &c.Fake} +// RbacV1beta1 retrieves the RbacV1beta1Client +func (c *Clientset) RbacV1beta1() v1beta1rbac.RbacV1beta1Interface { + return &fakev1beta1rbac.FakeRbacV1beta1{Fake: &c.Fake} } -// Rbac retrieves the RbacV1alpha1Client -func (c *Clientset) Rbac() v1alpha1rbac.RbacV1alpha1Interface { +// Rbac retrieves the RbacV1beta1Client +func (c *Clientset) Rbac() v1beta1rbac.RbacV1beta1Interface { + return &fakev1beta1rbac.FakeRbacV1beta1{Fake: &c.Fake} +} + +// RbacV1alpha1 retrieves the RbacV1alpha1Client +func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface { return &fakev1alpha1rbac.FakeRbacV1alpha1{Fake: &c.Fake} } diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/fake/doc.go index ab373a8744..148b6ba36e 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated fake clientset. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go index acd71f2582..2e092f9d26 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go index acd71f2582..2e092f9d26 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go index 59c111e74b..3efa436160 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v2alpha1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/doc.go index f7b1fe6671..b6c14d6a9d 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1alpha1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/certificates/v1alpha1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/doc.go index acd71f2582..2e092f9d26 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go index f7b1fe6671..b6c14d6a9d 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1alpha1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go new file mode 100644 index 0000000000..23d36359cb --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go @@ -0,0 +1,146 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + api "k8s.io/client-go/pkg/api" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + rest "k8s.io/client-go/rest" +) + +// ClusterRolesGetter has a method to return a ClusterRoleInterface. +// A group's client should implement this interface. +type ClusterRolesGetter interface { + ClusterRoles() ClusterRoleInterface +} + +// ClusterRoleInterface has methods to work with ClusterRole resources. +type ClusterRoleInterface interface { + Create(*v1beta1.ClusterRole) (*v1beta1.ClusterRole, error) + Update(*v1beta1.ClusterRole) (*v1beta1.ClusterRole, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1beta1.ClusterRole, error) + List(opts v1.ListOptions) (*v1beta1.ClusterRoleList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRole, err error) + ClusterRoleExpansion +} + +// clusterRoles implements ClusterRoleInterface +type clusterRoles struct { + client rest.Interface +} + +// newClusterRoles returns a ClusterRoles +func newClusterRoles(c *RbacV1beta1Client) *clusterRoles { + return &clusterRoles{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Create(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) { + result = &v1beta1.ClusterRole{} + err = c.client.Post(). + Resource("clusterroles"). + Body(clusterRole). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Update(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) { + result = &v1beta1.ClusterRole{} + err = c.client.Put(). + Resource("clusterroles"). + Name(clusterRole.Name). + Body(clusterRole). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. +func (c *clusterRoles) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterroles"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterroles"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. +func (c *clusterRoles) Get(name string, options meta_v1.GetOptions) (result *v1beta1.ClusterRole, err error) { + result = &v1beta1.ClusterRole{} + err = c.client.Get(). + Resource("clusterroles"). + Name(name). + VersionedParams(&options, api.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. +func (c *clusterRoles) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleList, err error) { + result = &v1beta1.ClusterRoleList{} + err = c.client.Get(). + Resource("clusterroles"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *clusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("clusterroles"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *clusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRole, err error) { + result = &v1beta1.ClusterRole{} + err = c.client.Patch(pt). + Resource("clusterroles"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 0000000000..17b4f8b4e6 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,146 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + api "k8s.io/client-go/pkg/api" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + rest "k8s.io/client-go/rest" +) + +// ClusterRoleBindingsGetter has a method to return a ClusterRoleBindingInterface. +// A group's client should implement this interface. +type ClusterRoleBindingsGetter interface { + ClusterRoleBindings() ClusterRoleBindingInterface +} + +// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources. +type ClusterRoleBindingInterface interface { + Create(*v1beta1.ClusterRoleBinding) (*v1beta1.ClusterRoleBinding, error) + Update(*v1beta1.ClusterRoleBinding) (*v1beta1.ClusterRoleBinding, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1beta1.ClusterRoleBinding, error) + List(opts v1.ListOptions) (*v1beta1.ClusterRoleBindingList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) + ClusterRoleBindingExpansion +} + +// clusterRoleBindings implements ClusterRoleBindingInterface +type clusterRoleBindings struct { + client rest.Interface +} + +// newClusterRoleBindings returns a ClusterRoleBindings +func newClusterRoleBindings(c *RbacV1beta1Client) *clusterRoleBindings { + return &clusterRoleBindings{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Create(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) { + result = &v1beta1.ClusterRoleBinding{} + err = c.client.Post(). + Resource("clusterrolebindings"). + Body(clusterRoleBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Update(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) { + result = &v1beta1.ClusterRoleBinding{} + err = c.client.Put(). + Resource("clusterrolebindings"). + Name(clusterRoleBinding.Name). + Body(clusterRoleBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. +func (c *clusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterrolebindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterrolebindings"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. +func (c *clusterRoleBindings) Get(name string, options meta_v1.GetOptions) (result *v1beta1.ClusterRoleBinding, err error) { + result = &v1beta1.ClusterRoleBinding{} + err = c.client.Get(). + Resource("clusterrolebindings"). + Name(name). + VersionedParams(&options, api.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. +func (c *clusterRoleBindings) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleBindingList, err error) { + result = &v1beta1.ClusterRoleBindingList{} + err = c.client.Get(). + Resource("clusterrolebindings"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *clusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Resource("clusterrolebindings"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *clusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) { + result = &v1beta1.ClusterRoleBinding{} + err = c.client.Patch(pt). + Resource("clusterrolebindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go new file mode 100644 index 0000000000..2bbf9dc1bd --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] + +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go new file mode 100644 index 0000000000..b28ae934af --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] + +// Package fake has the automatically generated clients. +package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go new file mode 100644 index 0000000000..a36bf6d73d --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go @@ -0,0 +1,111 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoles implements ClusterRoleInterface +type FakeClusterRoles struct { + Fake *FakeRbacV1beta1 +} + +var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterroles"} + +func (c *FakeClusterRoles) Create(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &v1beta1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRole), err +} + +func (c *FakeClusterRoles) Update(clusterRole *v1beta1.ClusterRole) (result *v1beta1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &v1beta1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRole), err +} + +func (c *FakeClusterRoles) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &v1beta1.ClusterRole{}) + return err +} + +func (c *FakeClusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.ClusterRoleList{}) + return err +} + +func (c *FakeClusterRoles) Get(name string, options meta_v1.GetOptions) (result *v1beta1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolesResource, name), &v1beta1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRole), err +} + +func (c *FakeClusterRoles) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolesResource, opts), &v1beta1.ClusterRoleList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.ClusterRoleList{} + for _, item := range obj.(*v1beta1.ClusterRoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *FakeClusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts)) +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *FakeClusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, data, subresources...), &v1beta1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRole), err +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go new file mode 100644 index 0000000000..d682d5574b --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go @@ -0,0 +1,111 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoleBindings implements ClusterRoleBindingInterface +type FakeClusterRoleBindings struct { + Fake *FakeRbacV1beta1 +} + +var clusterrolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterrolebindings"} + +func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &v1beta1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRoleBinding), err +} + +func (c *FakeClusterRoleBindings) Update(clusterRoleBinding *v1beta1.ClusterRoleBinding) (result *v1beta1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &v1beta1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRoleBinding), err +} + +func (c *FakeClusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterrolebindingsResource, name), &v1beta1.ClusterRoleBinding{}) + return err +} + +func (c *FakeClusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.ClusterRoleBindingList{}) + return err +} + +func (c *FakeClusterRoleBindings) Get(name string, options meta_v1.GetOptions) (result *v1beta1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &v1beta1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRoleBinding), err +} + +func (c *FakeClusterRoleBindings) List(opts v1.ListOptions) (result *v1beta1.ClusterRoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolebindingsResource, opts), &v1beta1.ClusterRoleBindingList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.ClusterRoleBindingList{} + for _, item := range obj.(*v1beta1.ClusterRoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *FakeClusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts)) +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *FakeClusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, data, subresources...), &v1beta1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1beta1.ClusterRoleBinding), err +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go new file mode 100644 index 0000000000..929d035293 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go @@ -0,0 +1,50 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + v1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRbacV1beta1 struct { + *testing.Fake +} + +func (c *FakeRbacV1beta1) ClusterRoles() v1beta1.ClusterRoleInterface { + return &FakeClusterRoles{c} +} + +func (c *FakeRbacV1beta1) ClusterRoleBindings() v1beta1.ClusterRoleBindingInterface { + return &FakeClusterRoleBindings{c} +} + +func (c *FakeRbacV1beta1) Roles(namespace string) v1beta1.RoleInterface { + return &FakeRoles{c, namespace} +} + +func (c *FakeRbacV1beta1) RoleBindings(namespace string) v1beta1.RoleBindingInterface { + return &FakeRoleBindings{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRbacV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go new file mode 100644 index 0000000000..639298e96c --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go @@ -0,0 +1,119 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + testing "k8s.io/client-go/testing" +) + +// FakeRoles implements RoleInterface +type FakeRoles struct { + Fake *FakeRbacV1beta1 + ns string +} + +var rolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "roles"} + +func (c *FakeRoles) Create(role *v1beta1.Role) (result *v1beta1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &v1beta1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Role), err +} + +func (c *FakeRoles) Update(role *v1beta1.Role) (result *v1beta1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &v1beta1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Role), err +} + +func (c *FakeRoles) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(rolesResource, c.ns, name), &v1beta1.Role{}) + + return err +} + +func (c *FakeRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.RoleList{}) + return err +} + +func (c *FakeRoles) Get(name string, options meta_v1.GetOptions) (result *v1beta1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolesResource, c.ns, name), &v1beta1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Role), err +} + +func (c *FakeRoles) List(opts v1.ListOptions) (result *v1beta1.RoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolesResource, c.ns, opts), &v1beta1.RoleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.RoleList{} + for _, item := range obj.(*v1beta1.RoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *FakeRoles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched role. +func (c *FakeRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, data, subresources...), &v1beta1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Role), err +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go new file mode 100644 index 0000000000..3c3f103176 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go @@ -0,0 +1,119 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + testing "k8s.io/client-go/testing" +) + +// FakeRoleBindings implements RoleBindingInterface +type FakeRoleBindings struct { + Fake *FakeRbacV1beta1 + ns string +} + +var rolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "rolebindings"} + +func (c *FakeRoleBindings) Create(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &v1beta1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.RoleBinding), err +} + +func (c *FakeRoleBindings) Update(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &v1beta1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.RoleBinding), err +} + +func (c *FakeRoleBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(rolebindingsResource, c.ns, name), &v1beta1.RoleBinding{}) + + return err +} + +func (c *FakeRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.RoleBindingList{}) + return err +} + +func (c *FakeRoleBindings) Get(name string, options meta_v1.GetOptions) (result *v1beta1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &v1beta1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.RoleBinding), err +} + +func (c *FakeRoleBindings) List(opts v1.ListOptions) (result *v1beta1.RoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolebindingsResource, c.ns, opts), &v1beta1.RoleBindingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.RoleBindingList{} + for _, item := range obj.(*v1beta1.RoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *FakeRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts)) + +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *FakeRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, data, subresources...), &v1beta1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.RoleBinding), err +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go new file mode 100644 index 0000000000..d7f80c0042 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go @@ -0,0 +1,25 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +type ClusterRoleExpansion interface{} + +type ClusterRoleBindingExpansion interface{} + +type RoleExpansion interface{} + +type RoleBindingExpansion interface{} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go new file mode 100644 index 0000000000..1800744f47 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go @@ -0,0 +1,112 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + fmt "fmt" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + api "k8s.io/client-go/pkg/api" + rest "k8s.io/client-go/rest" +) + +type RbacV1beta1Interface interface { + RESTClient() rest.Interface + ClusterRolesGetter + ClusterRoleBindingsGetter + RolesGetter + RoleBindingsGetter +} + +// RbacV1beta1Client is used to interact with features provided by the rbac.authorization.k8s.io group. +type RbacV1beta1Client struct { + restClient rest.Interface +} + +func (c *RbacV1beta1Client) ClusterRoles() ClusterRoleInterface { + return newClusterRoles(c) +} + +func (c *RbacV1beta1Client) ClusterRoleBindings() ClusterRoleBindingInterface { + return newClusterRoleBindings(c) +} + +func (c *RbacV1beta1Client) Roles(namespace string) RoleInterface { + return newRoles(c, namespace) +} + +func (c *RbacV1beta1Client) RoleBindings(namespace string) RoleBindingInterface { + return newRoleBindings(c, namespace) +} + +// NewForConfig creates a new RbacV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*RbacV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RbacV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new RbacV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RbacV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RbacV1beta1Client for the given RESTClient. +func New(c rest.Interface) *RbacV1beta1Client { + return &RbacV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv, err := schema.ParseGroupVersion("rbac.authorization.k8s.io/v1beta1") + if err != nil { + return err + } + // if rbac.authorization.k8s.io/v1beta1 is not enabled, return an error + if !api.Registry.IsEnabledVersion(gv) { + return fmt.Errorf("rbac.authorization.k8s.io/v1beta1 is not enabled") + } + config.APIPath = "/apis" + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + copyGroupVersion := gv + config.GroupVersion = ©GroupVersion + + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs} + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RbacV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go new file mode 100644 index 0000000000..dec49c6e12 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go @@ -0,0 +1,156 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + api "k8s.io/client-go/pkg/api" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + rest "k8s.io/client-go/rest" +) + +// RolesGetter has a method to return a RoleInterface. +// A group's client should implement this interface. +type RolesGetter interface { + Roles(namespace string) RoleInterface +} + +// RoleInterface has methods to work with Role resources. +type RoleInterface interface { + Create(*v1beta1.Role) (*v1beta1.Role, error) + Update(*v1beta1.Role) (*v1beta1.Role, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1beta1.Role, error) + List(opts v1.ListOptions) (*v1beta1.RoleList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Role, err error) + RoleExpansion +} + +// roles implements RoleInterface +type roles struct { + client rest.Interface + ns string +} + +// newRoles returns a Roles +func newRoles(c *RbacV1beta1Client, namespace string) *roles { + return &roles{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Create(role *v1beta1.Role) (result *v1beta1.Role, err error) { + result = &v1beta1.Role{} + err = c.client.Post(). + Namespace(c.ns). + Resource("roles"). + Body(role). + Do(). + Into(result) + return +} + +// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Update(role *v1beta1.Role) (result *v1beta1.Role, err error) { + result = &v1beta1.Role{} + err = c.client.Put(). + Namespace(c.ns). + Resource("roles"). + Name(role.Name). + Body(role). + Do(). + Into(result) + return +} + +// Delete takes name of the role and deletes it. Returns an error if one occurs. +func (c *roles) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the role, and returns the corresponding role object, and an error if there is any. +func (c *roles) Get(name string, options meta_v1.GetOptions) (result *v1beta1.Role, err error) { + result = &v1beta1.Role{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + Name(name). + VersionedParams(&options, api.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Roles that match those selectors. +func (c *roles) List(opts v1.ListOptions) (result *v1beta1.RoleList, err error) { + result = &v1beta1.RoleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *roles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched role. +func (c *roles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Role, err error) { + result = &v1beta1.Role{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("roles"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go new file mode 100644 index 0000000000..6abb17513e --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go @@ -0,0 +1,156 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + api "k8s.io/client-go/pkg/api" + v1 "k8s.io/client-go/pkg/api/v1" + v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1" + rest "k8s.io/client-go/rest" +) + +// RoleBindingsGetter has a method to return a RoleBindingInterface. +// A group's client should implement this interface. +type RoleBindingsGetter interface { + RoleBindings(namespace string) RoleBindingInterface +} + +// RoleBindingInterface has methods to work with RoleBinding resources. +type RoleBindingInterface interface { + Create(*v1beta1.RoleBinding) (*v1beta1.RoleBinding, error) + Update(*v1beta1.RoleBinding) (*v1beta1.RoleBinding, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1beta1.RoleBinding, error) + List(opts v1.ListOptions) (*v1beta1.RoleBindingList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.RoleBinding, err error) + RoleBindingExpansion +} + +// roleBindings implements RoleBindingInterface +type roleBindings struct { + client rest.Interface + ns string +} + +// newRoleBindings returns a RoleBindings +func newRoleBindings(c *RbacV1beta1Client, namespace string) *roleBindings { + return &roleBindings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Create(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) { + result = &v1beta1.RoleBinding{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rolebindings"). + Body(roleBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Update(roleBinding *v1beta1.RoleBinding) (result *v1beta1.RoleBinding, err error) { + result = &v1beta1.RoleBinding{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rolebindings"). + Name(roleBinding.Name). + Body(roleBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs. +func (c *roleBindings) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&listOptions, api.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any. +func (c *roleBindings) Get(name string, options meta_v1.GetOptions) (result *v1beta1.RoleBinding, err error) { + result = &v1beta1.RoleBinding{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + VersionedParams(&options, api.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RoleBindings that match those selectors. +func (c *roleBindings) List(opts v1.ListOptions) (result *v1beta1.RoleBindingList, err error) { + result = &v1beta1.RoleBindingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, api.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *roleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.client.Get(). + Prefix("watch"). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, api.ParameterCodec). + Watch() +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *roleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.RoleBinding, err error) { + result = &v1beta1.RoleBinding{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rolebindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go index e596bf0184..2bbf9dc1bd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // This package has the automatically generated typed clients. package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go index ea928c2174..b28ae934af 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1alpha1,storage/v1beta1] +// This package is generated by client-gen with arguments: --clientset-name=clientset --input=[api/v1,apps/v1beta1,authentication/v1beta1,authorization/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates/v1alpha1,extensions/v1beta1,policy/v1beta1,rbac/v1beta1,rbac/v1alpha1,storage/v1beta1] // Package fake has the automatically generated clients. package fake diff --git a/staging/src/k8s.io/client-go/pkg/api/helpers.go b/staging/src/k8s.io/client-go/pkg/api/helpers.go index 1b3f5371c9..ac897d6987 100644 --- a/staging/src/k8s.io/client-go/pkg/api/helpers.go +++ b/staging/src/k8s.io/client-go/pkg/api/helpers.go @@ -18,7 +18,6 @@ package api import ( "crypto/md5" - "encoding/json" "fmt" "reflect" "strings" @@ -486,32 +485,6 @@ const ( UnsafeSysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/unsafe-sysctls" ) -// GetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations -// and converts it to the []Toleration type in api. -func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Toleration, error) { - var tolerations []Toleration - if len(annotations) > 0 && annotations[TolerationsAnnotationKey] != "" { - err := json.Unmarshal([]byte(annotations[TolerationsAnnotationKey]), &tolerations) - if err != nil { - return tolerations, err - } - } - return tolerations, nil -} - -// GetTaintsFromNodeAnnotations gets the json serialized taints data from Pod.Annotations -// and converts it to the []Taint type in api. -func GetTaintsFromNodeAnnotations(annotations map[string]string) ([]Taint, error) { - var taints []Taint - if len(annotations) > 0 && annotations[TaintsAnnotationKey] != "" { - err := json.Unmarshal([]byte(annotations[TaintsAnnotationKey]), &taints) - if err != nil { - return []Taint{}, err - } - } - return taints, nil -} - // TolerationToleratesTaint checks if the toleration tolerates the taint. func TolerationToleratesTaint(toleration *Toleration, taint *Taint) bool { if len(toleration.Effect) != 0 && toleration.Effect != taint.Effect { @@ -557,17 +530,6 @@ func (t *Taint) ToString() string { return fmt.Sprintf("%v=%v:%v", t.Key, t.Value, t.Effect) } -func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (AvoidPods, error) { - var avoidPods AvoidPods - if len(annotations) > 0 && annotations[PreferAvoidPodsAnnotationKey] != "" { - err := json.Unmarshal([]byte(annotations[PreferAvoidPodsAnnotationKey]), &avoidPods) - if err != nil { - return avoidPods, err - } - } - return avoidPods, nil -} - // SysctlsFromPodAnnotations parses the sysctl annotations into a slice of safe Sysctls // and a slice of unsafe Sysctls. This is only a convenience wrapper around // SysctlsFromPodAnnotation. diff --git a/staging/src/k8s.io/client-go/pkg/api/json.go b/staging/src/k8s.io/client-go/pkg/api/json.go new file mode 100644 index 0000000000..fbc7444e47 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/api/json.go @@ -0,0 +1,40 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package api + +import "encoding/json" + +// This file implements json marshaling/unmarshaling interfaces on objects that are currently marshaled into annotations +// to prevent anyone from marshaling these internal structs. + +var _ = json.Marshaler(Taint{}) +var _ = json.Unmarshaler(&Taint{}) + +func (Taint) MarshalJSON() ([]byte, error) { panic("do not marshal internal struct") } +func (*Taint) UnmarshalJSON([]byte) error { panic("do not unmarshal to internal struct") } + +var _ = json.Marshaler(Toleration{}) +var _ = json.Unmarshaler(&Toleration{}) + +func (Toleration) MarshalJSON() ([]byte, error) { panic("do not marshal internal struct") } +func (*Toleration) UnmarshalJSON([]byte) error { panic("do not unmarshal to internal struct") } + +var _ = json.Marshaler(&AvoidPods{}) +var _ = json.Unmarshaler(&AvoidPods{}) + +func (AvoidPods) MarshalJSON() ([]byte, error) { panic("do not marshal internal struct") } +func (*AvoidPods) UnmarshalJSON([]byte) error { panic("do not unmarshal to internal struct") } diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/install/install.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/install/install.go index 808c90c1b6..cb1f1568e7 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/install/install.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/install/install.go @@ -23,18 +23,20 @@ import ( "k8s.io/client-go/pkg/apimachinery/announced" "k8s.io/client-go/pkg/apis/rbac" "k8s.io/client-go/pkg/apis/rbac/v1alpha1" + "k8s.io/client-go/pkg/apis/rbac/v1beta1" ) func init() { if err := announced.NewGroupMetaFactory( &announced.GroupMetaFactoryArgs{ GroupName: rbac.GroupName, - VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version}, + VersionPreferenceOrder: []string{v1beta1.SchemeGroupVersion.Version, v1alpha1.SchemeGroupVersion.Version}, ImportPrefix: "k8s.io/client-go/pkg/apis/rbac", RootScopedKinds: sets.NewString("ClusterRole", "ClusterRoleBinding"), AddInternalObjectsToScheme: rbac.AddToScheme, }, announced.VersionToSchemeFunc{ + v1beta1.SchemeGroupVersion.Version: v1beta1.AddToScheme, v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme, }, ).Announce().RegisterAndEnable(); err != nil { diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/types.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/types.go index 34e8dda589..87abe1a7c8 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/types.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/types.go @@ -18,7 +18,6 @@ package rbac import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) // Authorization is calculated against @@ -42,12 +41,9 @@ const ( type PolicyRule struct { // Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. Verbs []string - // AttributeRestrictions will vary depending on what the Authorizer/AuthorizationAttributeBuilder pair supports. - // If the Authorizer does not recognize how to handle the AttributeRestrictions, the Authorizer should report an error. - AttributeRestrictions runtime.Object + // APIGroups is the name of the APIGroup that contains the resources. // If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. - APIGroups []string // Resources is a list of resources this rule applies to. ResourceAll represents all resources. Resources []string diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.pb.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.pb.go index cea8f67994..9be44b61a6 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.pb.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.pb.go @@ -344,14 +344,6 @@ func (m *PolicyRule) MarshalTo(data []byte) (int, error) { i += copy(data[i:], s) } } - data[i] = 0x12 - i++ - i = encodeVarintGenerated(data, i, uint64(m.AttributeRestrictions.Size())) - n7, err := m.AttributeRestrictions.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n7 if len(m.APIGroups) > 0 { for _, s := range m.APIGroups { data[i] = 0x1a @@ -433,11 +425,11 @@ func (m *PolicyRuleBuilder) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.PolicyRule.Size())) - n8, err := m.PolicyRule.MarshalTo(data[i:]) + n7, err := m.PolicyRule.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n8 + i += n7 return i, nil } @@ -459,11 +451,11 @@ func (m *Role) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n9, err := m.ObjectMeta.MarshalTo(data[i:]) + n8, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n9 + i += n8 if len(m.Rules) > 0 { for _, msg := range m.Rules { data[i] = 0x12 @@ -497,11 +489,11 @@ func (m *RoleBinding) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) - n10, err := m.ObjectMeta.MarshalTo(data[i:]) + n9, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n10 + i += n9 if len(m.Subjects) > 0 { for _, msg := range m.Subjects { data[i] = 0x12 @@ -517,11 +509,11 @@ func (m *RoleBinding) MarshalTo(data []byte) (int, error) { data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.RoleRef.Size())) - n11, err := m.RoleRef.MarshalTo(data[i:]) + n10, err := m.RoleRef.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n11 + i += n10 return i, nil } @@ -543,11 +535,11 @@ func (m *RoleBindingList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n12, err := m.ListMeta.MarshalTo(data[i:]) + n11, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n12 + i += n11 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -581,11 +573,11 @@ func (m *RoleList) MarshalTo(data []byte) (int, error) { data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) - n13, err := m.ListMeta.MarshalTo(data[i:]) + n12, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } - i += n13 + i += n12 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 @@ -767,8 +759,6 @@ func (m *PolicyRule) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) } } - l = m.AttributeRestrictions.Size() - n += 1 + l + sovGenerated(uint64(l)) if len(m.APIGroups) > 0 { for _, s := range m.APIGroups { l = len(s) @@ -962,7 +952,6 @@ func (this *PolicyRule) String() string { } s := strings.Join([]string{`&PolicyRule{`, `Verbs:` + fmt.Sprintf("%v", this.Verbs) + `,`, - `AttributeRestrictions:` + strings.Replace(strings.Replace(this.AttributeRestrictions.String(), "RawExtension", "k8s_io_apimachinery_pkg_runtime.RawExtension", 1), `&`, ``, 1) + `,`, `APIGroups:` + fmt.Sprintf("%v", this.APIGroups) + `,`, `Resources:` + fmt.Sprintf("%v", this.Resources) + `,`, `ResourceNames:` + fmt.Sprintf("%v", this.ResourceNames) + `,`, @@ -1671,36 +1660,6 @@ func (m *PolicyRule) Unmarshal(data []byte) error { } m.Verbs = append(m.Verbs, string(data[iNdEx:postIndex])) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AttributeRestrictions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.AttributeRestrictions.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field APIGroups", wireType) @@ -2801,61 +2760,58 @@ var ( ) var fileDescriptorGenerated = []byte{ - // 894 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x55, 0xcf, 0x8b, 0x23, 0x45, - 0x14, 0x4e, 0x4d, 0x12, 0x27, 0x79, 0xe3, 0x30, 0x4e, 0xc9, 0x4a, 0x3b, 0x60, 0x32, 0xe4, 0x34, - 0xe8, 0x6e, 0xb7, 0x19, 0x56, 0xdd, 0x83, 0x1e, 0xa6, 0x45, 0x64, 0x70, 0x1d, 0x87, 0x5a, 0x5c, - 0x70, 0x59, 0xd0, 0x4a, 0xa7, 0x36, 0x29, 0xd3, 0xe9, 0x6e, 0xaa, 0xaa, 0x47, 0x17, 0x11, 0x44, - 0x3c, 0x78, 0xf4, 0xaf, 0xf0, 0xe8, 0x41, 0xf0, 0xe8, 0xc9, 0xcb, 0xa0, 0x97, 0x3d, 0xea, 0x25, - 0x38, 0xf1, 0x1f, 0x91, 0xea, 0x54, 0xff, 0x98, 0xed, 0x0e, 0xf3, 0x43, 0x08, 0x08, 0x7b, 0x4a, - 0xfa, 0xbd, 0xef, 0x7b, 0xef, 0x7d, 0xf5, 0xaa, 0xbf, 0x86, 0x3b, 0x93, 0x3b, 0xd2, 0xe6, 0xa1, - 0x33, 0x89, 0x07, 0x4c, 0x04, 0x4c, 0x31, 0xe9, 0x44, 0x93, 0x91, 0x43, 0x23, 0x2e, 0x1d, 0x31, - 0xa0, 0x9e, 0x73, 0xd2, 0xa7, 0x7e, 0x34, 0xa6, 0x7d, 0x67, 0xc4, 0x02, 0x26, 0xa8, 0x62, 0x43, - 0x3b, 0x12, 0xa1, 0x0a, 0xf1, 0xde, 0x82, 0x69, 0xe7, 0x4c, 0x3b, 0x9a, 0x8c, 0x6c, 0xcd, 0xb4, - 0x35, 0xd3, 0x4e, 0x99, 0x3b, 0xb7, 0x46, 0x5c, 0x8d, 0xe3, 0x81, 0xed, 0x85, 0x53, 0x67, 0x14, - 0x8e, 0x42, 0x27, 0x29, 0x30, 0x88, 0x1f, 0x25, 0x4f, 0xc9, 0x43, 0xf2, 0x6f, 0x51, 0x78, 0xe7, - 0xb6, 0x19, 0x89, 0x46, 0x7c, 0x4a, 0xbd, 0x31, 0x0f, 0x98, 0x78, 0x9c, 0x0f, 0x35, 0x65, 0x8a, - 0x3a, 0x27, 0xa5, 0x71, 0x76, 0x9c, 0x65, 0x2c, 0x11, 0x07, 0x8a, 0x4f, 0x59, 0x89, 0xf0, 0xe6, - 0x45, 0x04, 0xe9, 0x8d, 0xd9, 0x94, 0x96, 0x78, 0xfb, 0x4b, 0x4f, 0xcc, 0x11, 0x4c, 0x86, 0xb1, - 0xf0, 0xca, 0xbd, 0x6e, 0x2e, 0xe7, 0x54, 0x48, 0xe9, 0x57, 0xa3, 0x63, 0xc5, 0x7d, 0x87, 0x07, - 0x4a, 0x2a, 0xf1, 0x34, 0xa5, 0xf7, 0x3b, 0x82, 0x8d, 0x77, 0xfd, 0x58, 0x2a, 0x26, 0x48, 0xe8, - 0x33, 0xfc, 0x19, 0xb4, 0xf4, 0x41, 0x0d, 0xa9, 0xa2, 0x16, 0xda, 0x45, 0x7b, 0x1b, 0xfb, 0xaf, - 0xdb, 0x66, 0x5f, 0x45, 0xbd, 0xf9, 0xc6, 0x34, 0xda, 0x3e, 0xe9, 0xdb, 0x1f, 0x0d, 0x3e, 0x67, - 0x9e, 0xfa, 0x90, 0x29, 0xea, 0xe2, 0xd3, 0x59, 0xb7, 0x36, 0x9f, 0x75, 0x21, 0x8f, 0x91, 0xac, - 0x2a, 0xfe, 0x04, 0x9a, 0x22, 0xf6, 0x99, 0xb4, 0xd6, 0x76, 0xeb, 0x7b, 0x1b, 0xfb, 0xb7, 0xed, - 0xcb, 0x5e, 0x07, 0xfb, 0x38, 0xf4, 0xb9, 0xf7, 0x98, 0xc4, 0x3e, 0x73, 0x37, 0x4d, 0x8b, 0xa6, - 0x7e, 0x92, 0x64, 0x51, 0xb1, 0xf7, 0xcb, 0x1a, 0xe0, 0x82, 0x18, 0x97, 0x07, 0x43, 0x1e, 0x8c, - 0x56, 0xa0, 0xe9, 0x53, 0x68, 0xc9, 0x38, 0x49, 0xa4, 0xb2, 0xfa, 0x97, 0x97, 0x75, 0x6f, 0xc1, - 0x74, 0x5f, 0x30, 0x2d, 0x5a, 0x26, 0x20, 0x49, 0x56, 0x14, 0x3f, 0x84, 0x75, 0x11, 0xfa, 0x8c, - 0xb0, 0x47, 0x56, 0x3d, 0x51, 0x70, 0x85, 0xfa, 0x64, 0x41, 0x74, 0xb7, 0x4c, 0xfd, 0x75, 0x13, - 0x20, 0x69, 0xc9, 0xde, 0x8f, 0x08, 0x5e, 0x2e, 0x9f, 0x9b, 0x1b, 0x73, 0x7f, 0xc8, 0x04, 0xfe, - 0x1e, 0x01, 0xf6, 0x4a, 0x59, 0x73, 0x92, 0x6f, 0x5f, 0x7e, 0x8e, 0x8a, 0x0e, 0x3b, 0x66, 0xa4, - 0x8a, 0xad, 0x91, 0x8a, 0x9e, 0xbd, 0xbf, 0x10, 0xbc, 0x54, 0x86, 0xde, 0xe5, 0x52, 0xe1, 0x87, - 0xa5, 0x25, 0xdb, 0x97, 0x5b, 0xb2, 0x66, 0x27, 0x2b, 0xce, 0xce, 0x3f, 0x8d, 0x14, 0x16, 0x4c, - 0xa1, 0xc9, 0x15, 0x9b, 0xa6, 0xdb, 0xfd, 0x6f, 0xaa, 0xb3, 0xcb, 0x7b, 0xa8, 0x4b, 0x92, 0x45, - 0xe5, 0xde, 0x1f, 0x08, 0xb6, 0x0a, 0xe0, 0x15, 0x88, 0x7a, 0x70, 0x5e, 0xd4, 0x1b, 0xd7, 0x13, - 0x55, 0xad, 0xe6, 0xbb, 0x3a, 0x40, 0xfe, 0xbe, 0xe2, 0x2e, 0x34, 0x4f, 0x98, 0x18, 0x48, 0x0b, - 0xed, 0xd6, 0xf7, 0xda, 0x6e, 0x5b, 0xe3, 0xef, 0xeb, 0x00, 0x59, 0xc4, 0xf1, 0xb7, 0x08, 0x6e, - 0x50, 0xa5, 0x04, 0x1f, 0xc4, 0x8a, 0x11, 0x26, 0x95, 0xe0, 0x9e, 0xe2, 0x61, 0xa0, 0x87, 0xd3, - 0xba, 0x6f, 0x2d, 0xd5, 0x6d, 0x5c, 0xd7, 0x26, 0xf4, 0x8b, 0xf7, 0xbe, 0x54, 0x2c, 0x90, 0x3c, - 0x0c, 0xdc, 0x57, 0xcc, 0x50, 0x37, 0x0e, 0xaa, 0x6a, 0x92, 0xea, 0x56, 0xf8, 0x35, 0x68, 0xd3, - 0x88, 0xbf, 0x2f, 0xc2, 0x38, 0x92, 0x56, 0x3d, 0x99, 0x74, 0x73, 0x3e, 0xeb, 0xb6, 0x0f, 0x8e, - 0x0f, 0x17, 0x41, 0x92, 0xe7, 0x35, 0x38, 0xb5, 0x6d, 0x69, 0x35, 0x72, 0x30, 0x49, 0x83, 0x24, - 0xcf, 0xe3, 0xb7, 0x60, 0x33, 0x7d, 0x38, 0xa2, 0x53, 0x26, 0xad, 0x66, 0x42, 0xd8, 0x9e, 0xcf, - 0xba, 0x9b, 0xa4, 0x98, 0x20, 0xe7, 0x71, 0xf8, 0x1d, 0xd8, 0x0a, 0xc2, 0x20, 0x85, 0x7c, 0x4c, - 0xee, 0x4a, 0xeb, 0xb9, 0x84, 0xfa, 0xe2, 0x7c, 0xd6, 0xdd, 0x3a, 0x3a, 0x9f, 0x22, 0x4f, 0x63, - 0x7b, 0x5f, 0xc3, 0x76, 0xc1, 0x35, 0xcd, 0x0b, 0x3d, 0x06, 0x88, 0xb2, 0xa0, 0xb9, 0x57, 0xd7, - 0xb3, 0xe1, 0xcc, 0x15, 0xf3, 0x18, 0x29, 0xd4, 0xee, 0xfd, 0x86, 0xa0, 0xf1, 0xff, 0xff, 0xac, - 0xfc, 0xb4, 0x06, 0x1b, 0xcf, 0xbe, 0x27, 0x57, 0xf8, 0x9e, 0x68, 0x2b, 0x5b, 0xad, 0x3f, 0x5f, - 0xdf, 0xca, 0x2e, 0x36, 0xe6, 0x5f, 0x11, 0xb4, 0x56, 0xe4, 0xc8, 0xf7, 0xce, 0xcb, 0xb0, 0xaf, - 0x28, 0xa3, 0x7a, 0xfe, 0xaf, 0x20, 0xdd, 0x10, 0xbe, 0x09, 0xad, 0xd4, 0xc0, 0x92, 0xe9, 0xdb, - 0xf9, 0x34, 0xa9, 0xc7, 0x91, 0x0c, 0x81, 0x77, 0xa1, 0x31, 0xe1, 0xc1, 0x30, 0x71, 0xe0, 0xb6, - 0xfb, 0xbc, 0x41, 0x36, 0x3e, 0xe0, 0xc1, 0x90, 0x24, 0x19, 0x8d, 0x08, 0xe8, 0x94, 0x25, 0x77, - 0xa8, 0x80, 0xd0, 0xd6, 0x45, 0x92, 0x4c, 0xef, 0x67, 0x04, 0xeb, 0xe6, 0xfe, 0x65, 0xf5, 0xd0, - 0xd2, 0x7a, 0xfb, 0x00, 0x34, 0xe2, 0xf7, 0x99, 0xd0, 0x26, 0x6e, 0xfa, 0x66, 0x6f, 0xca, 0xc1, - 0xf1, 0xa1, 0xc9, 0x90, 0x02, 0xea, 0xe2, 0x19, 0xb0, 0x03, 0x6d, 0xfd, 0x2b, 0x23, 0xea, 0x31, - 0xab, 0x91, 0xc0, 0xb6, 0x0d, 0xac, 0x7d, 0x94, 0x26, 0x48, 0x8e, 0x71, 0x5f, 0x3d, 0x3d, 0xeb, - 0xd4, 0x9e, 0x9c, 0x75, 0x6a, 0x7f, 0x9e, 0x75, 0x6a, 0xdf, 0xcc, 0x3b, 0xe8, 0x74, 0xde, 0x41, - 0x4f, 0xe6, 0x1d, 0xf4, 0xf7, 0xbc, 0x83, 0x7e, 0xf8, 0xa7, 0x53, 0x7b, 0xd0, 0x4a, 0x0f, 0xfe, - 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xef, 0xa7, 0x73, 0x08, 0x0d, 0x00, 0x00, + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x54, 0xcf, 0x6b, 0x24, 0x45, + 0x14, 0x9e, 0x4a, 0x66, 0xcc, 0xcc, 0x8b, 0x21, 0xa6, 0x04, 0x69, 0x73, 0xe8, 0x09, 0x7d, 0x0a, + 0xba, 0x76, 0x3b, 0x61, 0xd5, 0x3d, 0xe8, 0x61, 0xdb, 0x83, 0x04, 0xd7, 0x18, 0x6a, 0x71, 0xc1, + 0x65, 0x41, 0x6b, 0x7a, 0x6a, 0x67, 0xca, 0xe9, 0x5f, 0x54, 0x75, 0x07, 0x16, 0x11, 0x3c, 0x7a, + 0xf4, 0xaf, 0xf0, 0xe8, 0x41, 0xf0, 0xe8, 0xc9, 0x4b, 0xd0, 0xcb, 0x1e, 0xf5, 0x32, 0x98, 0xf6, + 0x0f, 0x51, 0xba, 0xba, 0xfa, 0x47, 0xd2, 0x13, 0xf2, 0x43, 0x18, 0x10, 0xf6, 0x34, 0x53, 0xef, + 0x7d, 0xdf, 0xab, 0xf7, 0xbd, 0x57, 0xfd, 0xc1, 0xbd, 0xf9, 0x3d, 0x69, 0xf3, 0xc8, 0x99, 0xa7, + 0x63, 0x26, 0x42, 0x96, 0x30, 0xe9, 0xc4, 0xf3, 0xa9, 0x43, 0x63, 0x2e, 0x1d, 0x31, 0xa6, 0x9e, + 0x73, 0x32, 0xa2, 0x7e, 0x3c, 0xa3, 0x23, 0x67, 0xca, 0x42, 0x26, 0x68, 0xc2, 0x26, 0x76, 0x2c, + 0xa2, 0x24, 0xc2, 0xfb, 0x05, 0xd3, 0xae, 0x99, 0x76, 0x3c, 0x9f, 0xda, 0x39, 0xd3, 0xce, 0x99, + 0x76, 0xc9, 0xdc, 0x7d, 0x6b, 0xca, 0x93, 0x59, 0x3a, 0xb6, 0xbd, 0x28, 0x70, 0xa6, 0xd1, 0x34, + 0x72, 0x54, 0x81, 0x71, 0xfa, 0x54, 0x9d, 0xd4, 0x41, 0xfd, 0x2b, 0x0a, 0xef, 0xde, 0xd5, 0x2d, + 0xd1, 0x98, 0x07, 0xd4, 0x9b, 0xf1, 0x90, 0x89, 0x67, 0x75, 0x53, 0x01, 0x4b, 0xa8, 0x73, 0xd2, + 0x6a, 0x67, 0xd7, 0xb9, 0x8c, 0x25, 0xd2, 0x30, 0xe1, 0x01, 0x6b, 0x11, 0xde, 0xbd, 0x8a, 0x20, + 0xbd, 0x19, 0x0b, 0x68, 0x8b, 0x77, 0x70, 0xe9, 0xc4, 0x1c, 0xc1, 0x64, 0x94, 0x0a, 0xaf, 0x7d, + 0xd7, 0x9d, 0xcb, 0x39, 0x4b, 0xa4, 0x8c, 0x96, 0xa3, 0xd3, 0x84, 0xfb, 0x0e, 0x0f, 0x13, 0x99, + 0x88, 0x8b, 0x14, 0xeb, 0x37, 0x04, 0x9b, 0x1f, 0xfa, 0xa9, 0x4c, 0x98, 0x20, 0x91, 0xcf, 0xf0, + 0x97, 0xd0, 0xcf, 0x07, 0x35, 0xa1, 0x09, 0x35, 0xd0, 0x1e, 0xda, 0xdf, 0x3c, 0x78, 0xdb, 0xd6, + 0xfb, 0x6a, 0xea, 0xad, 0x37, 0x96, 0xa3, 0xed, 0x93, 0x91, 0xfd, 0xe9, 0xf8, 0x2b, 0xe6, 0x25, + 0x9f, 0xb0, 0x84, 0xba, 0xf8, 0x74, 0x31, 0xec, 0x64, 0x8b, 0x21, 0xd4, 0x31, 0x52, 0x55, 0xc5, + 0x9f, 0x43, 0x4f, 0xa4, 0x3e, 0x93, 0xc6, 0xda, 0xde, 0xfa, 0xfe, 0xe6, 0xc1, 0x5d, 0xfb, 0xba, + 0xcf, 0xc1, 0x3e, 0x8e, 0x7c, 0xee, 0x3d, 0x23, 0xa9, 0xcf, 0xdc, 0x2d, 0x7d, 0x45, 0x2f, 0x3f, + 0x49, 0x52, 0x54, 0xb4, 0x7e, 0x5e, 0x03, 0xdc, 0x10, 0xe3, 0xf2, 0x70, 0xc2, 0xc3, 0xe9, 0x0a, + 0x34, 0x7d, 0x01, 0x7d, 0x99, 0xaa, 0x44, 0x29, 0x6b, 0x74, 0x7d, 0x59, 0x0f, 0x0b, 0xa6, 0xfb, + 0x8a, 0xbe, 0xa2, 0xaf, 0x03, 0x92, 0x54, 0x45, 0xf1, 0x13, 0xd8, 0x10, 0x91, 0xcf, 0x08, 0x7b, + 0x6a, 0xac, 0x2b, 0x05, 0x37, 0xa8, 0x4f, 0x0a, 0xa2, 0xbb, 0xad, 0xeb, 0x6f, 0xe8, 0x00, 0x29, + 0x4b, 0x5a, 0x3f, 0x20, 0x78, 0xbd, 0x3d, 0x37, 0x37, 0xe5, 0xfe, 0x84, 0x09, 0xfc, 0x1d, 0x02, + 0xec, 0xb5, 0xb2, 0x7a, 0x92, 0xef, 0x5f, 0xbf, 0x8f, 0x25, 0x37, 0xec, 0xea, 0x96, 0x96, 0x6c, + 0x8d, 0x2c, 0xb9, 0xd3, 0xfa, 0x13, 0xc1, 0x6b, 0x6d, 0xe8, 0x03, 0x2e, 0x13, 0xfc, 0xa4, 0xb5, + 0x64, 0xfb, 0x7a, 0x4b, 0xce, 0xd9, 0x6a, 0xc5, 0xd5, 0xfc, 0xcb, 0x48, 0x63, 0xc1, 0x14, 0x7a, + 0x3c, 0x61, 0x41, 0xb9, 0xdd, 0xff, 0xa6, 0xba, 0x7a, 0xbc, 0x87, 0x79, 0x49, 0x52, 0x54, 0xb6, + 0x7e, 0x47, 0xb0, 0xdd, 0x00, 0xaf, 0x40, 0xd4, 0xe3, 0xf3, 0xa2, 0xde, 0xb9, 0x9d, 0xa8, 0xe5, + 0x6a, 0xfe, 0x41, 0x00, 0xf5, 0xf7, 0x8a, 0x87, 0xd0, 0x3b, 0x61, 0x62, 0x2c, 0x0d, 0xb4, 0xb7, + 0xbe, 0x3f, 0x70, 0x07, 0x39, 0xfe, 0x51, 0x1e, 0x20, 0x45, 0x1c, 0xbf, 0x09, 0x03, 0x1a, 0xf3, + 0x8f, 0x44, 0x94, 0xc6, 0xd2, 0x58, 0x57, 0xa0, 0xad, 0x6c, 0x31, 0x1c, 0xdc, 0x3f, 0x3e, 0x2c, + 0x82, 0xa4, 0xce, 0xe7, 0xe0, 0xd2, 0x31, 0xa5, 0xd1, 0xad, 0xc1, 0xa4, 0x0c, 0x92, 0x3a, 0x8f, + 0xdf, 0x83, 0xad, 0xf2, 0x70, 0x44, 0x03, 0x26, 0x8d, 0x9e, 0x22, 0xec, 0x64, 0x8b, 0xe1, 0x16, + 0x69, 0x26, 0xc8, 0x79, 0x1c, 0xfe, 0x00, 0xb6, 0xc3, 0x28, 0x2c, 0x21, 0x9f, 0x91, 0x07, 0xd2, + 0x78, 0x49, 0x51, 0x5f, 0xcd, 0x16, 0xc3, 0xed, 0xa3, 0xf3, 0x29, 0x72, 0x11, 0x6b, 0x7d, 0x03, + 0x3b, 0x0d, 0xc3, 0xd2, 0xdf, 0xd2, 0x0c, 0x20, 0xae, 0x82, 0x7a, 0xa5, 0xb7, 0x73, 0xc0, 0xca, + 0x90, 0xea, 0x18, 0x69, 0xd4, 0xb6, 0x7e, 0x45, 0xd0, 0xfd, 0xff, 0x3b, 0xfa, 0x8f, 0x6b, 0xb0, + 0xf9, 0xc2, 0xca, 0x6f, 0x60, 0xe5, 0xb9, 0x8b, 0xac, 0xd6, 0x1a, 0x6f, 0xef, 0x22, 0x57, 0x7b, + 0xe2, 0x2f, 0x08, 0xfa, 0x2b, 0x32, 0xc3, 0x87, 0xe7, 0x65, 0xd8, 0x37, 0x94, 0xb1, 0xbc, 0xff, + 0xaf, 0xa1, 0xdc, 0x10, 0xbe, 0x03, 0xfd, 0xd2, 0xc0, 0x54, 0xf7, 0x83, 0xba, 0x9b, 0xd2, 0xe3, + 0x48, 0x85, 0xc0, 0x7b, 0xd0, 0x9d, 0xf3, 0x70, 0x62, 0xac, 0x29, 0xe4, 0xcb, 0x1a, 0xd9, 0xfd, + 0x98, 0x87, 0x13, 0xa2, 0x32, 0x39, 0x22, 0xa4, 0x01, 0x53, 0x6f, 0xa8, 0x81, 0xc8, 0xad, 0x8b, + 0xa8, 0x8c, 0xf5, 0x13, 0x82, 0x0d, 0xfd, 0xfe, 0xaa, 0x7a, 0xe8, 0xd2, 0x7a, 0x07, 0x00, 0x34, + 0xe6, 0x8f, 0x98, 0x90, 0x3c, 0x0a, 0xf5, 0xbd, 0xd5, 0x97, 0x72, 0xff, 0xf8, 0x50, 0x67, 0x48, + 0x03, 0x75, 0x75, 0x0f, 0xd8, 0x81, 0x41, 0xfe, 0x2b, 0x63, 0xea, 0x31, 0xa3, 0xab, 0x60, 0x3b, + 0x1a, 0x36, 0x38, 0x2a, 0x13, 0xa4, 0xc6, 0xb8, 0x6f, 0x9c, 0x9e, 0x99, 0x9d, 0xe7, 0x67, 0x66, + 0xe7, 0x8f, 0x33, 0xb3, 0xf3, 0x6d, 0x66, 0xa2, 0xd3, 0xcc, 0x44, 0xcf, 0x33, 0x13, 0xfd, 0x95, + 0x99, 0xe8, 0xfb, 0xbf, 0xcd, 0xce, 0xe3, 0x7e, 0x39, 0xf8, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x57, 0x75, 0x75, 0xfb, 0x83, 0x0c, 0x00, 0x00, } diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.proto b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.proto index 7dbdd5d0d5..6837061ed6 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.proto +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/generated.proto @@ -90,11 +90,6 @@ message PolicyRule { // Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. repeated string verbs = 1; - // AttributeRestrictions will vary depending on what the Authorizer/AuthorizationAttributeBuilder pair supports. - // If the Authorizer does not recognize how to handle the AttributeRestrictions, the Authorizer should report an error. - // +optional - optional k8s.io.apimachinery.pkg.runtime.RawExtension attributeRestrictions = 2; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. // +optional diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.generated.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.generated.go index 480383c48f..64ba53a9be 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.generated.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.generated.go @@ -25,9 +25,8 @@ import ( "errors" "fmt" codec1978 "github.com/ugorji/go/codec" - pkg2_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - pkg1_runtime "k8s.io/apimachinery/pkg/runtime" - pkg3_types "k8s.io/apimachinery/pkg/types" + pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + pkg2_types "k8s.io/apimachinery/pkg/types" "reflect" "runtime" time "time" @@ -63,11 +62,10 @@ func init() { panic(err) } if false { // reference the types, but skip this branch at build/run time - var v0 pkg2_v1.TypeMeta - var v1 pkg1_runtime.RawExtension - var v2 pkg3_types.UID - var v3 time.Time - _, _, _, _ = v0, v1, v2, v3 + var v0 pkg1_v1.TypeMeta + var v1 pkg2_types.UID + var v2 time.Time + _, _, _ = v0, v1, v2 } } @@ -85,17 +83,16 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [6]bool + var yyq2 [5]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[1] = true - yyq2[2] = len(x.APIGroups) != 0 - yyq2[3] = len(x.Resources) != 0 - yyq2[4] = len(x.ResourceNames) != 0 - yyq2[5] = len(x.NonResourceURLs) != 0 + yyq2[1] = len(x.APIGroups) != 0 + yyq2[2] = len(x.Resources) != 0 + yyq2[3] = len(x.ResourceNames) != 0 + yyq2[4] = len(x.NonResourceURLs) != 0 var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(6) + r.EncodeArrayStart(5) } else { yynn2 = 1 for _, b := range yyq2 { @@ -136,62 +133,29 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) if yyq2[1] { - yy7 := &x.AttributeRestrictions - yym8 := z.EncBinary() - _ = yym8 - if false { - } else if z.HasExtensions() && z.EncExt(yy7) { - } else if !yym8 && z.IsJSONHandle() { - z.EncJSONMarshal(yy7) + if x.APIGroups == nil { + r.EncodeNil() } else { - z.EncFallback(yy7) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + z.F.EncSliceStringV(x.APIGroups, false, e) + } } } else { r.EncodeNil() } } else { if yyq2[1] { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("attributeRestrictions")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yy9 := &x.AttributeRestrictions - yym10 := z.EncBinary() - _ = yym10 - if false { - } else if z.HasExtensions() && z.EncExt(yy9) { - } else if !yym10 && z.IsJSONHandle() { - z.EncJSONMarshal(yy9) - } else { - z.EncFallback(yy9) - } - } - } - if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[2] { - if x.APIGroups == nil { - r.EncodeNil() - } else { - yym12 := z.EncBinary() - _ = yym12 - if false { - } else { - z.F.EncSliceStringV(x.APIGroups, false, e) - } - } - } else { - r.EncodeNil() - } - } else { - if yyq2[2] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("apiGroups")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.APIGroups == nil { r.EncodeNil() } else { - yym13 := z.EncBinary() - _ = yym13 + yym8 := z.EncBinary() + _ = yym8 if false { } else { z.F.EncSliceStringV(x.APIGroups, false, e) @@ -201,12 +165,12 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[3] { + if yyq2[2] { if x.Resources == nil { r.EncodeNil() } else { - yym15 := z.EncBinary() - _ = yym15 + yym10 := z.EncBinary() + _ = yym10 if false { } else { z.F.EncSliceStringV(x.Resources, false, e) @@ -216,15 +180,15 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[3] { + if yyq2[2] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resources")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.Resources == nil { r.EncodeNil() } else { - yym16 := z.EncBinary() - _ = yym16 + yym11 := z.EncBinary() + _ = yym11 if false { } else { z.F.EncSliceStringV(x.Resources, false, e) @@ -234,12 +198,12 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[4] { + if yyq2[3] { if x.ResourceNames == nil { r.EncodeNil() } else { - yym18 := z.EncBinary() - _ = yym18 + yym13 := z.EncBinary() + _ = yym13 if false { } else { z.F.EncSliceStringV(x.ResourceNames, false, e) @@ -249,15 +213,15 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[4] { + if yyq2[3] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("resourceNames")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.ResourceNames == nil { r.EncodeNil() } else { - yym19 := z.EncBinary() - _ = yym19 + yym14 := z.EncBinary() + _ = yym14 if false { } else { z.F.EncSliceStringV(x.ResourceNames, false, e) @@ -267,12 +231,12 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if yyq2[5] { + if yyq2[4] { if x.NonResourceURLs == nil { r.EncodeNil() } else { - yym21 := z.EncBinary() - _ = yym21 + yym16 := z.EncBinary() + _ = yym16 if false { } else { z.F.EncSliceStringV(x.NonResourceURLs, false, e) @@ -282,15 +246,15 @@ func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeNil() } } else { - if yyq2[5] { + if yyq2[4] { z.EncSendContainerState(codecSelfer_containerMapKey1234) r.EncodeString(codecSelferC_UTF81234, string("nonResourceURLs")) z.EncSendContainerState(codecSelfer_containerMapValue1234) if x.NonResourceURLs == nil { r.EncodeNil() } else { - yym22 := z.EncBinary() - _ = yym22 + yym17 := z.EncBinary() + _ = yym17 if false { } else { z.F.EncSliceStringV(x.NonResourceURLs, false, e) @@ -371,26 +335,23 @@ func (x *PolicyRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv4, false, d) } } - case "attributeRestrictions": - if r.TryDecodeAsNil() { - x.AttributeRestrictions = pkg1_runtime.RawExtension{} - } else { - yyv6 := &x.AttributeRestrictions - yym7 := z.DecBinary() - _ = yym7 - if false { - } else if z.HasExtensions() && z.DecExt(yyv6) { - } else if !yym7 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv6) - } else { - z.DecFallback(yyv6, false) - } - } case "apiGroups": if r.TryDecodeAsNil() { x.APIGroups = nil } else { - yyv8 := &x.APIGroups + yyv6 := &x.APIGroups + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + z.F.DecSliceStringX(yyv6, false, d) + } + } + case "resources": + if r.TryDecodeAsNil() { + x.Resources = nil + } else { + yyv8 := &x.Resources yym9 := z.DecBinary() _ = yym9 if false { @@ -398,11 +359,11 @@ func (x *PolicyRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv8, false, d) } } - case "resources": + case "resourceNames": if r.TryDecodeAsNil() { - x.Resources = nil + x.ResourceNames = nil } else { - yyv10 := &x.Resources + yyv10 := &x.ResourceNames yym11 := z.DecBinary() _ = yym11 if false { @@ -410,11 +371,11 @@ func (x *PolicyRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv10, false, d) } } - case "resourceNames": + case "nonResourceURLs": if r.TryDecodeAsNil() { - x.ResourceNames = nil + x.NonResourceURLs = nil } else { - yyv12 := &x.ResourceNames + yyv12 := &x.NonResourceURLs yym13 := z.DecBinary() _ = yym13 if false { @@ -422,18 +383,6 @@ func (x *PolicyRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv12, false, d) } } - case "nonResourceURLs": - if r.TryDecodeAsNil() { - x.NonResourceURLs = nil - } else { - yyv14 := &x.NonResourceURLs - yym15 := z.DecBinary() - _ = yym15 - if false { - } else { - z.F.DecSliceStringX(yyv14, false, d) - } - } default: z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 @@ -445,16 +394,16 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1234 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r - var yyj16 int - var yyb16 bool - var yyhl16 bool = l >= 0 - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { + if yyb14 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -462,46 +411,21 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Verbs = nil } else { - yyv17 := &x.Verbs - yym18 := z.DecBinary() - _ = yym18 + yyv15 := &x.Verbs + yym16 := z.DecBinary() + _ = yym16 if false { } else { - z.F.DecSliceStringX(yyv17, false, d) + z.F.DecSliceStringX(yyv15, false, d) } } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1234) - return - } - z.DecSendContainerState(codecSelfer_containerArrayElem1234) - if r.TryDecodeAsNil() { - x.AttributeRestrictions = pkg1_runtime.RawExtension{} - } else { - yyv19 := &x.AttributeRestrictions - yym20 := z.DecBinary() - _ = yym20 - if false { - } else if z.HasExtensions() && z.DecExt(yyv19) { - } else if !yym20 && z.IsJSONHandle() { - z.DecJSONUnmarshal(yyv19) - } else { - z.DecFallback(yyv19, false) - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { + if yyb14 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -509,21 +433,21 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.APIGroups = nil } else { - yyv21 := &x.APIGroups - yym22 := z.DecBinary() - _ = yym22 + yyv17 := &x.APIGroups + yym18 := z.DecBinary() + _ = yym18 if false { } else { - z.F.DecSliceStringX(yyv21, false, d) + z.F.DecSliceStringX(yyv17, false, d) } } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { + if yyb14 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -531,21 +455,21 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.Resources = nil } else { - yyv23 := &x.Resources - yym24 := z.DecBinary() - _ = yym24 + yyv19 := &x.Resources + yym20 := z.DecBinary() + _ = yym20 if false { } else { - z.F.DecSliceStringX(yyv23, false, d) + z.F.DecSliceStringX(yyv19, false, d) } } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { + if yyb14 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -553,21 +477,21 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.ResourceNames = nil } else { - yyv25 := &x.ResourceNames - yym26 := z.DecBinary() - _ = yym26 + yyv21 := &x.ResourceNames + yym22 := z.DecBinary() + _ = yym22 if false { } else { - z.F.DecSliceStringX(yyv25, false, d) + z.F.DecSliceStringX(yyv21, false, d) } } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { + if yyb14 { z.DecSendContainerState(codecSelfer_containerArrayEnd1234) return } @@ -575,26 +499,26 @@ func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if r.TryDecodeAsNil() { x.NonResourceURLs = nil } else { - yyv27 := &x.NonResourceURLs - yym28 := z.DecBinary() - _ = yym28 + yyv23 := &x.NonResourceURLs + yym24 := z.DecBinary() + _ = yym24 if false { } else { - z.F.DecSliceStringX(yyv27, false, d) + z.F.DecSliceStringX(yyv23, false, d) } } for { - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l } else { - yyb16 = r.CheckBreak() + yyb14 = r.CheckBreak() } - if yyb16 { + if yyb14 { break } z.DecSendContainerState(codecSelfer_containerArrayElem1234) - z.DecStructFieldNotFound(yyj16-1, "") + z.DecStructFieldNotFound(yyj14-1, "") } z.DecSendContainerState(codecSelfer_containerArrayEnd1234) } @@ -1452,7 +1376,7 @@ func (x *Role) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv8 := &x.ObjectMeta yym9 := z.DecBinary() @@ -1545,7 +1469,7 @@ func (x *Role) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv17 := &x.ObjectMeta yym18 := z.DecBinary() @@ -1831,7 +1755,7 @@ func (x *RoleBinding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv8 := &x.ObjectMeta yym9 := z.DecBinary() @@ -1931,7 +1855,7 @@ func (x *RoleBinding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv18 := &x.ObjectMeta yym19 := z.DecBinary() @@ -2223,7 +2147,7 @@ func (x *RoleBindingList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv8 := &x.ListMeta yym9 := z.DecBinary() @@ -2316,7 +2240,7 @@ func (x *RoleBindingList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv17 := &x.ListMeta yym18 := z.DecBinary() @@ -2591,7 +2515,7 @@ func (x *RoleList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv8 := &x.ListMeta yym9 := z.DecBinary() @@ -2684,7 +2608,7 @@ func (x *RoleList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv17 := &x.ListMeta yym18 := z.DecBinary() @@ -2959,7 +2883,7 @@ func (x *ClusterRole) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv8 := &x.ObjectMeta yym9 := z.DecBinary() @@ -3052,7 +2976,7 @@ func (x *ClusterRole) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv17 := &x.ObjectMeta yym18 := z.DecBinary() @@ -3338,7 +3262,7 @@ func (x *ClusterRoleBinding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) } case "metadata": if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv8 := &x.ObjectMeta yym9 := z.DecBinary() @@ -3438,7 +3362,7 @@ func (x *ClusterRoleBinding) codecDecodeSelfFromArray(l int, d *codec1978.Decode } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ObjectMeta = pkg2_v1.ObjectMeta{} + x.ObjectMeta = pkg1_v1.ObjectMeta{} } else { yyv18 := &x.ObjectMeta yym19 := z.DecBinary() @@ -3730,7 +3654,7 @@ func (x *ClusterRoleBindingList) codecDecodeSelfFromMap(l int, d *codec1978.Deco } case "metadata": if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv8 := &x.ListMeta yym9 := z.DecBinary() @@ -3823,7 +3747,7 @@ func (x *ClusterRoleBindingList) codecDecodeSelfFromArray(l int, d *codec1978.De } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv17 := &x.ListMeta yym18 := z.DecBinary() @@ -4098,7 +4022,7 @@ func (x *ClusterRoleList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } case "metadata": if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv8 := &x.ListMeta yym9 := z.DecBinary() @@ -4191,7 +4115,7 @@ func (x *ClusterRoleList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.ListMeta = pkg2_v1.ListMeta{} + x.ListMeta = pkg1_v1.ListMeta{} } else { yyv17 := &x.ListMeta yym18 := z.DecBinary() @@ -4279,7 +4203,7 @@ func (x codecSelfer1234) decSlicePolicyRule(v *[]PolicyRule, d *codec1978.Decode yyrg1 := len(yyv1) > 0 yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 160) + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 120) if yyrt1 { if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.go index f316953361..6649d60136 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types.go @@ -18,7 +18,6 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) // Authorization is calculated against @@ -47,10 +46,6 @@ const ( type PolicyRule struct { // Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // AttributeRestrictions will vary depending on what the Authorizer/AuthorizationAttributeBuilder pair supports. - // If the Authorizer does not recognize how to handle the AttributeRestrictions, the Authorizer should report an error. - // +optional - AttributeRestrictions runtime.RawExtension `json:"attributeRestrictions,omitempty" protobuf:"bytes,2,opt,name=attributeRestrictions"` // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types_swagger_doc_generated.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types_swagger_doc_generated.go index 633bae9799..79cc0294e1 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/types_swagger_doc_generated.go @@ -69,13 +69,12 @@ func (ClusterRoleList) SwaggerDoc() map[string]string { } var map_PolicyRule = map[string]string{ - "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", - "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.", - "attributeRestrictions": "AttributeRestrictions will vary depending on what the Authorizer/AuthorizationAttributeBuilder pair supports. If the Authorizer does not recognize how to handle the AttributeRestrictions, the Authorizer should report an error.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.", - "resources": "Resources is a list of resources this rule applies to. ResourceAll represents all resources.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path This name is intentionally different than the internal type so that the DefaultConvert works nicely and because the ordering may be different. Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", + "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", + "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.", + "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.", + "resources": "Resources is a list of resources this rule applies to. ResourceAll represents all resources.", + "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path This name is intentionally different than the internal type so that the DefaultConvert works nicely and because the ordering may be different. Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", } func (PolicyRule) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.conversion.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.conversion.go index d52d97baa6..a8f1ff651b 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.conversion.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.conversion.go @@ -66,17 +66,7 @@ func RegisterConversions(scheme *runtime.Scheme) error { func autoConvert_v1alpha1_ClusterRole_To_rbac_ClusterRole(in *ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]rbac.PolicyRule, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_PolicyRule_To_rbac_PolicyRule(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Rules = nil - } + out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules)) return nil } @@ -86,17 +76,7 @@ func Convert_v1alpha1_ClusterRole_To_rbac_ClusterRole(in *ClusterRole, out *rbac func autoConvert_rbac_ClusterRole_To_v1alpha1_ClusterRole(in *rbac.ClusterRole, out *ClusterRole, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]PolicyRule, len(*in)) - for i := range *in { - if err := Convert_rbac_PolicyRule_To_v1alpha1_PolicyRule(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Rules = nil - } + out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules)) return nil } @@ -214,17 +194,7 @@ func Convert_rbac_ClusterRoleBindingList_To_v1alpha1_ClusterRoleBindingList(in * func autoConvert_v1alpha1_ClusterRoleList_To_rbac_ClusterRoleList(in *ClusterRoleList, out *rbac.ClusterRoleList, s conversion.Scope) error { out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]rbac.ClusterRole, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_ClusterRole_To_rbac_ClusterRole(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } + out.Items = *(*[]rbac.ClusterRole)(unsafe.Pointer(&in.Items)) return nil } @@ -234,17 +204,7 @@ func Convert_v1alpha1_ClusterRoleList_To_rbac_ClusterRoleList(in *ClusterRoleLis func autoConvert_rbac_ClusterRoleList_To_v1alpha1_ClusterRoleList(in *rbac.ClusterRoleList, out *ClusterRoleList, s conversion.Scope) error { out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ClusterRole, len(*in)) - for i := range *in { - if err := Convert_rbac_ClusterRole_To_v1alpha1_ClusterRole(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } + out.Items = *(*[]ClusterRole)(unsafe.Pointer(&in.Items)) return nil } @@ -254,9 +214,6 @@ func Convert_rbac_ClusterRoleList_To_v1alpha1_ClusterRoleList(in *rbac.ClusterRo func autoConvert_v1alpha1_PolicyRule_To_rbac_PolicyRule(in *PolicyRule, out *rbac.PolicyRule, s conversion.Scope) error { out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) - if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.AttributeRestrictions, &out.AttributeRestrictions, s); err != nil { - return err - } out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups)) out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) @@ -270,9 +227,6 @@ func Convert_v1alpha1_PolicyRule_To_rbac_PolicyRule(in *PolicyRule, out *rbac.Po func autoConvert_rbac_PolicyRule_To_v1alpha1_PolicyRule(in *rbac.PolicyRule, out *PolicyRule, s conversion.Scope) error { out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) - if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.AttributeRestrictions, &out.AttributeRestrictions, s); err != nil { - return err - } out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups)) out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) @@ -308,17 +262,7 @@ func Convert_rbac_PolicyRuleBuilder_To_v1alpha1_PolicyRuleBuilder(in *rbac.Polic func autoConvert_v1alpha1_Role_To_rbac_Role(in *Role, out *rbac.Role, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]rbac.PolicyRule, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_PolicyRule_To_rbac_PolicyRule(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Rules = nil - } + out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules)) return nil } @@ -328,17 +272,7 @@ func Convert_v1alpha1_Role_To_rbac_Role(in *Role, out *rbac.Role, s conversion.S func autoConvert_rbac_Role_To_v1alpha1_Role(in *rbac.Role, out *Role, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]PolicyRule, len(*in)) - for i := range *in { - if err := Convert_rbac_PolicyRule_To_v1alpha1_PolicyRule(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Rules = nil - } + out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules)) return nil } @@ -434,17 +368,7 @@ func Convert_rbac_RoleBindingList_To_v1alpha1_RoleBindingList(in *rbac.RoleBindi func autoConvert_v1alpha1_RoleList_To_rbac_RoleList(in *RoleList, out *rbac.RoleList, s conversion.Scope) error { out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]rbac.Role, len(*in)) - for i := range *in { - if err := Convert_v1alpha1_Role_To_rbac_Role(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } + out.Items = *(*[]rbac.Role)(unsafe.Pointer(&in.Items)) return nil } @@ -454,17 +378,7 @@ func Convert_v1alpha1_RoleList_To_rbac_RoleList(in *RoleList, out *rbac.RoleList func autoConvert_rbac_RoleList_To_v1alpha1_RoleList(in *rbac.RoleList, out *RoleList, s conversion.Scope) error { out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Role, len(*in)) - for i := range *in { - if err := Convert_rbac_Role_To_v1alpha1_Role(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } + out.Items = *(*[]Role)(unsafe.Pointer(&in.Items)) return nil } diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.deepcopy.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.deepcopy.go index 00710f5042..0bed09369d 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1alpha1/zz_generated.deepcopy.go @@ -139,11 +139,6 @@ func DeepCopy_v1alpha1_PolicyRule(in interface{}, out interface{}, c *conversion *out = make([]string, len(*in)) copy(*out, *in) } - if newVal, err := c.DeepCopy(&in.AttributeRestrictions); err != nil { - return err - } else { - out.AttributeRestrictions = *newVal.(*runtime.RawExtension) - } if in.APIGroups != nil { in, out := &in.APIGroups, &out.APIGroups *out = make([]string, len(*in)) diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go new file mode 100644 index 0000000000..76638eefc9 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go @@ -0,0 +1,40 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + RegisterDefaults(scheme) + return scheme.AddDefaultingFuncs( + SetDefaults_ClusterRoleBinding, + SetDefaults_RoleBinding, + ) +} + +func SetDefaults_ClusterRoleBinding(obj *ClusterRoleBinding) { + if len(obj.RoleRef.APIGroup) == 0 { + obj.RoleRef.APIGroup = GroupName + } +} +func SetDefaults_RoleBinding(obj *RoleBinding) { + if len(obj.RoleRef.APIGroup) == 0 { + obj.RoleRef.APIGroup = GroupName + } +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go new file mode 100644 index 0000000000..a9ad4296ed --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +groupName=rbac.authorization.k8s.io +package v1beta1 diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go new file mode 100644 index 0000000000..1a18353bb9 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go @@ -0,0 +1,2817 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by protoc-gen-gogo. +// source: k8s.io/kubernetes/pkg/apis/rbac/v1beta1/generated.proto +// DO NOT EDIT! + +/* + Package v1beta1 is a generated protocol buffer package. + + It is generated from these files: + k8s.io/kubernetes/pkg/apis/rbac/v1beta1/generated.proto + + It has these top-level messages: + ClusterRole + ClusterRoleBinding + ClusterRoleBindingBuilder + ClusterRoleBindingList + ClusterRoleList + PolicyRule + PolicyRuleBuilder + Role + RoleBinding + RoleBindingList + RoleList + RoleRef + Subject +*/ +package v1beta1 + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +const _ = proto.GoGoProtoPackageIsVersion1 + +func (m *ClusterRole) Reset() { *m = ClusterRole{} } +func (*ClusterRole) ProtoMessage() {} +func (*ClusterRole) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } + +func (m *ClusterRoleBinding) Reset() { *m = ClusterRoleBinding{} } +func (*ClusterRoleBinding) ProtoMessage() {} +func (*ClusterRoleBinding) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } + +func (m *ClusterRoleBindingBuilder) Reset() { *m = ClusterRoleBindingBuilder{} } +func (*ClusterRoleBindingBuilder) ProtoMessage() {} +func (*ClusterRoleBindingBuilder) Descriptor() ([]byte, []int) { + return fileDescriptorGenerated, []int{2} +} + +func (m *ClusterRoleBindingList) Reset() { *m = ClusterRoleBindingList{} } +func (*ClusterRoleBindingList) ProtoMessage() {} +func (*ClusterRoleBindingList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} } + +func (m *ClusterRoleList) Reset() { *m = ClusterRoleList{} } +func (*ClusterRoleList) ProtoMessage() {} +func (*ClusterRoleList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{4} } + +func (m *PolicyRule) Reset() { *m = PolicyRule{} } +func (*PolicyRule) ProtoMessage() {} +func (*PolicyRule) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{5} } + +func (m *PolicyRuleBuilder) Reset() { *m = PolicyRuleBuilder{} } +func (*PolicyRuleBuilder) ProtoMessage() {} +func (*PolicyRuleBuilder) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{6} } + +func (m *Role) Reset() { *m = Role{} } +func (*Role) ProtoMessage() {} +func (*Role) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{7} } + +func (m *RoleBinding) Reset() { *m = RoleBinding{} } +func (*RoleBinding) ProtoMessage() {} +func (*RoleBinding) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{8} } + +func (m *RoleBindingList) Reset() { *m = RoleBindingList{} } +func (*RoleBindingList) ProtoMessage() {} +func (*RoleBindingList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{9} } + +func (m *RoleList) Reset() { *m = RoleList{} } +func (*RoleList) ProtoMessage() {} +func (*RoleList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{10} } + +func (m *RoleRef) Reset() { *m = RoleRef{} } +func (*RoleRef) ProtoMessage() {} +func (*RoleRef) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{11} } + +func (m *Subject) Reset() { *m = Subject{} } +func (*Subject) ProtoMessage() {} +func (*Subject) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{12} } + +func init() { + proto.RegisterType((*ClusterRole)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.ClusterRole") + proto.RegisterType((*ClusterRoleBinding)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.ClusterRoleBinding") + proto.RegisterType((*ClusterRoleBindingBuilder)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.ClusterRoleBindingBuilder") + proto.RegisterType((*ClusterRoleBindingList)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.ClusterRoleBindingList") + proto.RegisterType((*ClusterRoleList)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.ClusterRoleList") + proto.RegisterType((*PolicyRule)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.PolicyRule") + proto.RegisterType((*PolicyRuleBuilder)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.PolicyRuleBuilder") + proto.RegisterType((*Role)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.Role") + proto.RegisterType((*RoleBinding)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.RoleBinding") + proto.RegisterType((*RoleBindingList)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.RoleBindingList") + proto.RegisterType((*RoleList)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.RoleList") + proto.RegisterType((*RoleRef)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.RoleRef") + proto.RegisterType((*Subject)(nil), "k8s.io.client-go.pkg.apis.rbac.v1beta1.Subject") +} +func (m *ClusterRole) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *ClusterRole) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n1, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n1 + if len(m.Rules) > 0 { + for _, msg := range m.Rules { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ClusterRoleBinding) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *ClusterRoleBinding) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n2, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n2 + if len(m.Subjects) > 0 { + for _, msg := range m.Subjects { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.RoleRef.Size())) + n3, err := m.RoleRef.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + +func (m *ClusterRoleBindingBuilder) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *ClusterRoleBindingBuilder) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ClusterRoleBinding.Size())) + n4, err := m.ClusterRoleBinding.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n4 + return i, nil +} + +func (m *ClusterRoleBindingList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *ClusterRoleBindingList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n5, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n5 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ClusterRoleList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *ClusterRoleList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n6, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n6 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *PolicyRule) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *PolicyRule) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Verbs) > 0 { + for _, s := range m.Verbs { + data[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + if len(m.APIGroups) > 0 { + for _, s := range m.APIGroups { + data[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + if len(m.Resources) > 0 { + for _, s := range m.Resources { + data[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + if len(m.ResourceNames) > 0 { + for _, s := range m.ResourceNames { + data[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + if len(m.NonResourceURLs) > 0 { + for _, s := range m.NonResourceURLs { + data[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } + return i, nil +} + +func (m *PolicyRuleBuilder) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *PolicyRuleBuilder) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.PolicyRule.Size())) + n7, err := m.PolicyRule.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n7 + return i, nil +} + +func (m *Role) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *Role) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n8, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n8 + if len(m.Rules) > 0 { + for _, msg := range m.Rules { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *RoleBinding) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *RoleBinding) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) + n9, err := m.ObjectMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n9 + if len(m.Subjects) > 0 { + for _, msg := range m.Subjects { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(m.RoleRef.Size())) + n10, err := m.RoleRef.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n10 + return i, nil +} + +func (m *RoleBindingList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *RoleBindingList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n11, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n11 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *RoleList) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *RoleList) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) + n12, err := m.ListMeta.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n12 + if len(m.Items) > 0 { + for _, msg := range m.Items { + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(msg.Size())) + n, err := msg.MarshalTo(data[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *RoleRef) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *RoleRef) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.APIGroup))) + i += copy(data[i:], m.APIGroup) + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Kind))) + i += copy(data[i:], m.Kind) + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Name))) + i += copy(data[i:], m.Name) + return i, nil +} + +func (m *Subject) Marshal() (data []byte, err error) { + size := m.Size() + data = make([]byte, size) + n, err := m.MarshalTo(data) + if err != nil { + return nil, err + } + return data[:n], nil +} + +func (m *Subject) MarshalTo(data []byte) (int, error) { + var i int + _ = i + var l int + _ = l + data[i] = 0xa + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Kind))) + i += copy(data[i:], m.Kind) + data[i] = 0x12 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.APIVersion))) + i += copy(data[i:], m.APIVersion) + data[i] = 0x1a + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Name))) + i += copy(data[i:], m.Name) + data[i] = 0x22 + i++ + i = encodeVarintGenerated(data, i, uint64(len(m.Namespace))) + i += copy(data[i:], m.Namespace) + return i, nil +} + +func encodeFixed64Generated(data []byte, offset int, v uint64) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + data[offset+4] = uint8(v >> 32) + data[offset+5] = uint8(v >> 40) + data[offset+6] = uint8(v >> 48) + data[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Generated(data []byte, offset int, v uint32) int { + data[offset] = uint8(v) + data[offset+1] = uint8(v >> 8) + data[offset+2] = uint8(v >> 16) + data[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGenerated(data []byte, offset int, v uint64) int { + for v >= 1<<7 { + data[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + data[offset] = uint8(v) + return offset + 1 +} +func (m *ClusterRole) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ClusterRoleBinding) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Subjects) > 0 { + for _, e := range m.Subjects { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.RoleRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ClusterRoleBindingBuilder) Size() (n int) { + var l int + _ = l + l = m.ClusterRoleBinding.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ClusterRoleBindingList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ClusterRoleList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PolicyRule) Size() (n int) { + var l int + _ = l + if len(m.Verbs) > 0 { + for _, s := range m.Verbs { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.APIGroups) > 0 { + for _, s := range m.APIGroups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Resources) > 0 { + for _, s := range m.Resources { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.ResourceNames) > 0 { + for _, s := range m.ResourceNames { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.NonResourceURLs) > 0 { + for _, s := range m.NonResourceURLs { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PolicyRuleBuilder) Size() (n int) { + var l int + _ = l + l = m.PolicyRule.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Role) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *RoleBinding) Size() (n int) { + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Subjects) > 0 { + for _, e := range m.Subjects { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.RoleRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *RoleBindingList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *RoleList) Size() (n int) { + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *RoleRef) Size() (n int) { + var l int + _ = l + l = len(m.APIGroup) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Subject) Size() (n int) { + var l int + _ = l + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.APIVersion) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func sovGenerated(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ClusterRole) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterRole{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Rules:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Rules), "PolicyRule", "PolicyRule", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterRoleBinding) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterRoleBinding{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Subjects:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Subjects), "Subject", "Subject", 1), `&`, ``, 1) + `,`, + `RoleRef:` + strings.Replace(strings.Replace(this.RoleRef.String(), "RoleRef", "RoleRef", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterRoleBindingBuilder) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterRoleBindingBuilder{`, + `ClusterRoleBinding:` + strings.Replace(strings.Replace(this.ClusterRoleBinding.String(), "ClusterRoleBinding", "ClusterRoleBinding", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterRoleBindingList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterRoleBindingList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "ClusterRoleBinding", "ClusterRoleBinding", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ClusterRoleList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ClusterRoleList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "ClusterRole", "ClusterRole", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *PolicyRule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PolicyRule{`, + `Verbs:` + fmt.Sprintf("%v", this.Verbs) + `,`, + `APIGroups:` + fmt.Sprintf("%v", this.APIGroups) + `,`, + `Resources:` + fmt.Sprintf("%v", this.Resources) + `,`, + `ResourceNames:` + fmt.Sprintf("%v", this.ResourceNames) + `,`, + `NonResourceURLs:` + fmt.Sprintf("%v", this.NonResourceURLs) + `,`, + `}`, + }, "") + return s +} +func (this *PolicyRuleBuilder) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PolicyRuleBuilder{`, + `PolicyRule:` + strings.Replace(strings.Replace(this.PolicyRule.String(), "PolicyRule", "PolicyRule", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *Role) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Role{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Rules:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Rules), "PolicyRule", "PolicyRule", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *RoleBinding) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RoleBinding{`, + `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Subjects:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Subjects), "Subject", "Subject", 1), `&`, ``, 1) + `,`, + `RoleRef:` + strings.Replace(strings.Replace(this.RoleRef.String(), "RoleRef", "RoleRef", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *RoleBindingList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RoleBindingList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "RoleBinding", "RoleBinding", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *RoleList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RoleList{`, + `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "Role", "Role", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *RoleRef) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RoleRef{`, + `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *Subject) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Subject{`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ClusterRole) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rules = append(m.Rules, PolicyRule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterRoleBinding) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterRoleBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterRoleBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subjects", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subjects = append(m.Subjects, Subject{}) + if err := m.Subjects[len(m.Subjects)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RoleRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RoleRef.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterRoleBindingBuilder) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterRoleBindingBuilder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterRoleBindingBuilder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterRoleBinding", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ClusterRoleBinding.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterRoleBindingList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterRoleBindingList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterRoleBindingList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ClusterRoleBinding{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClusterRoleList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClusterRoleList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClusterRoleList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ClusterRole{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PolicyRule) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PolicyRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PolicyRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Verbs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Verbs = append(m.Verbs, string(data[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIGroups", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIGroups = append(m.APIGroups, string(data[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Resources = append(m.Resources, string(data[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceNames", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceNames = append(m.ResourceNames, string(data[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NonResourceURLs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NonResourceURLs = append(m.NonResourceURLs, string(data[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PolicyRuleBuilder) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PolicyRuleBuilder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PolicyRuleBuilder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PolicyRule", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PolicyRule.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Role) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Role: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Role: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rules = append(m.Rules, PolicyRule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoleBinding) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RoleBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subjects", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subjects = append(m.Subjects, Subject{}) + if err := m.Subjects[len(m.Subjects)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RoleRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RoleRef.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoleBindingList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RoleBindingList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleBindingList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, RoleBinding{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoleList) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RoleList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Role{}) + if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoleRef) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RoleRef: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleRef: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIGroup = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(data[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Subject) Unmarshal(data []byte) error { + l := len(data) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Subject: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Subject: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIVersion = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(data[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(data[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(data[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(data []byte) (n int, err error) { + l := len(data) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if data[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGenerated(data[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") +) + +var fileDescriptorGenerated = []byte{ + // 838 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x54, 0xbf, 0x6f, 0xe4, 0x44, + 0x14, 0xde, 0x49, 0x76, 0x95, 0xdd, 0x17, 0xa2, 0x90, 0x41, 0x42, 0x26, 0x85, 0x37, 0x72, 0x43, + 0x10, 0x77, 0xf6, 0x25, 0x9c, 0x38, 0x24, 0x44, 0x71, 0xa6, 0x40, 0x11, 0x47, 0x88, 0x06, 0x71, + 0xe2, 0x97, 0xd0, 0xcd, 0x7a, 0xe7, 0x9c, 0x61, 0xfd, 0x4b, 0x33, 0xe3, 0x48, 0x27, 0x28, 0xe8, + 0x68, 0xf9, 0x27, 0xe8, 0xa8, 0xa0, 0xa5, 0xa2, 0x0a, 0x54, 0x57, 0x5e, 0xb5, 0x22, 0xe6, 0x0f, + 0x01, 0xd9, 0x1e, 0xff, 0xd8, 0xf3, 0x46, 0x59, 0x82, 0x14, 0x09, 0x89, 0x6a, 0x77, 0xde, 0xfb, + 0xbe, 0x37, 0xef, 0x7b, 0x6f, 0xfc, 0xc1, 0xbd, 0xd9, 0x5b, 0xd2, 0xe6, 0xb1, 0x33, 0x4b, 0x27, + 0x4c, 0x44, 0x4c, 0x31, 0xe9, 0x24, 0x33, 0xdf, 0xa1, 0x09, 0x97, 0x8e, 0x98, 0x50, 0xcf, 0x39, + 0x3b, 0x98, 0x30, 0x45, 0x0f, 0x1c, 0x9f, 0x45, 0x4c, 0x50, 0xc5, 0xa6, 0x76, 0x22, 0x62, 0x15, + 0xe3, 0x57, 0x4b, 0xa2, 0xdd, 0x10, 0xed, 0x64, 0xe6, 0xdb, 0x39, 0xd1, 0xce, 0x89, 0xb6, 0x26, + 0xee, 0xde, 0xf6, 0xb9, 0x3a, 0x4d, 0x27, 0xb6, 0x17, 0x87, 0x8e, 0x1f, 0xfb, 0xb1, 0x53, 0xf0, + 0x27, 0xe9, 0xe3, 0xe2, 0x54, 0x1c, 0x8a, 0x7f, 0x65, 0xdd, 0xdd, 0xbb, 0xba, 0x21, 0x9a, 0xf0, + 0x90, 0x7a, 0xa7, 0x3c, 0x62, 0xe2, 0x49, 0xd3, 0x52, 0xc8, 0x14, 0x75, 0xce, 0x3a, 0xdd, 0xec, + 0x3a, 0x97, 0xb1, 0x44, 0x1a, 0x29, 0x1e, 0xb2, 0x0e, 0xe1, 0xcd, 0xab, 0x08, 0xd2, 0x3b, 0x65, + 0x21, 0xed, 0xf0, 0x0e, 0x2f, 0x9d, 0x97, 0x23, 0x98, 0x8c, 0x53, 0xe1, 0x75, 0xef, 0xba, 0x75, + 0x39, 0x67, 0x89, 0x94, 0x83, 0xe5, 0xe8, 0x54, 0xf1, 0xc0, 0xe1, 0x91, 0x92, 0x4a, 0x3c, 0x4f, + 0xb1, 0x7e, 0x43, 0xb0, 0xf9, 0x6e, 0x90, 0x4a, 0xc5, 0x04, 0x89, 0x03, 0x86, 0x1f, 0xc1, 0x30, + 0x1f, 0xd4, 0x94, 0x2a, 0x6a, 0xa0, 0x3d, 0xb4, 0xbf, 0x79, 0x78, 0xc7, 0xd6, 0xeb, 0x6a, 0xeb, + 0x6d, 0x16, 0x96, 0xa3, 0xed, 0xb3, 0x03, 0xfb, 0xc3, 0xc9, 0x57, 0xcc, 0x53, 0x1f, 0x30, 0x45, + 0x5d, 0x7c, 0x3e, 0x1f, 0xf7, 0xb2, 0xf9, 0x18, 0x9a, 0x18, 0xa9, 0xab, 0xe2, 0x4f, 0x60, 0x20, + 0xd2, 0x80, 0x49, 0x63, 0x6d, 0x6f, 0x7d, 0x7f, 0xf3, 0xf0, 0x0d, 0x7b, 0xc5, 0xd7, 0x60, 0x9f, + 0xc4, 0x01, 0xf7, 0x9e, 0x90, 0x34, 0x60, 0xee, 0x96, 0xbe, 0x61, 0x90, 0x9f, 0x24, 0x29, 0x0b, + 0x5a, 0x3f, 0xaf, 0x01, 0x6e, 0x69, 0x71, 0x79, 0x34, 0xe5, 0x91, 0x7f, 0x03, 0x92, 0xbe, 0x84, + 0xa1, 0x4c, 0x8b, 0x44, 0xa5, 0xea, 0xce, 0xca, 0xaa, 0x3e, 0x2a, 0x89, 0xee, 0x8b, 0xfa, 0x86, + 0xa1, 0x0e, 0x48, 0x52, 0xd7, 0xc4, 0x9f, 0xc3, 0x86, 0x88, 0x03, 0x46, 0xd8, 0x63, 0x63, 0x7d, + 0x51, 0xc0, 0x95, 0xe5, 0x49, 0xc9, 0x73, 0xb7, 0x75, 0xf9, 0x0d, 0x1d, 0x20, 0x55, 0x45, 0xeb, + 0x07, 0x04, 0xaf, 0x74, 0xa7, 0xe6, 0xa6, 0x3c, 0x98, 0x32, 0x81, 0xbf, 0x43, 0x80, 0xbd, 0x4e, + 0x56, 0xcf, 0xf1, 0xed, 0x95, 0xdb, 0x58, 0x72, 0xc1, 0xae, 0xee, 0x68, 0xc9, 0xca, 0xc8, 0x92, + 0x2b, 0xad, 0x67, 0x08, 0x5e, 0xee, 0x42, 0x1f, 0x70, 0xa9, 0xf0, 0x17, 0x9d, 0x0d, 0xdb, 0xab, + 0x6d, 0x38, 0x67, 0x17, 0xfb, 0xad, 0xa7, 0x5f, 0x45, 0x5a, 0xdb, 0x7d, 0x04, 0x03, 0xae, 0x58, + 0x58, 0xad, 0xf6, 0x5f, 0x89, 0xae, 0x1f, 0xee, 0x51, 0x5e, 0x91, 0x94, 0x85, 0xad, 0xdf, 0x11, + 0x6c, 0xb7, 0xc0, 0x37, 0xa0, 0xe9, 0xd3, 0x45, 0x4d, 0x77, 0xaf, 0xa5, 0x69, 0xb9, 0x98, 0xbf, + 0x10, 0x40, 0xf3, 0xa9, 0xe2, 0x31, 0x0c, 0xce, 0x98, 0x98, 0x48, 0x03, 0xed, 0xad, 0xef, 0x8f, + 0xdc, 0x51, 0x8e, 0x7f, 0x98, 0x07, 0x48, 0x19, 0xc7, 0xaf, 0xc3, 0x88, 0x26, 0xfc, 0x3d, 0x11, + 0xa7, 0x49, 0xd9, 0xce, 0xc8, 0xdd, 0xca, 0xe6, 0xe3, 0xd1, 0xfd, 0x93, 0xa3, 0x32, 0x48, 0x9a, + 0x7c, 0x0e, 0xae, 0xbc, 0x52, 0x1a, 0xeb, 0x0d, 0x98, 0x54, 0x41, 0xd2, 0xe4, 0xf1, 0x3d, 0xd8, + 0xaa, 0x0e, 0xc7, 0x34, 0x64, 0xd2, 0xe8, 0x17, 0x84, 0x9d, 0x6c, 0x3e, 0xde, 0x22, 0xed, 0x04, + 0x59, 0xc4, 0xe1, 0x77, 0x60, 0x3b, 0x8a, 0xa3, 0x0a, 0xf2, 0x31, 0x79, 0x20, 0x8d, 0x41, 0x41, + 0x7d, 0x29, 0x9b, 0x8f, 0xb7, 0x8f, 0x17, 0x53, 0xe4, 0x79, 0xac, 0xf5, 0x0d, 0xec, 0xb4, 0xbc, + 0x4a, 0x7f, 0x48, 0x3e, 0x40, 0x52, 0x07, 0xf5, 0x46, 0xaf, 0xe5, 0x7d, 0xb5, 0x15, 0x35, 0x31, + 0xd2, 0x2a, 0x6d, 0xfd, 0x8a, 0xa0, 0xff, 0x9f, 0xb7, 0xf2, 0x1f, 0xd7, 0x60, 0xf3, 0x7f, 0x0f, + 0x5f, 0xd9, 0xc3, 0x73, 0x03, 0xb9, 0x59, 0x53, 0xbc, 0xb6, 0x81, 0x5c, 0xed, 0x86, 0xbf, 0x20, + 0x18, 0xde, 0x90, 0x0d, 0x92, 0x45, 0x15, 0xb7, 0xff, 0x99, 0x8a, 0xe5, 0xed, 0x7f, 0x0d, 0xd5, + 0x7e, 0xf0, 0x2d, 0x18, 0x56, 0xd6, 0x55, 0x34, 0x3f, 0x6a, 0x9a, 0xa9, 0xdc, 0x8d, 0xd4, 0x08, + 0xbc, 0x07, 0xfd, 0x19, 0x8f, 0xa6, 0xc6, 0x5a, 0x81, 0x7c, 0x41, 0x23, 0xfb, 0xef, 0xf3, 0x68, + 0x4a, 0x8a, 0x4c, 0x8e, 0x88, 0x68, 0xc8, 0x8a, 0x07, 0xd4, 0x42, 0xe4, 0xa6, 0x45, 0x8a, 0x8c, + 0xf5, 0x13, 0x82, 0x0d, 0xfd, 0xf8, 0xea, 0x7a, 0xe8, 0xd2, 0x7a, 0x87, 0x00, 0x34, 0xe1, 0x0f, + 0x99, 0x90, 0x3c, 0x8e, 0xf4, 0xbd, 0xf5, 0x57, 0x72, 0xff, 0xe4, 0x48, 0x67, 0x48, 0x0b, 0x75, + 0x75, 0x0f, 0xd8, 0x81, 0x51, 0xfe, 0x2b, 0x13, 0xea, 0x31, 0xa3, 0x5f, 0xc0, 0x76, 0x34, 0x6c, + 0x74, 0x5c, 0x25, 0x48, 0x83, 0x71, 0x5f, 0x3b, 0xbf, 0x30, 0x7b, 0x4f, 0x2f, 0xcc, 0xde, 0xb3, + 0x0b, 0xb3, 0xf7, 0x6d, 0x66, 0xa2, 0xf3, 0xcc, 0x44, 0x4f, 0x33, 0x13, 0xfd, 0x91, 0x99, 0xe8, + 0xfb, 0x3f, 0xcd, 0xde, 0x67, 0x1b, 0x7a, 0xee, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x1d, + 0x32, 0x0f, 0x74, 0x0c, 0x00, 0x00, +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.proto b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.proto new file mode 100644 index 0000000000..c2cb2c74c8 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.proto @@ -0,0 +1,198 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = 'proto2'; + +package k8s.io.kubernetes.pkg.apis.rbac.v1beta1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; +import "k8s.io/kubernetes/pkg/api/resource/generated.proto"; +import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; +import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "v1beta1"; + +// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. +message ClusterRole { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Rules holds all the PolicyRules for this ClusterRole + repeated PolicyRule rules = 2; +} + +// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, +// and adds who information via Subject. +message ClusterRoleBinding { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Subjects holds references to the objects the role applies to. + repeated Subject subjects = 2; + + // RoleRef can only reference a ClusterRole in the global namespace. + // If the RoleRef cannot be resolved, the Authorizer must return an error. + optional RoleRef roleRef = 3; +} + +// +k8s:deepcopy-gen=false +// ClusterRoleBindingBuilder let's us attach methods. A no-no for API types. +// We use it to construct bindings in code. It's more compact than trying to write them +// out in a literal. +message ClusterRoleBindingBuilder { + optional ClusterRoleBinding clusterRoleBinding = 1; +} + +// ClusterRoleBindingList is a collection of ClusterRoleBindings +message ClusterRoleBindingList { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is a list of ClusterRoleBindings + repeated ClusterRoleBinding items = 2; +} + +// ClusterRoleList is a collection of ClusterRoles +message ClusterRoleList { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is a list of ClusterRoles + repeated ClusterRole items = 2; +} + +// PolicyRule holds information that describes a policy rule, but does not contain information +// about who the rule applies to or which namespace the rule applies to. +message PolicyRule { + // Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. + repeated string verbs = 1; + + // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // the enumerated resources in any API group will be allowed. + // +optional + repeated string apiGroups = 2; + + // Resources is a list of resources this rule applies to. ResourceAll represents all resources. + // +optional + repeated string resources = 3; + + // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // +optional + repeated string resourceNames = 4; + + // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. + // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + // +optional + repeated string nonResourceURLs = 5; +} + +// +k8s:deepcopy-gen=false +// PolicyRuleBuilder let's us attach methods. A no-no for API types. +// We use it to construct rules in code. It's more compact than trying to write them +// out in a literal and allows us to perform some basic checking during construction +message PolicyRuleBuilder { + optional PolicyRule policyRule = 1; +} + +// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. +message Role { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Rules holds all the PolicyRules for this Role + repeated PolicyRule rules = 2; +} + +// RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. +// It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given +// namespace only have effect in that namespace. +message RoleBinding { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Subjects holds references to the objects the role applies to. + repeated Subject subjects = 2; + + // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // If the RoleRef cannot be resolved, the Authorizer must return an error. + optional RoleRef roleRef = 3; +} + +// RoleBindingList is a collection of RoleBindings +message RoleBindingList { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is a list of RoleBindings + repeated RoleBinding items = 2; +} + +// RoleList is a collection of Roles +message RoleList { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is a list of Roles + repeated Role items = 2; +} + +// RoleRef contains information that points to the role being used +message RoleRef { + // APIGroup is the group for the resource being referenced + optional string apiGroup = 1; + + // Kind is the type of resource being referenced + optional string kind = 2; + + // Name is the name of resource being referenced + optional string name = 3; +} + +// Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, +// or a value for non-objects such as user and group names. +message Subject { + // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + optional string kind = 1; + + // APIVersion holds the API group and version of the referenced object. + // +optional + optional string apiVersion = 2; + + // Name of the object being referenced. + optional string name = 3; + + // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // the Authorizer should report an error. + // +optional + optional string namespace = 4; +} + diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go new file mode 100644 index 0000000000..063b9ed3f6 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go @@ -0,0 +1,146 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PolicyRuleBuilder let's us attach methods. A no-no for API types. +// We use it to construct rules in code. It's more compact than trying to write them +// out in a literal and allows us to perform some basic checking during construction +type PolicyRuleBuilder struct { + PolicyRule PolicyRule `protobuf:"bytes,1,opt,name=policyRule"` +} + +func NewRule(verbs ...string) *PolicyRuleBuilder { + return &PolicyRuleBuilder{ + PolicyRule: PolicyRule{Verbs: verbs}, + } +} + +func (r *PolicyRuleBuilder) Groups(groups ...string) *PolicyRuleBuilder { + r.PolicyRule.APIGroups = append(r.PolicyRule.APIGroups, groups...) + return r +} + +func (r *PolicyRuleBuilder) Resources(resources ...string) *PolicyRuleBuilder { + r.PolicyRule.Resources = append(r.PolicyRule.Resources, resources...) + return r +} + +func (r *PolicyRuleBuilder) Names(names ...string) *PolicyRuleBuilder { + r.PolicyRule.ResourceNames = append(r.PolicyRule.ResourceNames, names...) + return r +} + +func (r *PolicyRuleBuilder) URLs(urls ...string) *PolicyRuleBuilder { + r.PolicyRule.NonResourceURLs = append(r.PolicyRule.NonResourceURLs, urls...) + return r +} + +func (r *PolicyRuleBuilder) RuleOrDie() PolicyRule { + ret, err := r.Rule() + if err != nil { + panic(err) + } + return ret +} + +func (r *PolicyRuleBuilder) Rule() (PolicyRule, error) { + if len(r.PolicyRule.Verbs) == 0 { + return PolicyRule{}, fmt.Errorf("verbs are required: %#v", r.PolicyRule) + } + + switch { + case len(r.PolicyRule.NonResourceURLs) > 0: + if len(r.PolicyRule.APIGroups) != 0 || len(r.PolicyRule.Resources) != 0 || len(r.PolicyRule.ResourceNames) != 0 { + return PolicyRule{}, fmt.Errorf("non-resource rule may not have apiGroups, resources, or resourceNames: %#v", r.PolicyRule) + } + case len(r.PolicyRule.Resources) > 0: + if len(r.PolicyRule.NonResourceURLs) != 0 { + return PolicyRule{}, fmt.Errorf("resource rule may not have nonResourceURLs: %#v", r.PolicyRule) + } + if len(r.PolicyRule.APIGroups) == 0 { + // this a common bug + return PolicyRule{}, fmt.Errorf("resource rule must have apiGroups: %#v", r.PolicyRule) + } + default: + return PolicyRule{}, fmt.Errorf("a rule must have either nonResourceURLs or resources: %#v", r.PolicyRule) + } + + return r.PolicyRule, nil +} + +// ClusterRoleBindingBuilder let's us attach methods. A no-no for API types. +// We use it to construct bindings in code. It's more compact than trying to write them +// out in a literal. +type ClusterRoleBindingBuilder struct { + ClusterRoleBinding ClusterRoleBinding `protobuf:"bytes,1,opt,name=clusterRoleBinding"` +} + +func NewClusterBinding(clusterRoleName string) *ClusterRoleBindingBuilder { + return &ClusterRoleBindingBuilder{ + ClusterRoleBinding: ClusterRoleBinding{ + ObjectMeta: metav1.ObjectMeta{Name: clusterRoleName}, + RoleRef: RoleRef{ + APIGroup: GroupName, + Kind: "ClusterRole", + Name: clusterRoleName, + }, + }, + } +} + +func (r *ClusterRoleBindingBuilder) Groups(groups ...string) *ClusterRoleBindingBuilder { + for _, group := range groups { + r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: GroupKind, Name: group}) + } + return r +} + +func (r *ClusterRoleBindingBuilder) Users(users ...string) *ClusterRoleBindingBuilder { + for _, user := range users { + r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: UserKind, Name: user}) + } + return r +} + +func (r *ClusterRoleBindingBuilder) SAs(namespace string, serviceAccountNames ...string) *ClusterRoleBindingBuilder { + for _, saName := range serviceAccountNames { + r.ClusterRoleBinding.Subjects = append(r.ClusterRoleBinding.Subjects, Subject{Kind: ServiceAccountKind, Namespace: namespace, Name: saName}) + } + return r +} + +func (r *ClusterRoleBindingBuilder) BindingOrDie() ClusterRoleBinding { + ret, err := r.Binding() + if err != nil { + panic(err) + } + return ret +} + +func (r *ClusterRoleBindingBuilder) Binding() (ClusterRoleBinding, error) { + if len(r.ClusterRoleBinding.Subjects) == 0 { + return ClusterRoleBinding{}, fmt.Errorf("subjects are required: %#v", r.ClusterRoleBinding) + } + + return r.ClusterRoleBinding, nil +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go new file mode 100644 index 0000000000..ab6bd04336 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go @@ -0,0 +1,61 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/pkg/api/v1" +) + +const GroupName = "rbac.authorization.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Role{}, + &RoleBinding{}, + &RoleBindingList{}, + &RoleList{}, + + &ClusterRole{}, + &ClusterRoleBinding{}, + &ClusterRoleBindingList{}, + &ClusterRoleList{}, + + &v1.ListOptions{}, + &v1.DeleteOptions{}, + &metav1.ExportOptions{}, + &metav1.GetOptions{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go new file mode 100644 index 0000000000..db87af940a --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go @@ -0,0 +1,4879 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// ************************************************************ +// DO NOT EDIT. +// THIS FILE IS AUTO-GENERATED BY codecgen. +// ************************************************************ + +package v1beta1 + +import ( + "errors" + "fmt" + codec1978 "github.com/ugorji/go/codec" + pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + pkg2_types "k8s.io/apimachinery/pkg/types" + "reflect" + "runtime" + time "time" +) + +const ( + // ----- content types ---- + codecSelferC_UTF81234 = 1 + codecSelferC_RAW1234 = 0 + // ----- value types used ---- + codecSelferValueTypeArray1234 = 10 + codecSelferValueTypeMap1234 = 9 + // ----- containerStateValues ---- + codecSelfer_containerMapKey1234 = 2 + codecSelfer_containerMapValue1234 = 3 + codecSelfer_containerMapEnd1234 = 4 + codecSelfer_containerArrayElem1234 = 6 + codecSelfer_containerArrayEnd1234 = 7 +) + +var ( + codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer1234 struct{} + +func init() { + if codec1978.GenVersion != 5 { + _, file, _, _ := runtime.Caller(0) + err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", + 5, codec1978.GenVersion, file) + panic(err) + } + if false { // reference the types, but skip this branch at build/run time + var v0 pkg1_v1.TypeMeta + var v1 pkg2_types.UID + var v2 time.Time + _, _, _ = v0, v1, v2 + } +} + +func (x *PolicyRule) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = len(x.APIGroups) != 0 + yyq2[2] = len(x.Resources) != 0 + yyq2[3] = len(x.ResourceNames) != 0 + yyq2[4] = len(x.NonResourceURLs) != 0 + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Verbs == nil { + r.EncodeNil() + } else { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + z.F.EncSliceStringV(x.Verbs, false, e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("verbs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Verbs == nil { + r.EncodeNil() + } else { + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + z.F.EncSliceStringV(x.Verbs, false, e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + if x.APIGroups == nil { + r.EncodeNil() + } else { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + z.F.EncSliceStringV(x.APIGroups, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiGroups")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.APIGroups == nil { + r.EncodeNil() + } else { + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + z.F.EncSliceStringV(x.APIGroups, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + if x.Resources == nil { + r.EncodeNil() + } else { + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + z.F.EncSliceStringV(x.Resources, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resources")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Resources == nil { + r.EncodeNil() + } else { + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + z.F.EncSliceStringV(x.Resources, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + if x.ResourceNames == nil { + r.EncodeNil() + } else { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + z.F.EncSliceStringV(x.ResourceNames, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("resourceNames")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.ResourceNames == nil { + r.EncodeNil() + } else { + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + z.F.EncSliceStringV(x.ResourceNames, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[4] { + if x.NonResourceURLs == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + z.F.EncSliceStringV(x.NonResourceURLs, false, e) + } + } + } else { + r.EncodeNil() + } + } else { + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("nonResourceURLs")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.NonResourceURLs == nil { + r.EncodeNil() + } else { + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + z.F.EncSliceStringV(x.NonResourceURLs, false, e) + } + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *PolicyRule) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *PolicyRule) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "verbs": + if r.TryDecodeAsNil() { + x.Verbs = nil + } else { + yyv4 := &x.Verbs + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + z.F.DecSliceStringX(yyv4, false, d) + } + } + case "apiGroups": + if r.TryDecodeAsNil() { + x.APIGroups = nil + } else { + yyv6 := &x.APIGroups + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + z.F.DecSliceStringX(yyv6, false, d) + } + } + case "resources": + if r.TryDecodeAsNil() { + x.Resources = nil + } else { + yyv8 := &x.Resources + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + z.F.DecSliceStringX(yyv8, false, d) + } + } + case "resourceNames": + if r.TryDecodeAsNil() { + x.ResourceNames = nil + } else { + yyv10 := &x.ResourceNames + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + z.F.DecSliceStringX(yyv10, false, d) + } + } + case "nonResourceURLs": + if r.TryDecodeAsNil() { + x.NonResourceURLs = nil + } else { + yyv12 := &x.NonResourceURLs + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + z.F.DecSliceStringX(yyv12, false, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *PolicyRule) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Verbs = nil + } else { + yyv15 := &x.Verbs + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + z.F.DecSliceStringX(yyv15, false, d) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIGroups = nil + } else { + yyv17 := &x.APIGroups + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + z.F.DecSliceStringX(yyv17, false, d) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Resources = nil + } else { + yyv19 := &x.Resources + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + z.F.DecSliceStringX(yyv19, false, d) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ResourceNames = nil + } else { + yyv21 := &x.ResourceNames + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + z.F.DecSliceStringX(yyv21, false, d) + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.NonResourceURLs = nil + } else { + yyv23 := &x.NonResourceURLs + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + z.F.DecSliceStringX(yyv23, false, d) + } + } + for { + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj14-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *Subject) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[1] = x.APIVersion != "" + yyq2[3] = x.Namespace != "" + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("namespace")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Namespace)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *Subject) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *Subject) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + yyv8 := &x.Name + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + case "namespace": + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + yyv10 := &x.Namespace + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*string)(yyv10)) = r.DecodeString() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *Subject) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + yyv17 := &x.Name + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*string)(yyv17)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Namespace = "" + } else { + yyv19 := &x.Namespace + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*string)(yyv19)) = r.DecodeString() + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RoleRef) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [3]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(3) + } else { + yynn2 = 3 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiGroup")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIGroup)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("name")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Name)) + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RoleRef) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RoleRef) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "apiGroup": + if r.TryDecodeAsNil() { + x.APIGroup = "" + } else { + yyv4 := &x.APIGroup + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv6 := &x.Kind + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "name": + if r.TryDecodeAsNil() { + x.Name = "" + } else { + yyv8 := &x.Name + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RoleRef) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIGroup = "" + } else { + yyv11 := &x.APIGroup + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *((*string)(yyv11)) = r.DecodeString() + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Name = "" + } else { + yyv15 := &x.Name + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj10-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *Role) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ObjectMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ObjectMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Rules == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSlicePolicyRule(([]PolicyRule)(x.Rules), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rules")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Rules == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSlicePolicyRule(([]PolicyRule)(x.Rules), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *Role) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *Role) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv8 := &x.ObjectMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "rules": + if r.TryDecodeAsNil() { + x.Rules = nil + } else { + yyv10 := &x.Rules + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSlicePolicyRule((*[]PolicyRule)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *Role) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv17 := &x.ObjectMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Rules = nil + } else { + yyv19 := &x.Rules + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSlicePolicyRule((*[]PolicyRule)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RoleBinding) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ObjectMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ObjectMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Subjects == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceSubject(([]Subject)(x.Subjects), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("subjects")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Subjects == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceSubject(([]Subject)(x.Subjects), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy18 := &x.RoleRef + yy18.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("roleRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy20 := &x.RoleRef + yy20.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RoleBinding) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RoleBinding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv8 := &x.ObjectMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "subjects": + if r.TryDecodeAsNil() { + x.Subjects = nil + } else { + yyv10 := &x.Subjects + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceSubject((*[]Subject)(yyv10), d) + } + } + case "roleRef": + if r.TryDecodeAsNil() { + x.RoleRef = RoleRef{} + } else { + yyv12 := &x.RoleRef + yyv12.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RoleBinding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv14 := &x.Kind + yym15 := z.DecBinary() + _ = yym15 + if false { + } else { + *((*string)(yyv14)) = r.DecodeString() + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv16 := &x.APIVersion + yym17 := z.DecBinary() + _ = yym17 + if false { + } else { + *((*string)(yyv16)) = r.DecodeString() + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv18 := &x.ObjectMeta + yym19 := z.DecBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.DecExt(yyv18) { + } else { + z.DecFallback(yyv18, false) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subjects = nil + } else { + yyv20 := &x.Subjects + yym21 := z.DecBinary() + _ = yym21 + if false { + } else { + h.decSliceSubject((*[]Subject)(yyv20), d) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RoleRef = RoleRef{} + } else { + yyv22 := &x.RoleRef + yyv22.CodecDecodeSelf(d) + } + for { + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RoleBindingList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ListMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ListMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceRoleBinding(([]RoleBinding)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceRoleBinding(([]RoleBinding)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RoleBindingList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RoleBindingList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv8 := &x.ListMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv10 := &x.Items + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceRoleBinding((*[]RoleBinding)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RoleBindingList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv17 := &x.ListMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv19 := &x.Items + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSliceRoleBinding((*[]RoleBinding)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *RoleList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ListMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ListMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceRole(([]Role)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceRole(([]Role)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *RoleList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *RoleList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv8 := &x.ListMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv10 := &x.Items + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceRole((*[]Role)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *RoleList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv17 := &x.ListMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv19 := &x.Items + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSliceRole((*[]Role)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ClusterRole) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ObjectMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ObjectMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Rules == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSlicePolicyRule(([]PolicyRule)(x.Rules), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("rules")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Rules == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSlicePolicyRule(([]PolicyRule)(x.Rules), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ClusterRole) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ClusterRole) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv8 := &x.ObjectMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "rules": + if r.TryDecodeAsNil() { + x.Rules = nil + } else { + yyv10 := &x.Rules + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSlicePolicyRule((*[]PolicyRule)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ClusterRole) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv17 := &x.ObjectMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Rules = nil + } else { + yyv19 := &x.Rules + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSlicePolicyRule((*[]PolicyRule)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ClusterRoleBinding) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [5]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(5) + } else { + yynn2 = 2 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ObjectMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ObjectMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Subjects == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceSubject(([]Subject)(x.Subjects), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("subjects")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Subjects == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceSubject(([]Subject)(x.Subjects), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy18 := &x.RoleRef + yy18.CodecEncodeSelf(e) + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("roleRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy20 := &x.RoleRef + yy20.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ClusterRoleBinding) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ClusterRoleBinding) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv8 := &x.ObjectMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "subjects": + if r.TryDecodeAsNil() { + x.Subjects = nil + } else { + yyv10 := &x.Subjects + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceSubject((*[]Subject)(yyv10), d) + } + } + case "roleRef": + if r.TryDecodeAsNil() { + x.RoleRef = RoleRef{} + } else { + yyv12 := &x.RoleRef + yyv12.CodecDecodeSelf(d) + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ClusterRoleBinding) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj13 int + var yyb13 bool + var yyhl13 bool = l >= 0 + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv14 := &x.Kind + yym15 := z.DecBinary() + _ = yym15 + if false { + } else { + *((*string)(yyv14)) = r.DecodeString() + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv16 := &x.APIVersion + yym17 := z.DecBinary() + _ = yym17 + if false { + } else { + *((*string)(yyv16)) = r.DecodeString() + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ObjectMeta = pkg1_v1.ObjectMeta{} + } else { + yyv18 := &x.ObjectMeta + yym19 := z.DecBinary() + _ = yym19 + if false { + } else if z.HasExtensions() && z.DecExt(yyv18) { + } else { + z.DecFallback(yyv18, false) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Subjects = nil + } else { + yyv20 := &x.Subjects + yym21 := z.DecBinary() + _ = yym21 + if false { + } else { + h.decSliceSubject((*[]Subject)(yyv20), d) + } + } + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.RoleRef = RoleRef{} + } else { + yyv22 := &x.RoleRef + yyv22.CodecDecodeSelf(d) + } + for { + yyj13++ + if yyhl13 { + yyb13 = yyj13 > l + } else { + yyb13 = r.CheckBreak() + } + if yyb13 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj13-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ClusterRoleBindingList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ListMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ListMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceClusterRoleBinding(([]ClusterRoleBinding)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceClusterRoleBinding(([]ClusterRoleBinding)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ClusterRoleBindingList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ClusterRoleBindingList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv8 := &x.ListMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv10 := &x.Items + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceClusterRoleBinding((*[]ClusterRoleBinding)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ClusterRoleBindingList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv17 := &x.ListMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv19 := &x.Items + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSliceClusterRoleBinding((*[]ClusterRoleBinding)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x *ClusterRoleList) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + var yyq2 [4]bool + _, _, _ = yysep2, yyq2, yy2arr2 + const yyr2 bool = false + yyq2[0] = x.Kind != "" + yyq2[1] = x.APIVersion != "" + yyq2[2] = true + var yynn2 int + if yyr2 || yy2arr2 { + r.EncodeArrayStart(4) + } else { + yynn2 = 1 + for _, b := range yyq2 { + if b { + yynn2++ + } + } + r.EncodeMapStart(yynn2) + yynn2 = 0 + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[0] { + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[0] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("kind")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Kind)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[1] { + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } else { + r.EncodeString(codecSelferC_UTF81234, "") + } + } else { + if yyq2[1] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("apiVersion")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion)) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if yyq2[2] { + yy10 := &x.ListMeta + yym11 := z.EncBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.EncExt(yy10) { + } else { + z.EncFallback(yy10) + } + } else { + r.EncodeNil() + } + } else { + if yyq2[2] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("metadata")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yy12 := &x.ListMeta + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(yy12) { + } else { + z.EncFallback(yy12) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym15 := z.EncBinary() + _ = yym15 + if false { + } else { + h.encSliceClusterRole(([]ClusterRole)(x.Items), e) + } + } + } else { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("items")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.Items == nil { + r.EncodeNil() + } else { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + h.encSliceClusterRole(([]ClusterRole)(x.Items), e) + } + } + } + if yyr2 || yy2arr2 { + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + z.EncSendContainerState(codecSelfer_containerMapEnd1234) + } + } + } +} + +func (x *ClusterRoleList) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap1234 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerMapEnd1234) + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray1234 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234) + } + } +} + +func (x *ClusterRoleList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + z.DecSendContainerState(codecSelfer_containerMapKey1234) + yys3Slc = r.DecodeBytes(yys3Slc, true, true) + yys3 := string(yys3Slc) + z.DecSendContainerState(codecSelfer_containerMapValue1234) + switch yys3 { + case "kind": + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv4 := &x.Kind + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "apiVersion": + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv6 := &x.APIVersion + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "metadata": + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv8 := &x.ListMeta + yym9 := z.DecBinary() + _ = yym9 + if false { + } else if z.HasExtensions() && z.DecExt(yyv8) { + } else { + z.DecFallback(yyv8, false) + } + } + case "items": + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv10 := &x.Items + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + h.decSliceClusterRole((*[]ClusterRole)(yyv10), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + z.DecSendContainerState(codecSelfer_containerMapEnd1234) +} + +func (x *ClusterRoleList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Kind = "" + } else { + yyv13 := &x.Kind + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.APIVersion = "" + } else { + yyv15 := &x.APIVersion + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.ListMeta = pkg1_v1.ListMeta{} + } else { + yyv17 := &x.ListMeta + yym18 := z.DecBinary() + _ = yym18 + if false { + } else if z.HasExtensions() && z.DecExt(yyv17) { + } else { + z.DecFallback(yyv17, false) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) + return + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + if r.TryDecodeAsNil() { + x.Items = nil + } else { + yyv19 := &x.Items + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + h.decSliceClusterRole((*[]ClusterRole)(yyv19), d) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + z.DecSendContainerState(codecSelfer_containerArrayElem1234) + z.DecStructFieldNotFound(yyj12-1, "") + } + z.DecSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) encSlicePolicyRule(v []PolicyRule, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSlicePolicyRule(v *[]PolicyRule, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []PolicyRule{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 120) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]PolicyRule, yyrl1) + } + } else { + yyv1 = make([]PolicyRule, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PolicyRule{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, PolicyRule{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = PolicyRule{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, PolicyRule{}) // var yyz1 PolicyRule + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = PolicyRule{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []PolicyRule{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceSubject(v []Subject, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceSubject(v *[]Subject, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Subject{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 64) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Subject, yyrl1) + } + } else { + yyv1 = make([]Subject, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Subject{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Subject{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Subject{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Subject{}) // var yyz1 Subject + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = Subject{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Subject{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceRoleBinding(v []RoleBinding, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceRoleBinding(v *[]RoleBinding, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []RoleBinding{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 328) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]RoleBinding, yyrl1) + } + } else { + yyv1 = make([]RoleBinding, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = RoleBinding{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, RoleBinding{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = RoleBinding{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, RoleBinding{}) // var yyz1 RoleBinding + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = RoleBinding{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []RoleBinding{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceRole(v []Role, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceRole(v *[]Role, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []Role{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 280) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]Role, yyrl1) + } + } else { + yyv1 = make([]Role, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Role{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, Role{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = Role{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, Role{}) // var yyz1 Role + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = Role{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []Role{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceClusterRoleBinding(v []ClusterRoleBinding, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceClusterRoleBinding(v *[]ClusterRoleBinding, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ClusterRoleBinding{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 328) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ClusterRoleBinding, yyrl1) + } + } else { + yyv1 = make([]ClusterRoleBinding, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRoleBinding{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ClusterRoleBinding{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRoleBinding{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ClusterRoleBinding{}) // var yyz1 ClusterRoleBinding + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRoleBinding{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ClusterRoleBinding{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} + +func (x codecSelfer1234) encSliceClusterRole(v []ClusterRole, e *codec1978.Encoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.EncodeArrayStart(len(v)) + for _, yyv1 := range v { + z.EncSendContainerState(codecSelfer_containerArrayElem1234) + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + z.EncSendContainerState(codecSelfer_containerArrayEnd1234) +} + +func (x codecSelfer1234) decSliceClusterRole(v *[]ClusterRole, d *codec1978.Decoder) { + var h codecSelfer1234 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []ClusterRole{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else if yyl1 > 0 { + var yyrr1, yyrl1 int + var yyrt1 bool + _, _ = yyrl1, yyrt1 + yyrr1 = yyl1 // len(yyv1) + if yyl1 > cap(yyv1) { + + yyrg1 := len(yyv1) > 0 + yyv21 := yyv1 + yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 280) + if yyrt1 { + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]ClusterRole, yyrl1) + } + } else { + yyv1 = make([]ClusterRole, yyrl1) + } + yyc1 = true + yyrr1 = len(yyv1) + if yyrg1 { + copy(yyv1, yyv21) + } + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + yyj1 := 0 + for ; yyj1 < yyrr1; yyj1++ { + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRole{} + } else { + yyv2 := &yyv1[yyj1] + yyv2.CodecDecodeSelf(d) + } + + } + if yyrt1 { + for ; yyj1 < yyl1; yyj1++ { + yyv1 = append(yyv1, ClusterRole{}) + yyh1.ElemContainerState(yyj1) + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRole{} + } else { + yyv3 := &yyv1[yyj1] + yyv3.CodecDecodeSelf(d) + } + + } + } + + } else { + yyj1 := 0 + for ; !r.CheckBreak(); yyj1++ { + + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, ClusterRole{}) // var yyz1 ClusterRole + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + if yyj1 < len(yyv1) { + if r.TryDecodeAsNil() { + yyv1[yyj1] = ClusterRole{} + } else { + yyv4 := &yyv1[yyj1] + yyv4.CodecDecodeSelf(d) + } + + } else { + z.DecSwallow() + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = []ClusterRole{} + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go new file mode 100644 index 0000000000..8d0fd0321a --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go @@ -0,0 +1,202 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Authorization is calculated against +// 1. evaluation of ClusterRoleBindings - short circuit on match +// 2. evaluation of RoleBindings in the namespace requested - short circuit on match +// 3. deny by default + +const ( + APIGroupAll = "*" + ResourceAll = "*" + VerbAll = "*" + NonResourceAll = "*" + + GroupKind = "Group" + ServiceAccountKind = "ServiceAccount" + UserKind = "User" +) + +// Authorization is calculated against +// 1. evaluation of ClusterRoleBindings - short circuit on match +// 2. evaluation of RoleBindings in the namespace requested - short circuit on match +// 3. deny by default + +// PolicyRule holds information that describes a policy rule, but does not contain information +// about who the rule applies to or which namespace the rule applies to. +type PolicyRule struct { + // Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. + Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` + + // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // the enumerated resources in any API group will be allowed. + // +optional + APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` + // Resources is a list of resources this rule applies to. ResourceAll represents all resources. + // +optional + Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` + // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // +optional + ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` + + // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path + // Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. + // Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both. + // +optional + NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,5,rep,name=nonResourceURLs"` +} + +// Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, +// or a value for non-objects such as user and group names. +type Subject struct { + // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". + // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` + // APIVersion holds the API group and version of the referenced object. + // +optional + APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt.name=apiVersion"` + // Name of the object being referenced. + Name string `json:"name" protobuf:"bytes,3,opt,name=name"` + // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty + // the Authorizer should report an error. + // +optional + Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"` +} + +// RoleRef contains information that points to the role being used +type RoleRef struct { + // APIGroup is the group for the resource being referenced + APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` + // Kind is the type of resource being referenced + Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` + // Name is the name of resource being referenced + Name string `json:"name" protobuf:"bytes,3,opt,name=name"` +} + +// +genclient=true + +// Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding. +type Role struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Rules holds all the PolicyRules for this Role + Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` +} + +// +genclient=true + +// RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. +// It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given +// namespace only have effect in that namespace. +type RoleBinding struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Subjects holds references to the objects the role applies to. + Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"` + + // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. + // If the RoleRef cannot be resolved, the Authorizer must return an error. + RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` +} + +// RoleBindingList is a collection of RoleBindings +type RoleBindingList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is a list of RoleBindings + Items []RoleBinding `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// RoleList is a collection of Roles +type RoleList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is a list of Roles + Items []Role `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient=true +// +nonNamespaced=true + +// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding. +type ClusterRole struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Rules holds all the PolicyRules for this ClusterRole + Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` +} + +// +genclient=true +// +nonNamespaced=true + +// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, +// and adds who information via Subject. +type ClusterRoleBinding struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Subjects holds references to the objects the role applies to. + Subjects []Subject `json:"subjects" protobuf:"bytes,2,rep,name=subjects"` + + // RoleRef can only reference a ClusterRole in the global namespace. + // If the RoleRef cannot be resolved, the Authorizer must return an error. + RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` +} + +// ClusterRoleBindingList is a collection of ClusterRoleBindings +type ClusterRoleBindingList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is a list of ClusterRoleBindings + Items []ClusterRoleBinding `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// ClusterRoleList is a collection of ClusterRoles +type ClusterRoleList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is a list of ClusterRoles + Items []ClusterRole `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go new file mode 100644 index 0000000000..a6682bd32d --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go @@ -0,0 +1,148 @@ +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-generated-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_ClusterRole = map[string]string{ + "": "ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.", + "metadata": "Standard object's metadata.", + "rules": "Rules holds all the PolicyRules for this ClusterRole", +} + +func (ClusterRole) SwaggerDoc() map[string]string { + return map_ClusterRole +} + +var map_ClusterRoleBinding = map[string]string{ + "": "ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject.", + "metadata": "Standard object's metadata.", + "subjects": "Subjects holds references to the objects the role applies to.", + "roleRef": "RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", +} + +func (ClusterRoleBinding) SwaggerDoc() map[string]string { + return map_ClusterRoleBinding +} + +var map_ClusterRoleBindingList = map[string]string{ + "": "ClusterRoleBindingList is a collection of ClusterRoleBindings", + "metadata": "Standard object's metadata.", + "items": "Items is a list of ClusterRoleBindings", +} + +func (ClusterRoleBindingList) SwaggerDoc() map[string]string { + return map_ClusterRoleBindingList +} + +var map_ClusterRoleList = map[string]string{ + "": "ClusterRoleList is a collection of ClusterRoles", + "metadata": "Standard object's metadata.", + "items": "Items is a list of ClusterRoles", +} + +func (ClusterRoleList) SwaggerDoc() map[string]string { + return map_ClusterRoleList +} + +var map_PolicyRule = map[string]string{ + "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", + "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.", + "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.", + "resources": "Resources is a list of resources this rule applies to. ResourceAll represents all resources.", + "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", +} + +func (PolicyRule) SwaggerDoc() map[string]string { + return map_PolicyRule +} + +var map_Role = map[string]string{ + "": "Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.", + "metadata": "Standard object's metadata.", + "rules": "Rules holds all the PolicyRules for this Role", +} + +func (Role) SwaggerDoc() map[string]string { + return map_Role +} + +var map_RoleBinding = map[string]string{ + "": "RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.", + "metadata": "Standard object's metadata.", + "subjects": "Subjects holds references to the objects the role applies to.", + "roleRef": "RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", +} + +func (RoleBinding) SwaggerDoc() map[string]string { + return map_RoleBinding +} + +var map_RoleBindingList = map[string]string{ + "": "RoleBindingList is a collection of RoleBindings", + "metadata": "Standard object's metadata.", + "items": "Items is a list of RoleBindings", +} + +func (RoleBindingList) SwaggerDoc() map[string]string { + return map_RoleBindingList +} + +var map_RoleList = map[string]string{ + "": "RoleList is a collection of Roles", + "metadata": "Standard object's metadata.", + "items": "Items is a list of Roles", +} + +func (RoleList) SwaggerDoc() map[string]string { + return map_RoleList +} + +var map_RoleRef = map[string]string{ + "": "RoleRef contains information that points to the role being used", + "apiGroup": "APIGroup is the group for the resource being referenced", + "kind": "Kind is the type of resource being referenced", + "name": "Name is the name of resource being referenced", +} + +func (RoleRef) SwaggerDoc() map[string]string { + return map_RoleRef +} + +var map_Subject = map[string]string{ + "": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.", + "kind": "Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", + "apiVersion": "APIVersion holds the API group and version of the referenced object.", + "name": "Name of the object being referenced.", + "namespace": "Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", +} + +func (Subject) SwaggerDoc() map[string]string { + return map_Subject +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go new file mode 100644 index 0000000000..c9c5e6f51c --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go @@ -0,0 +1,353 @@ +// +build !ignore_autogenerated + +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by conversion-gen. Do not edit it manually! + +package v1beta1 + +import ( + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + rbac "k8s.io/client-go/pkg/apis/rbac" + unsafe "unsafe" +) + +func init() { + SchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(scheme *runtime.Scheme) error { + return scheme.AddGeneratedConversionFuncs( + Convert_v1beta1_ClusterRole_To_rbac_ClusterRole, + Convert_rbac_ClusterRole_To_v1beta1_ClusterRole, + Convert_v1beta1_ClusterRoleBinding_To_rbac_ClusterRoleBinding, + Convert_rbac_ClusterRoleBinding_To_v1beta1_ClusterRoleBinding, + Convert_v1beta1_ClusterRoleBindingBuilder_To_rbac_ClusterRoleBindingBuilder, + Convert_rbac_ClusterRoleBindingBuilder_To_v1beta1_ClusterRoleBindingBuilder, + Convert_v1beta1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList, + Convert_rbac_ClusterRoleBindingList_To_v1beta1_ClusterRoleBindingList, + Convert_v1beta1_ClusterRoleList_To_rbac_ClusterRoleList, + Convert_rbac_ClusterRoleList_To_v1beta1_ClusterRoleList, + Convert_v1beta1_PolicyRule_To_rbac_PolicyRule, + Convert_rbac_PolicyRule_To_v1beta1_PolicyRule, + Convert_v1beta1_PolicyRuleBuilder_To_rbac_PolicyRuleBuilder, + Convert_rbac_PolicyRuleBuilder_To_v1beta1_PolicyRuleBuilder, + Convert_v1beta1_Role_To_rbac_Role, + Convert_rbac_Role_To_v1beta1_Role, + Convert_v1beta1_RoleBinding_To_rbac_RoleBinding, + Convert_rbac_RoleBinding_To_v1beta1_RoleBinding, + Convert_v1beta1_RoleBindingList_To_rbac_RoleBindingList, + Convert_rbac_RoleBindingList_To_v1beta1_RoleBindingList, + Convert_v1beta1_RoleList_To_rbac_RoleList, + Convert_rbac_RoleList_To_v1beta1_RoleList, + Convert_v1beta1_RoleRef_To_rbac_RoleRef, + Convert_rbac_RoleRef_To_v1beta1_RoleRef, + Convert_v1beta1_Subject_To_rbac_Subject, + Convert_rbac_Subject_To_v1beta1_Subject, + ) +} + +func autoConvert_v1beta1_ClusterRole_To_rbac_ClusterRole(in *ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules)) + return nil +} + +func Convert_v1beta1_ClusterRole_To_rbac_ClusterRole(in *ClusterRole, out *rbac.ClusterRole, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterRole_To_rbac_ClusterRole(in, out, s) +} + +func autoConvert_rbac_ClusterRole_To_v1beta1_ClusterRole(in *rbac.ClusterRole, out *ClusterRole, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules)) + return nil +} + +func Convert_rbac_ClusterRole_To_v1beta1_ClusterRole(in *rbac.ClusterRole, out *ClusterRole, s conversion.Scope) error { + return autoConvert_rbac_ClusterRole_To_v1beta1_ClusterRole(in, out, s) +} + +func autoConvert_v1beta1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in *ClusterRoleBinding, out *rbac.ClusterRoleBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subjects = *(*[]rbac.Subject)(unsafe.Pointer(&in.Subjects)) + if err := Convert_v1beta1_RoleRef_To_rbac_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in *ClusterRoleBinding, out *rbac.ClusterRoleBinding, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(in, out, s) +} + +func autoConvert_rbac_ClusterRoleBinding_To_v1beta1_ClusterRoleBinding(in *rbac.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subjects = *(*[]Subject)(unsafe.Pointer(&in.Subjects)) + if err := Convert_rbac_RoleRef_To_v1beta1_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil { + return err + } + return nil +} + +func Convert_rbac_ClusterRoleBinding_To_v1beta1_ClusterRoleBinding(in *rbac.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error { + return autoConvert_rbac_ClusterRoleBinding_To_v1beta1_ClusterRoleBinding(in, out, s) +} + +func autoConvert_v1beta1_ClusterRoleBindingBuilder_To_rbac_ClusterRoleBindingBuilder(in *ClusterRoleBindingBuilder, out *rbac.ClusterRoleBindingBuilder, s conversion.Scope) error { + if err := Convert_v1beta1_ClusterRoleBinding_To_rbac_ClusterRoleBinding(&in.ClusterRoleBinding, &out.ClusterRoleBinding, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_ClusterRoleBindingBuilder_To_rbac_ClusterRoleBindingBuilder(in *ClusterRoleBindingBuilder, out *rbac.ClusterRoleBindingBuilder, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterRoleBindingBuilder_To_rbac_ClusterRoleBindingBuilder(in, out, s) +} + +func autoConvert_rbac_ClusterRoleBindingBuilder_To_v1beta1_ClusterRoleBindingBuilder(in *rbac.ClusterRoleBindingBuilder, out *ClusterRoleBindingBuilder, s conversion.Scope) error { + if err := Convert_rbac_ClusterRoleBinding_To_v1beta1_ClusterRoleBinding(&in.ClusterRoleBinding, &out.ClusterRoleBinding, s); err != nil { + return err + } + return nil +} + +func Convert_rbac_ClusterRoleBindingBuilder_To_v1beta1_ClusterRoleBindingBuilder(in *rbac.ClusterRoleBindingBuilder, out *ClusterRoleBindingBuilder, s conversion.Scope) error { + return autoConvert_rbac_ClusterRoleBindingBuilder_To_v1beta1_ClusterRoleBindingBuilder(in, out, s) +} + +func autoConvert_v1beta1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in *ClusterRoleBindingList, out *rbac.ClusterRoleBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]rbac.ClusterRoleBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_v1beta1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in *ClusterRoleBindingList, out *rbac.ClusterRoleBindingList, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterRoleBindingList_To_rbac_ClusterRoleBindingList(in, out, s) +} + +func autoConvert_rbac_ClusterRoleBindingList_To_v1beta1_ClusterRoleBindingList(in *rbac.ClusterRoleBindingList, out *ClusterRoleBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ClusterRoleBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_rbac_ClusterRoleBindingList_To_v1beta1_ClusterRoleBindingList(in *rbac.ClusterRoleBindingList, out *ClusterRoleBindingList, s conversion.Scope) error { + return autoConvert_rbac_ClusterRoleBindingList_To_v1beta1_ClusterRoleBindingList(in, out, s) +} + +func autoConvert_v1beta1_ClusterRoleList_To_rbac_ClusterRoleList(in *ClusterRoleList, out *rbac.ClusterRoleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]rbac.ClusterRole)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_v1beta1_ClusterRoleList_To_rbac_ClusterRoleList(in *ClusterRoleList, out *rbac.ClusterRoleList, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterRoleList_To_rbac_ClusterRoleList(in, out, s) +} + +func autoConvert_rbac_ClusterRoleList_To_v1beta1_ClusterRoleList(in *rbac.ClusterRoleList, out *ClusterRoleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ClusterRole)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_rbac_ClusterRoleList_To_v1beta1_ClusterRoleList(in *rbac.ClusterRoleList, out *ClusterRoleList, s conversion.Scope) error { + return autoConvert_rbac_ClusterRoleList_To_v1beta1_ClusterRoleList(in, out, s) +} + +func autoConvert_v1beta1_PolicyRule_To_rbac_PolicyRule(in *PolicyRule, out *rbac.PolicyRule, s conversion.Scope) error { + out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) + out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups)) + out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) + out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) + out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) + return nil +} + +func Convert_v1beta1_PolicyRule_To_rbac_PolicyRule(in *PolicyRule, out *rbac.PolicyRule, s conversion.Scope) error { + return autoConvert_v1beta1_PolicyRule_To_rbac_PolicyRule(in, out, s) +} + +func autoConvert_rbac_PolicyRule_To_v1beta1_PolicyRule(in *rbac.PolicyRule, out *PolicyRule, s conversion.Scope) error { + out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) + out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups)) + out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources)) + out.ResourceNames = *(*[]string)(unsafe.Pointer(&in.ResourceNames)) + out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) + return nil +} + +func Convert_rbac_PolicyRule_To_v1beta1_PolicyRule(in *rbac.PolicyRule, out *PolicyRule, s conversion.Scope) error { + return autoConvert_rbac_PolicyRule_To_v1beta1_PolicyRule(in, out, s) +} + +func autoConvert_v1beta1_PolicyRuleBuilder_To_rbac_PolicyRuleBuilder(in *PolicyRuleBuilder, out *rbac.PolicyRuleBuilder, s conversion.Scope) error { + if err := Convert_v1beta1_PolicyRule_To_rbac_PolicyRule(&in.PolicyRule, &out.PolicyRule, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_PolicyRuleBuilder_To_rbac_PolicyRuleBuilder(in *PolicyRuleBuilder, out *rbac.PolicyRuleBuilder, s conversion.Scope) error { + return autoConvert_v1beta1_PolicyRuleBuilder_To_rbac_PolicyRuleBuilder(in, out, s) +} + +func autoConvert_rbac_PolicyRuleBuilder_To_v1beta1_PolicyRuleBuilder(in *rbac.PolicyRuleBuilder, out *PolicyRuleBuilder, s conversion.Scope) error { + if err := Convert_rbac_PolicyRule_To_v1beta1_PolicyRule(&in.PolicyRule, &out.PolicyRule, s); err != nil { + return err + } + return nil +} + +func Convert_rbac_PolicyRuleBuilder_To_v1beta1_PolicyRuleBuilder(in *rbac.PolicyRuleBuilder, out *PolicyRuleBuilder, s conversion.Scope) error { + return autoConvert_rbac_PolicyRuleBuilder_To_v1beta1_PolicyRuleBuilder(in, out, s) +} + +func autoConvert_v1beta1_Role_To_rbac_Role(in *Role, out *rbac.Role, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Rules = *(*[]rbac.PolicyRule)(unsafe.Pointer(&in.Rules)) + return nil +} + +func Convert_v1beta1_Role_To_rbac_Role(in *Role, out *rbac.Role, s conversion.Scope) error { + return autoConvert_v1beta1_Role_To_rbac_Role(in, out, s) +} + +func autoConvert_rbac_Role_To_v1beta1_Role(in *rbac.Role, out *Role, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Rules = *(*[]PolicyRule)(unsafe.Pointer(&in.Rules)) + return nil +} + +func Convert_rbac_Role_To_v1beta1_Role(in *rbac.Role, out *Role, s conversion.Scope) error { + return autoConvert_rbac_Role_To_v1beta1_Role(in, out, s) +} + +func autoConvert_v1beta1_RoleBinding_To_rbac_RoleBinding(in *RoleBinding, out *rbac.RoleBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subjects = *(*[]rbac.Subject)(unsafe.Pointer(&in.Subjects)) + if err := Convert_v1beta1_RoleRef_To_rbac_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil { + return err + } + return nil +} + +func Convert_v1beta1_RoleBinding_To_rbac_RoleBinding(in *RoleBinding, out *rbac.RoleBinding, s conversion.Scope) error { + return autoConvert_v1beta1_RoleBinding_To_rbac_RoleBinding(in, out, s) +} + +func autoConvert_rbac_RoleBinding_To_v1beta1_RoleBinding(in *rbac.RoleBinding, out *RoleBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subjects = *(*[]Subject)(unsafe.Pointer(&in.Subjects)) + if err := Convert_rbac_RoleRef_To_v1beta1_RoleRef(&in.RoleRef, &out.RoleRef, s); err != nil { + return err + } + return nil +} + +func Convert_rbac_RoleBinding_To_v1beta1_RoleBinding(in *rbac.RoleBinding, out *RoleBinding, s conversion.Scope) error { + return autoConvert_rbac_RoleBinding_To_v1beta1_RoleBinding(in, out, s) +} + +func autoConvert_v1beta1_RoleBindingList_To_rbac_RoleBindingList(in *RoleBindingList, out *rbac.RoleBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]rbac.RoleBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_v1beta1_RoleBindingList_To_rbac_RoleBindingList(in *RoleBindingList, out *rbac.RoleBindingList, s conversion.Scope) error { + return autoConvert_v1beta1_RoleBindingList_To_rbac_RoleBindingList(in, out, s) +} + +func autoConvert_rbac_RoleBindingList_To_v1beta1_RoleBindingList(in *rbac.RoleBindingList, out *RoleBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]RoleBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_rbac_RoleBindingList_To_v1beta1_RoleBindingList(in *rbac.RoleBindingList, out *RoleBindingList, s conversion.Scope) error { + return autoConvert_rbac_RoleBindingList_To_v1beta1_RoleBindingList(in, out, s) +} + +func autoConvert_v1beta1_RoleList_To_rbac_RoleList(in *RoleList, out *rbac.RoleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]rbac.Role)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_v1beta1_RoleList_To_rbac_RoleList(in *RoleList, out *rbac.RoleList, s conversion.Scope) error { + return autoConvert_v1beta1_RoleList_To_rbac_RoleList(in, out, s) +} + +func autoConvert_rbac_RoleList_To_v1beta1_RoleList(in *rbac.RoleList, out *RoleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Role)(unsafe.Pointer(&in.Items)) + return nil +} + +func Convert_rbac_RoleList_To_v1beta1_RoleList(in *rbac.RoleList, out *RoleList, s conversion.Scope) error { + return autoConvert_rbac_RoleList_To_v1beta1_RoleList(in, out, s) +} + +func autoConvert_v1beta1_RoleRef_To_rbac_RoleRef(in *RoleRef, out *rbac.RoleRef, s conversion.Scope) error { + out.APIGroup = in.APIGroup + out.Kind = in.Kind + out.Name = in.Name + return nil +} + +func Convert_v1beta1_RoleRef_To_rbac_RoleRef(in *RoleRef, out *rbac.RoleRef, s conversion.Scope) error { + return autoConvert_v1beta1_RoleRef_To_rbac_RoleRef(in, out, s) +} + +func autoConvert_rbac_RoleRef_To_v1beta1_RoleRef(in *rbac.RoleRef, out *RoleRef, s conversion.Scope) error { + out.APIGroup = in.APIGroup + out.Kind = in.Kind + out.Name = in.Name + return nil +} + +func Convert_rbac_RoleRef_To_v1beta1_RoleRef(in *rbac.RoleRef, out *RoleRef, s conversion.Scope) error { + return autoConvert_rbac_RoleRef_To_v1beta1_RoleRef(in, out, s) +} + +func autoConvert_v1beta1_Subject_To_rbac_Subject(in *Subject, out *rbac.Subject, s conversion.Scope) error { + out.Kind = in.Kind + out.APIVersion = in.APIVersion + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +func Convert_v1beta1_Subject_To_rbac_Subject(in *Subject, out *rbac.Subject, s conversion.Scope) error { + return autoConvert_v1beta1_Subject_To_rbac_Subject(in, out, s) +} + +func autoConvert_rbac_Subject_To_v1beta1_Subject(in *rbac.Subject, out *Subject, s conversion.Scope) error { + out.Kind = in.Kind + out.APIVersion = in.APIVersion + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +func Convert_rbac_Subject_To_v1beta1_Subject(in *rbac.Subject, out *Subject, s conversion.Scope) error { + return autoConvert_rbac_Subject_To_v1beta1_Subject(in, out, s) +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..cdd9a23127 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,262 @@ +// +build !ignore_autogenerated + +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by deepcopy-gen. Do not edit it manually! + +package v1beta1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + reflect "reflect" +) + +func init() { + SchemeBuilder.Register(RegisterDeepCopies) +} + +// RegisterDeepCopies adds deep-copy functions to the given scheme. Public +// to allow building arbitrary schemes. +func RegisterDeepCopies(scheme *runtime.Scheme) error { + return scheme.AddGeneratedDeepCopyFuncs( + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ClusterRole, InType: reflect.TypeOf(&ClusterRole{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ClusterRoleBinding, InType: reflect.TypeOf(&ClusterRoleBinding{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ClusterRoleBindingList, InType: reflect.TypeOf(&ClusterRoleBindingList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ClusterRoleList, InType: reflect.TypeOf(&ClusterRoleList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_PolicyRule, InType: reflect.TypeOf(&PolicyRule{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_Role, InType: reflect.TypeOf(&Role{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_RoleBinding, InType: reflect.TypeOf(&RoleBinding{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_RoleBindingList, InType: reflect.TypeOf(&RoleBindingList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_RoleList, InType: reflect.TypeOf(&RoleList{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_RoleRef, InType: reflect.TypeOf(&RoleRef{})}, + conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_Subject, InType: reflect.TypeOf(&Subject{})}, + ) +} + +func DeepCopy_v1beta1_ClusterRole(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ClusterRole) + out := out.(*ClusterRole) + *out = *in + if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { + return err + } else { + out.ObjectMeta = *newVal.(*v1.ObjectMeta) + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]PolicyRule, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_PolicyRule(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_ClusterRoleBinding(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ClusterRoleBinding) + out := out.(*ClusterRoleBinding) + *out = *in + if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { + return err + } else { + out.ObjectMeta = *newVal.(*v1.ObjectMeta) + } + if in.Subjects != nil { + in, out := &in.Subjects, &out.Subjects + *out = make([]Subject, len(*in)) + for i := range *in { + (*out)[i] = (*in)[i] + } + } + return nil + } +} + +func DeepCopy_v1beta1_ClusterRoleBindingList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ClusterRoleBindingList) + out := out.(*ClusterRoleBindingList) + *out = *in + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterRoleBinding, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_ClusterRoleBinding(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_ClusterRoleList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*ClusterRoleList) + out := out.(*ClusterRoleList) + *out = *in + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterRole, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_ClusterRole(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_PolicyRule(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*PolicyRule) + out := out.(*PolicyRule) + *out = *in + if in.Verbs != nil { + in, out := &in.Verbs, &out.Verbs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.APIGroups != nil { + in, out := &in.APIGroups, &out.APIGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ResourceNames != nil { + in, out := &in.ResourceNames, &out.ResourceNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NonResourceURLs != nil { + in, out := &in.NonResourceURLs, &out.NonResourceURLs + *out = make([]string, len(*in)) + copy(*out, *in) + } + return nil + } +} + +func DeepCopy_v1beta1_Role(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*Role) + out := out.(*Role) + *out = *in + if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { + return err + } else { + out.ObjectMeta = *newVal.(*v1.ObjectMeta) + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]PolicyRule, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_PolicyRule(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_RoleBinding(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*RoleBinding) + out := out.(*RoleBinding) + *out = *in + if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil { + return err + } else { + out.ObjectMeta = *newVal.(*v1.ObjectMeta) + } + if in.Subjects != nil { + in, out := &in.Subjects, &out.Subjects + *out = make([]Subject, len(*in)) + for i := range *in { + (*out)[i] = (*in)[i] + } + } + return nil + } +} + +func DeepCopy_v1beta1_RoleBindingList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*RoleBindingList) + out := out.(*RoleBindingList) + *out = *in + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RoleBinding, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_RoleBinding(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_RoleList(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*RoleList) + out := out.(*RoleList) + *out = *in + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Role, len(*in)) + for i := range *in { + if err := DeepCopy_v1beta1_Role(&(*in)[i], &(*out)[i], c); err != nil { + return err + } + } + } + return nil + } +} + +func DeepCopy_v1beta1_RoleRef(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*RoleRef) + out := out.(*RoleRef) + *out = *in + return nil + } +} + +func DeepCopy_v1beta1_Subject(in interface{}, out interface{}, c *conversion.Cloner) error { + { + in := in.(*Subject) + out := out.(*Subject) + *out = *in + return nil + } +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go new file mode 100644 index 0000000000..2529a63324 --- /dev/null +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go @@ -0,0 +1,58 @@ +// +build !ignore_autogenerated + +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was autogenerated by defaulter-gen. Do not edit it manually! + +package v1beta1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&ClusterRoleBinding{}, func(obj interface{}) { SetObjectDefaults_ClusterRoleBinding(obj.(*ClusterRoleBinding)) }) + scheme.AddTypeDefaultingFunc(&ClusterRoleBindingList{}, func(obj interface{}) { SetObjectDefaults_ClusterRoleBindingList(obj.(*ClusterRoleBindingList)) }) + scheme.AddTypeDefaultingFunc(&RoleBinding{}, func(obj interface{}) { SetObjectDefaults_RoleBinding(obj.(*RoleBinding)) }) + scheme.AddTypeDefaultingFunc(&RoleBindingList{}, func(obj interface{}) { SetObjectDefaults_RoleBindingList(obj.(*RoleBindingList)) }) + return nil +} + +func SetObjectDefaults_ClusterRoleBinding(in *ClusterRoleBinding) { + SetDefaults_ClusterRoleBinding(in) +} + +func SetObjectDefaults_ClusterRoleBindingList(in *ClusterRoleBindingList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_ClusterRoleBinding(a) + } +} + +func SetObjectDefaults_RoleBinding(in *RoleBinding) { + SetDefaults_RoleBinding(in) +} + +func SetObjectDefaults_RoleBindingList(in *RoleBindingList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_RoleBinding(a) + } +} diff --git a/staging/src/k8s.io/client-go/pkg/apis/rbac/zz_generated.deepcopy.go b/staging/src/k8s.io/client-go/pkg/apis/rbac/zz_generated.deepcopy.go index a29802cc2a..fa70dfcb3f 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/rbac/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/client-go/pkg/apis/rbac/zz_generated.deepcopy.go @@ -139,14 +139,6 @@ func DeepCopy_rbac_PolicyRule(in interface{}, out interface{}, c *conversion.Clo *out = make([]string, len(*in)) copy(*out, *in) } - // in.AttributeRestrictions is kind 'Interface' - if in.AttributeRestrictions != nil { - if newVal, err := c.DeepCopy(&in.AttributeRestrictions); err != nil { - return err - } else { - out.AttributeRestrictions = *newVal.(*runtime.Object) - } - } if in.APIGroups != nil { in, out := &in.APIGroups, &out.APIGroups *out = make([]string, len(*in)) From cdb2934bbc64ba4c42200ebca1a3037fee563076 Mon Sep 17 00:00:00 2001 From: deads2k Date: Wed, 18 Jan 2017 09:57:11 -0500 Subject: [PATCH 2/4] remove kubernetes copy of clientcmd types --- cmd/kube-proxy/app/BUILD | 2 +- cmd/kube-proxy/app/server.go | 2 +- cmd/kubeadm/app/discovery/BUILD | 2 +- cmd/kubeadm/app/discovery/discovery.go | 2 +- cmd/kubeadm/app/master/BUILD | 2 +- cmd/kubeadm/app/master/apiclient.go | 2 +- cmd/kubeadm/app/node/BUILD | 2 +- cmd/kubeadm/app/node/bootstrap.go | 2 +- cmd/kubeadm/app/node/csr.go | 2 +- cmd/kubeadm/app/phases/kubeconfig/BUILD | 2 +- .../app/phases/kubeconfig/kubeconfig.go | 2 +- cmd/kubelet/app/BUILD | 1 - cmd/kubelet/app/bootstrap.go | 2 +- cmd/kubelet/app/server.go | 2 +- .../pkg/federation-controller/cluster/BUILD | 2 +- .../cluster/clustercontroller_test.go | 2 +- .../pkg/federation-controller/util/BUILD | 2 +- .../util/cluster_util.go | 2 +- federation/pkg/kubefed/BUILD | 4 +- federation/pkg/kubefed/init/BUILD | 2 +- federation/pkg/kubefed/init/init.go | 2 +- federation/pkg/kubefed/join.go | 2 +- federation/pkg/kubefed/join_test.go | 2 +- federation/pkg/kubefed/testing/BUILD | 2 +- federation/pkg/kubefed/testing/testing.go | 2 +- federation/pkg/kubefed/util/BUILD | 2 +- federation/pkg/kubefed/util/util.go | 2 +- pkg/client/restclient/BUILD | 4 +- pkg/client/restclient/config.go | 2 +- pkg/client/restclient/config_test.go | 2 +- pkg/client/restclient/plugin.go | 2 +- pkg/client/restclient/plugin_test.go | 2 +- pkg/client/unversioned/clientcmd/BUILD | 13 +- pkg/client/unversioned/clientcmd/api/BUILD | 51 --- .../unversioned/clientcmd/api/helpers.go | 183 ----------- .../unversioned/clientcmd/api/helpers_test.go | 301 ------------------ .../unversioned/clientcmd/api/latest/BUILD | 35 -- .../clientcmd/api/latest/latest.go | 66 ---- .../unversioned/clientcmd/api/register.go | 46 --- pkg/client/unversioned/clientcmd/api/types.go | 178 ----------- .../unversioned/clientcmd/api/types_test.go | 135 -------- pkg/client/unversioned/clientcmd/api/v1/BUILD | 37 --- .../clientcmd/api/v1/conversion.go | 227 ------------- .../unversioned/clientcmd/api/v1/register.go | 46 --- .../unversioned/clientcmd/api/v1/types.go | 170 ---------- .../unversioned/clientcmd/client_config.go | 2 +- .../clientcmd/client_config_test.go | 2 +- pkg/client/unversioned/clientcmd/config.go | 2 +- pkg/client/unversioned/clientcmd/loader.go | 4 +- .../unversioned/clientcmd/loader_test.go | 4 +- .../clientcmd/merged_client_builder.go | 2 +- .../clientcmd/merged_client_builder_test.go | 2 +- pkg/client/unversioned/clientcmd/overrides.go | 2 +- .../unversioned/clientcmd/validation.go | 2 +- .../unversioned/clientcmd/validation_test.go | 2 +- pkg/kubectl/cmd/config/BUILD | 6 +- pkg/kubectl/cmd/config/config_test.go | 2 +- pkg/kubectl/cmd/config/create_authinfo.go | 2 +- pkg/kubectl/cmd/config/create_cluster.go | 2 +- pkg/kubectl/cmd/config/create_context.go | 2 +- .../cmd/config/current_context_test.go | 2 +- pkg/kubectl/cmd/config/delete_cluster_test.go | 2 +- pkg/kubectl/cmd/config/delete_context_test.go | 2 +- pkg/kubectl/cmd/config/get_clusters_test.go | 2 +- pkg/kubectl/cmd/config/get_contexts.go | 2 +- pkg/kubectl/cmd/config/get_contexts_test.go | 2 +- .../cmd/config/navigation_step_parser.go | 2 +- .../cmd/config/navigation_step_parser_test.go | 2 +- pkg/kubectl/cmd/config/use_context.go | 2 +- pkg/kubectl/cmd/config/view.go | 4 +- pkg/kubectl/cmd/util/BUILD | 2 +- pkg/kubectl/cmd/util/factory_test.go | 2 +- plugin/pkg/admission/imagepolicy/BUILD | 2 +- .../admission/imagepolicy/admission_test.go | 2 +- .../auth/authenticator/token/webhook/BUILD | 2 +- .../token/webhook/webhook_test.go | 2 +- plugin/pkg/auth/authorizer/webhook/BUILD | 2 +- .../auth/authorizer/webhook/webhook_test.go | 2 +- staging/copy.sh | 13 +- test/e2e/framework/BUILD | 2 +- test/e2e/framework/util.go | 2 +- test/e2e_federation/BUILD | 2 +- test/e2e_federation/federation-authn.go | 2 +- test/e2e_federation/federation-util.go | 2 +- test/integration/auth/auth_test.go | 2 +- test/integration/kubectl/kubectl_test.go | 2 +- vendor/BUILD | 84 +++++ 87 files changed, 173 insertions(+), 1569 deletions(-) delete mode 100644 pkg/client/unversioned/clientcmd/api/BUILD delete mode 100644 pkg/client/unversioned/clientcmd/api/helpers.go delete mode 100644 pkg/client/unversioned/clientcmd/api/helpers_test.go delete mode 100644 pkg/client/unversioned/clientcmd/api/latest/BUILD delete mode 100644 pkg/client/unversioned/clientcmd/api/latest/latest.go delete mode 100644 pkg/client/unversioned/clientcmd/api/register.go delete mode 100644 pkg/client/unversioned/clientcmd/api/types.go delete mode 100644 pkg/client/unversioned/clientcmd/api/types_test.go delete mode 100644 pkg/client/unversioned/clientcmd/api/v1/BUILD delete mode 100644 pkg/client/unversioned/clientcmd/api/v1/conversion.go delete mode 100644 pkg/client/unversioned/clientcmd/api/v1/register.go delete mode 100644 pkg/client/unversioned/clientcmd/api/v1/types.go diff --git a/cmd/kube-proxy/app/BUILD b/cmd/kube-proxy/app/BUILD index cdba4d2d0d..36b6dc2c50 100644 --- a/cmd/kube-proxy/app/BUILD +++ b/cmd/kube-proxy/app/BUILD @@ -23,7 +23,6 @@ go_library( "//pkg/client/clientset_generated/internalclientset/typed/core/internalversion:go_default_library", "//pkg/client/record:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/proxy:go_default_library", "//pkg/proxy/config:go_default_library", "//pkg/proxy/iptables:go_default_library", @@ -46,6 +45,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 4cf5b29502..09593d846b 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -32,6 +32,7 @@ import ( "k8s.io/apimachinery/pkg/types" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/cmd/kube-proxy/app/options" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" @@ -39,7 +40,6 @@ import ( unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/proxy" proxyconfig "k8s.io/kubernetes/pkg/proxy/config" "k8s.io/kubernetes/pkg/proxy/iptables" diff --git a/cmd/kubeadm/app/discovery/BUILD b/cmd/kubeadm/app/discovery/BUILD index f6132dbb1c..c3e9d8c8f7 100644 --- a/cmd/kubeadm/app/discovery/BUILD +++ b/cmd/kubeadm/app/discovery/BUILD @@ -23,8 +23,8 @@ go_library( "//cmd/kubeadm/app/node:go_default_library", "//cmd/kubeadm/app/util:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//vendor:github.com/spf13/pflag", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/cmd/kubeadm/app/discovery/discovery.go b/cmd/kubeadm/app/discovery/discovery.go index 38ade98641..8a1d1d6cc8 100644 --- a/cmd/kubeadm/app/discovery/discovery.go +++ b/cmd/kubeadm/app/discovery/discovery.go @@ -21,11 +21,11 @@ import ( "io/ioutil" "net/http" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubenode "k8s.io/kubernetes/cmd/kubeadm/app/node" kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) // For identifies and executes the desired discovery mechanism. diff --git a/cmd/kubeadm/app/master/BUILD b/cmd/kubeadm/app/master/BUILD index 4a2fd026a4..e9fcef0884 100644 --- a/cmd/kubeadm/app/master/BUILD +++ b/cmd/kubeadm/app/master/BUILD @@ -30,7 +30,6 @@ go_library( "//pkg/apis/extensions/v1beta1:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubeapiserver/authorizer:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//pkg/registry/core/service/ipallocator:go_default_library", @@ -41,6 +40,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/cmd/kubeadm/app/master/apiclient.go b/cmd/kubeadm/app/master/apiclient.go index 4fc9993b92..4ccf155ec9 100644 --- a/cmd/kubeadm/app/master/apiclient.go +++ b/cmd/kubeadm/app/master/apiclient.go @@ -25,13 +25,13 @@ import ( apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/cmd/kubeadm/app/images" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" extensions "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) const apiCallRetryInterval = 500 * time.Millisecond diff --git a/cmd/kubeadm/app/node/BUILD b/cmd/kubeadm/app/node/BUILD index 1b9f832446..667aacbd85 100644 --- a/cmd/kubeadm/app/node/BUILD +++ b/cmd/kubeadm/app/node/BUILD @@ -23,7 +23,6 @@ go_library( "//pkg/apis/certificates:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubelet/util/csr:go_default_library", "//pkg/util/cert:go_default_library", "//vendor:github.com/square/go-jose", @@ -31,6 +30,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/cmd/kubeadm/app/node/bootstrap.go b/cmd/kubeadm/app/node/bootstrap.go index 6c48643994..b1fa25f58b 100644 --- a/cmd/kubeadm/app/node/bootstrap.go +++ b/cmd/kubeadm/app/node/bootstrap.go @@ -26,13 +26,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeconfigphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig" kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" "k8s.io/kubernetes/pkg/apis/certificates" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) // retryTimeout between the subsequent attempts to connect diff --git a/cmd/kubeadm/app/node/csr.go b/cmd/kubeadm/app/node/csr.go index aaee8643e7..70c203dbc1 100644 --- a/cmd/kubeadm/app/node/csr.go +++ b/cmd/kubeadm/app/node/csr.go @@ -21,9 +21,9 @@ import ( "os" "k8s.io/apimachinery/pkg/types" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubelet/util/csr" certutil "k8s.io/kubernetes/pkg/util/cert" ) diff --git a/cmd/kubeadm/app/phases/kubeconfig/BUILD b/cmd/kubeadm/app/phases/kubeconfig/BUILD index cb2fcdbc6a..b8df01aadb 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/BUILD +++ b/cmd/kubeadm/app/phases/kubeconfig/BUILD @@ -26,8 +26,8 @@ go_library( deps = [ "//cmd/kubeadm/app/phases/certs:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/util/cert:go_default_library", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go index 1a10ea1b40..1ea95a40b2 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go @@ -24,9 +24,9 @@ import ( "os" "path" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" certphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/certs" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" certutil "k8s.io/kubernetes/pkg/util/cert" ) diff --git a/cmd/kubelet/app/BUILD b/cmd/kubelet/app/BUILD index 38c9650670..340081c118 100644 --- a/cmd/kubelet/app/BUILD +++ b/cmd/kubelet/app/BUILD @@ -50,7 +50,6 @@ go_library( "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/auth:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers:go_default_library", "//pkg/credentialprovider:go_default_library", diff --git a/cmd/kubelet/app/bootstrap.go b/cmd/kubelet/app/bootstrap.go index 8915b5f727..d1c1f4a6bd 100644 --- a/cmd/kubelet/app/bootstrap.go +++ b/cmd/kubelet/app/bootstrap.go @@ -26,10 +26,10 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" unversionedcertificates "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/certificates/v1alpha1" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubelet/util/csr" certutil "k8s.io/kubernetes/pkg/util/cert" ) diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go index 843bf2b43c..ce5c52f421 100644 --- a/cmd/kubelet/app/server.go +++ b/cmd/kubelet/app/server.go @@ -44,6 +44,7 @@ import ( "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/cmd/kubelet/app/options" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" @@ -57,7 +58,6 @@ import ( "k8s.io/kubernetes/pkg/client/restclient" clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/credentialprovider" "k8s.io/kubernetes/pkg/kubelet" diff --git a/federation/pkg/federation-controller/cluster/BUILD b/federation/pkg/federation-controller/cluster/BUILD index c8e1980dc1..f294ff6f7b 100644 --- a/federation/pkg/federation-controller/cluster/BUILD +++ b/federation/pkg/federation-controller/cluster/BUILD @@ -51,9 +51,9 @@ go_test( "//pkg/api/v1:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/util/uuid:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/federation-controller/cluster/clustercontroller_test.go b/federation/pkg/federation-controller/cluster/clustercontroller_test.go index 483e78e4da..b827da5d2e 100644 --- a/federation/pkg/federation-controller/cluster/clustercontroller_test.go +++ b/federation/pkg/federation-controller/cluster/clustercontroller_test.go @@ -24,6 +24,7 @@ import ( "testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" federationv1beta1 "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" controllerutil "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -31,7 +32,6 @@ import ( "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/util/uuid" ) diff --git a/federation/pkg/federation-controller/util/BUILD b/federation/pkg/federation-controller/util/BUILD index ecddc9e8fd..45da0b55ba 100644 --- a/federation/pkg/federation-controller/util/BUILD +++ b/federation/pkg/federation-controller/util/BUILD @@ -35,7 +35,6 @@ go_library( "//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/controller/deployment/util:go_default_library", "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", @@ -44,6 +43,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/federation-controller/util/cluster_util.go b/federation/pkg/federation-controller/util/cluster_util.go index d500331aa2..5d8150a0df 100644 --- a/federation/pkg/federation-controller/util/cluster_util.go +++ b/federation/pkg/federation-controller/util/cluster_util.go @@ -26,13 +26,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" federation_v1beta1 "k8s.io/kubernetes/federation/apis/federation/v1beta1" fedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/pkg/api" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) const ( diff --git a/federation/pkg/kubefed/BUILD b/federation/pkg/kubefed/BUILD index 6258ab781f..2cb399e7fa 100644 --- a/federation/pkg/kubefed/BUILD +++ b/federation/pkg/kubefed/BUILD @@ -22,7 +22,6 @@ go_library( "//federation/pkg/kubefed/util:go_default_library", "//pkg/api:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl:go_default_library", "//pkg/kubectl/cmd:go_default_library", "//pkg/kubectl/cmd/templates:go_default_library", @@ -34,6 +33,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) @@ -56,12 +56,12 @@ go_test( "//pkg/client/restclient/fake:go_default_library", "//pkg/client/typed/dynamic:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl/cmd/testing:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/diff", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/kubefed/init/BUILD b/federation/pkg/kubefed/init/BUILD index 2de432e139..cf44e148ee 100644 --- a/federation/pkg/kubefed/init/BUILD +++ b/federation/pkg/kubefed/init/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/apis/extensions:go_default_library", "//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl/cmd/templates:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//pkg/util/cert:go_default_library", @@ -30,6 +29,7 @@ go_library( "//vendor:github.com/spf13/cobra", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/kubefed/init/init.go b/federation/pkg/kubefed/init/init.go index b37897081e..8e246ea653 100644 --- a/federation/pkg/kubefed/init/init.go +++ b/federation/pkg/kubefed/init/init.go @@ -38,6 +38,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" kubeadmkubeconfigphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig" "k8s.io/kubernetes/federation/pkg/kubefed/util" "k8s.io/kubernetes/pkg/api" @@ -45,7 +46,6 @@ import ( "k8s.io/kubernetes/pkg/apis/extensions" client "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" certutil "k8s.io/kubernetes/pkg/util/cert" diff --git a/federation/pkg/kubefed/join.go b/federation/pkg/kubefed/join.go index 2ae3281902..18ca6c5204 100644 --- a/federation/pkg/kubefed/join.go +++ b/federation/pkg/kubefed/join.go @@ -22,8 +22,8 @@ import ( "strings" "k8s.io/apimachinery/pkg/runtime" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/federation/pkg/kubefed/util" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl" kubectlcmd "k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" diff --git a/federation/pkg/kubefed/join_test.go b/federation/pkg/kubefed/join_test.go index d541ac6a2d..d5691f382a 100644 --- a/federation/pkg/kubefed/join_test.go +++ b/federation/pkg/kubefed/join_test.go @@ -25,6 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/diff" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" kubefedtesting "k8s.io/kubernetes/federation/pkg/kubefed/testing" "k8s.io/kubernetes/federation/pkg/kubefed/util" @@ -34,7 +35,6 @@ import ( "k8s.io/kubernetes/pkg/client/restclient/fake" "k8s.io/kubernetes/pkg/client/typed/dynamic" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) diff --git a/federation/pkg/kubefed/testing/BUILD b/federation/pkg/kubefed/testing/BUILD index 211c87bc53..e60a19adf7 100644 --- a/federation/pkg/kubefed/testing/BUILD +++ b/federation/pkg/kubefed/testing/BUILD @@ -17,9 +17,9 @@ go_library( "//pkg/api:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//vendor:k8s.io/apimachinery/pkg/runtime", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/kubefed/testing/testing.go b/federation/pkg/kubefed/testing/testing.go index 10f91de45f..2ffc9fdbfa 100644 --- a/federation/pkg/kubefed/testing/testing.go +++ b/federation/pkg/kubefed/testing/testing.go @@ -24,12 +24,12 @@ import ( "os" "k8s.io/apimachinery/pkg/runtime" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" fedclient "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/kubefed/util" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) diff --git a/federation/pkg/kubefed/util/BUILD b/federation/pkg/kubefed/util/BUILD index 4766ac74c8..7af319491d 100644 --- a/federation/pkg/kubefed/util/BUILD +++ b/federation/pkg/kubefed/util/BUILD @@ -16,11 +16,11 @@ go_library( "//pkg/api:go_default_library", "//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl/cmd:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//vendor:github.com/spf13/cobra", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/kubefed/util/util.go b/federation/pkg/kubefed/util/util.go index 342abe669c..433b5323e6 100644 --- a/federation/pkg/kubefed/util/util.go +++ b/federation/pkg/kubefed/util/util.go @@ -18,11 +18,11 @@ package util import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" fedclient "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/pkg/api" client "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" kubectlcmd "k8s.io/kubernetes/pkg/kubectl/cmd" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" diff --git a/pkg/client/restclient/BUILD b/pkg/client/restclient/BUILD index 3b173cec26..87150ee092 100644 --- a/pkg/client/restclient/BUILD +++ b/pkg/client/restclient/BUILD @@ -27,7 +27,6 @@ go_library( "//pkg/api/validation/path:go_default_library", "//pkg/client/metrics:go_default_library", "//pkg/client/restclient/watch:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/fields:go_default_library", "//pkg/util/cert:go_default_library", "//pkg/util/flowcontrol:go_default_library", @@ -43,6 +42,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/tools/clientcmd/api", "//vendor:k8s.io/client-go/transport", ], ) @@ -64,7 +64,6 @@ go_test( "//pkg/api/testapi:go_default_library", "//pkg/api/v1:go_default_library", "//pkg/client/restclient/watch:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/util/clock:go_default_library", "//pkg/util/flowcontrol:go_default_library", "//pkg/util/httpstream:go_default_library", @@ -80,6 +79,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/diff", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/pkg/client/restclient/config.go b/pkg/client/restclient/config.go index 2de79501dc..71591a4826 100644 --- a/pkg/client/restclient/config.go +++ b/pkg/client/restclient/config.go @@ -32,8 +32,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" certutil "k8s.io/kubernetes/pkg/util/cert" "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/version" diff --git a/pkg/client/restclient/config_test.go b/pkg/client/restclient/config_test.go index 474a4beaa2..d53c2783d5 100644 --- a/pkg/client/restclient/config_test.go +++ b/pkg/client/restclient/config_test.go @@ -28,9 +28,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/diff" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/util/flowcontrol" ) diff --git a/pkg/client/restclient/plugin.go b/pkg/client/restclient/plugin.go index 06ac3cce16..f4978810bc 100644 --- a/pkg/client/restclient/plugin.go +++ b/pkg/client/restclient/plugin.go @@ -23,7 +23,7 @@ import ( "github.com/golang/glog" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) type AuthProvider interface { diff --git a/pkg/client/restclient/plugin_test.go b/pkg/client/restclient/plugin_test.go index 42226fba5b..bb7c06d916 100644 --- a/pkg/client/restclient/plugin_test.go +++ b/pkg/client/restclient/plugin_test.go @@ -23,7 +23,7 @@ import ( "strconv" "testing" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) func TestAuthPluginWrapTransport(t *testing.T) { diff --git a/pkg/client/unversioned/clientcmd/BUILD b/pkg/client/unversioned/clientcmd/BUILD index 1db92efe72..324f62aedc 100644 --- a/pkg/client/unversioned/clientcmd/BUILD +++ b/pkg/client/unversioned/clientcmd/BUILD @@ -26,8 +26,6 @@ go_library( "//pkg/api:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/auth:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", - "//pkg/client/unversioned/clientcmd/api/latest:go_default_library", "//pkg/util/homedir:go_default_library", "//vendor:github.com/golang/glog", "//vendor:github.com/howeyc/gopass", @@ -37,6 +35,8 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/runtime/schema", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/validation", + "//vendor:k8s.io/client-go/tools/clientcmd/api", + "//vendor:k8s.io/client-go/tools/clientcmd/api/latest", ], ) @@ -52,12 +52,12 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/client/restclient:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", - "//pkg/client/unversioned/clientcmd/api/latest:go_default_library", "//vendor:github.com/ghodss/yaml", "//vendor:github.com/imdario/mergo", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/errors", + "//vendor:k8s.io/client-go/tools/clientcmd/api", + "//vendor:k8s.io/client-go/tools/clientcmd/api/latest", ], ) @@ -70,9 +70,6 @@ filegroup( filegroup( name = "all-srcs", - srcs = [ - ":package-srcs", - "//pkg/client/unversioned/clientcmd/api:all-srcs", - ], + srcs = [":package-srcs"], tags = ["automanaged"], ) diff --git a/pkg/client/unversioned/clientcmd/api/BUILD b/pkg/client/unversioned/clientcmd/api/BUILD deleted file mode 100644 index 742c234419..0000000000 --- a/pkg/client/unversioned/clientcmd/api/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "helpers.go", - "register.go", - "types.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - ], -) - -go_test( - name = "go_default_test", - srcs = [ - "helpers_test.go", - "types_test.go", - ], - library = ":go_default_library", - tags = ["automanaged"], - deps = ["//vendor:github.com/ghodss/yaml"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [ - ":package-srcs", - "//pkg/client/unversioned/clientcmd/api/latest:all-srcs", - "//pkg/client/unversioned/clientcmd/api/v1:all-srcs", - ], - tags = ["automanaged"], -) diff --git a/pkg/client/unversioned/clientcmd/api/helpers.go b/pkg/client/unversioned/clientcmd/api/helpers.go deleted file mode 100644 index 43e26487cb..0000000000 --- a/pkg/client/unversioned/clientcmd/api/helpers.go +++ /dev/null @@ -1,183 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package api - -import ( - "encoding/base64" - "errors" - "fmt" - "io/ioutil" - "os" - "path" - "path/filepath" -) - -func init() { - sDec, _ := base64.StdEncoding.DecodeString("REDACTED+") - redactedBytes = []byte(string(sDec)) -} - -// IsConfigEmpty returns true if the config is empty. -func IsConfigEmpty(config *Config) bool { - return len(config.AuthInfos) == 0 && len(config.Clusters) == 0 && len(config.Contexts) == 0 && - len(config.CurrentContext) == 0 && - len(config.Preferences.Extensions) == 0 && !config.Preferences.Colors && - len(config.Extensions) == 0 -} - -// MinifyConfig read the current context and uses that to keep only the relevant pieces of config -// This is useful for making secrets based on kubeconfig files -func MinifyConfig(config *Config) error { - if len(config.CurrentContext) == 0 { - return errors.New("current-context must exist in order to minify") - } - - currContext, exists := config.Contexts[config.CurrentContext] - if !exists { - return fmt.Errorf("cannot locate context %v", config.CurrentContext) - } - - newContexts := map[string]*Context{} - newContexts[config.CurrentContext] = currContext - - newClusters := map[string]*Cluster{} - if len(currContext.Cluster) > 0 { - if _, exists := config.Clusters[currContext.Cluster]; !exists { - return fmt.Errorf("cannot locate cluster %v", currContext.Cluster) - } - - newClusters[currContext.Cluster] = config.Clusters[currContext.Cluster] - } - - newAuthInfos := map[string]*AuthInfo{} - if len(currContext.AuthInfo) > 0 { - if _, exists := config.AuthInfos[currContext.AuthInfo]; !exists { - return fmt.Errorf("cannot locate user %v", currContext.AuthInfo) - } - - newAuthInfos[currContext.AuthInfo] = config.AuthInfos[currContext.AuthInfo] - } - - config.AuthInfos = newAuthInfos - config.Clusters = newClusters - config.Contexts = newContexts - - return nil -} - -var redactedBytes []byte - -// Flatten redacts raw data entries from the config object for a human-readable view. -func ShortenConfig(config *Config) { - // trick json encoder into printing a human readable string in the raw data - // by base64 decoding what we want to print. Relies on implementation of - // http://golang.org/pkg/encoding/json/#Marshal using base64 to encode []byte - for key, authInfo := range config.AuthInfos { - if len(authInfo.ClientKeyData) > 0 { - authInfo.ClientKeyData = redactedBytes - } - if len(authInfo.ClientCertificateData) > 0 { - authInfo.ClientCertificateData = redactedBytes - } - config.AuthInfos[key] = authInfo - } - for key, cluster := range config.Clusters { - if len(cluster.CertificateAuthorityData) > 0 { - cluster.CertificateAuthorityData = redactedBytes - } - config.Clusters[key] = cluster - } -} - -// Flatten changes the config object into a self contained config (useful for making secrets) -func FlattenConfig(config *Config) error { - for key, authInfo := range config.AuthInfos { - baseDir, err := MakeAbs(path.Dir(authInfo.LocationOfOrigin), "") - if err != nil { - return err - } - - if err := FlattenContent(&authInfo.ClientCertificate, &authInfo.ClientCertificateData, baseDir); err != nil { - return err - } - if err := FlattenContent(&authInfo.ClientKey, &authInfo.ClientKeyData, baseDir); err != nil { - return err - } - - config.AuthInfos[key] = authInfo - } - for key, cluster := range config.Clusters { - baseDir, err := MakeAbs(path.Dir(cluster.LocationOfOrigin), "") - if err != nil { - return err - } - - if err := FlattenContent(&cluster.CertificateAuthority, &cluster.CertificateAuthorityData, baseDir); err != nil { - return err - } - - config.Clusters[key] = cluster - } - - return nil -} - -func FlattenContent(path *string, contents *[]byte, baseDir string) error { - if len(*path) != 0 { - if len(*contents) > 0 { - return errors.New("cannot have values for both path and contents") - } - - var err error - absPath := ResolvePath(*path, baseDir) - *contents, err = ioutil.ReadFile(absPath) - if err != nil { - return err - } - - *path = "" - } - - return nil -} - -// ResolvePath returns the path as an absolute paths, relative to the given base directory -func ResolvePath(path string, base string) string { - // Don't resolve empty paths - if len(path) > 0 { - // Don't resolve absolute paths - if !filepath.IsAbs(path) { - return filepath.Join(base, path) - } - } - - return path -} - -func MakeAbs(path, base string) (string, error) { - if filepath.IsAbs(path) { - return path, nil - } - if len(base) == 0 { - cwd, err := os.Getwd() - if err != nil { - return "", err - } - base = cwd - } - return filepath.Join(base, path), nil -} diff --git a/pkg/client/unversioned/clientcmd/api/helpers_test.go b/pkg/client/unversioned/clientcmd/api/helpers_test.go deleted file mode 100644 index 430208456d..0000000000 --- a/pkg/client/unversioned/clientcmd/api/helpers_test.go +++ /dev/null @@ -1,301 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package api - -import ( - "fmt" - "io/ioutil" - "os" - "reflect" - "testing" - - "github.com/ghodss/yaml" -) - -func newMergedConfig(certFile, certContent, keyFile, keyContent, caFile, caContent string, t *testing.T) Config { - if err := ioutil.WriteFile(certFile, []byte(certContent), 0644); err != nil { - t.Errorf("unexpected error: %v", err) - } - if err := ioutil.WriteFile(keyFile, []byte(keyContent), 0600); err != nil { - t.Errorf("unexpected error: %v", err) - } - if err := ioutil.WriteFile(caFile, []byte(caContent), 0644); err != nil { - t.Errorf("unexpected error: %v", err) - } - - return Config{ - AuthInfos: map[string]*AuthInfo{ - "red-user": {Token: "red-token", ClientCertificateData: []byte(certContent), ClientKeyData: []byte(keyContent)}, - "blue-user": {Token: "blue-token", ClientCertificate: certFile, ClientKey: keyFile}}, - Clusters: map[string]*Cluster{ - "cow-cluster": {Server: "http://cow.org:8080", CertificateAuthorityData: []byte(caContent)}, - "chicken-cluster": {Server: "http://chicken.org:8080", CertificateAuthority: caFile}}, - Contexts: map[string]*Context{ - "federal-context": {AuthInfo: "red-user", Cluster: "cow-cluster"}, - "shaker-context": {AuthInfo: "blue-user", Cluster: "chicken-cluster"}}, - CurrentContext: "federal-context", - } -} - -func TestMinifySuccess(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t) - - if err := MinifyConfig(&mutatingConfig); err != nil { - t.Errorf("unexpected error: %v", err) - } - - if len(mutatingConfig.Contexts) > 1 { - t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts) - } - if _, exists := mutatingConfig.Contexts["federal-context"]; !exists { - t.Errorf("missing context") - } - - if len(mutatingConfig.Clusters) > 1 { - t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters) - } - if _, exists := mutatingConfig.Clusters["cow-cluster"]; !exists { - t.Errorf("missing cluster") - } - - if len(mutatingConfig.AuthInfos) > 1 { - t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos) - } - if _, exists := mutatingConfig.AuthInfos["red-user"]; !exists { - t.Errorf("missing user") - } -} - -func TestMinifyMissingContext(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t) - mutatingConfig.CurrentContext = "missing" - - errMsg := "cannot locate context missing" - - if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg { - t.Errorf("expected %v, got %v", errMsg, err) - } -} - -func TestMinifyMissingCluster(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t) - delete(mutatingConfig.Clusters, mutatingConfig.Contexts[mutatingConfig.CurrentContext].Cluster) - - errMsg := "cannot locate cluster cow-cluster" - - if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg { - t.Errorf("expected %v, got %v", errMsg, err) - } -} - -func TestMinifyMissingAuthInfo(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - mutatingConfig := newMergedConfig(certFile.Name(), "cert", keyFile.Name(), "key", caFile.Name(), "ca", t) - delete(mutatingConfig.AuthInfos, mutatingConfig.Contexts[mutatingConfig.CurrentContext].AuthInfo) - - errMsg := "cannot locate user red-user" - - if err := MinifyConfig(&mutatingConfig); err == nil || err.Error() != errMsg { - t.Errorf("expected %v, got %v", errMsg, err) - } -} - -func TestFlattenSuccess(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - certData := "cert" - keyData := "key" - caData := "ca" - - unchangingCluster := "cow-cluster" - unchangingAuthInfo := "red-user" - changingCluster := "chicken-cluster" - changingAuthInfo := "blue-user" - - startingConfig := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, t) - mutatingConfig := startingConfig - - if err := FlattenConfig(&mutatingConfig); err != nil { - t.Errorf("unexpected error: %v", err) - } - - if len(mutatingConfig.Contexts) != 2 { - t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts) - } - if !reflect.DeepEqual(startingConfig.Contexts, mutatingConfig.Contexts) { - t.Errorf("expected %v, got %v", startingConfig.Contexts, mutatingConfig.Contexts) - } - - if len(mutatingConfig.Clusters) != 2 { - t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters) - } - if !reflect.DeepEqual(startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) { - t.Errorf("expected %v, got %v", startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) - } - if len(mutatingConfig.Clusters[changingCluster].CertificateAuthority) != 0 { - t.Errorf("unexpected caFile") - } - if string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData) != caData { - t.Errorf("expected %v, got %v", caData, string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData)) - } - - if len(mutatingConfig.AuthInfos) != 2 { - t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos) - } - if !reflect.DeepEqual(startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) { - t.Errorf("expected %v, got %v", startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) - } - if len(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificate) != 0 { - t.Errorf("unexpected caFile") - } - if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData) != certData { - t.Errorf("expected %v, got %v", certData, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData)) - } - if len(mutatingConfig.AuthInfos[changingAuthInfo].ClientKey) != 0 { - t.Errorf("unexpected caFile") - } - if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData) != keyData { - t.Errorf("expected %v, got %v", keyData, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData)) - } - -} - -func Example_minifyAndShorten() { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - certData := "cert" - keyData := "key" - caData := "ca" - - config := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, nil) - - MinifyConfig(&config) - ShortenConfig(&config) - - output, _ := yaml.Marshal(config) - fmt.Printf("%s", string(output)) - // Output: - // clusters: - // cow-cluster: - // LocationOfOrigin: "" - // certificate-authority-data: REDACTED - // server: http://cow.org:8080 - // contexts: - // federal-context: - // LocationOfOrigin: "" - // cluster: cow-cluster - // user: red-user - // current-context: federal-context - // preferences: {} - // users: - // red-user: - // LocationOfOrigin: "" - // client-certificate-data: REDACTED - // client-key-data: REDACTED - // token: red-token -} - -func TestShortenSuccess(t *testing.T) { - certFile, _ := ioutil.TempFile("", "") - defer os.Remove(certFile.Name()) - keyFile, _ := ioutil.TempFile("", "") - defer os.Remove(keyFile.Name()) - caFile, _ := ioutil.TempFile("", "") - defer os.Remove(caFile.Name()) - - certData := "cert" - keyData := "key" - caData := "ca" - - unchangingCluster := "chicken-cluster" - unchangingAuthInfo := "blue-user" - changingCluster := "cow-cluster" - changingAuthInfo := "red-user" - - startingConfig := newMergedConfig(certFile.Name(), certData, keyFile.Name(), keyData, caFile.Name(), caData, t) - mutatingConfig := startingConfig - - ShortenConfig(&mutatingConfig) - - if len(mutatingConfig.Contexts) != 2 { - t.Errorf("unexpected contexts: %v", mutatingConfig.Contexts) - } - if !reflect.DeepEqual(startingConfig.Contexts, mutatingConfig.Contexts) { - t.Errorf("expected %v, got %v", startingConfig.Contexts, mutatingConfig.Contexts) - } - - redacted := string(redactedBytes) - if len(mutatingConfig.Clusters) != 2 { - t.Errorf("unexpected clusters: %v", mutatingConfig.Clusters) - } - if !reflect.DeepEqual(startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) { - t.Errorf("expected %v, got %v", startingConfig.Clusters[unchangingCluster], mutatingConfig.Clusters[unchangingCluster]) - } - if string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData) != redacted { - t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.Clusters[changingCluster].CertificateAuthorityData)) - } - - if len(mutatingConfig.AuthInfos) != 2 { - t.Errorf("unexpected users: %v", mutatingConfig.AuthInfos) - } - if !reflect.DeepEqual(startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) { - t.Errorf("expected %v, got %v", startingConfig.AuthInfos[unchangingAuthInfo], mutatingConfig.AuthInfos[unchangingAuthInfo]) - } - if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData) != redacted { - t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientCertificateData)) - } - if string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData) != redacted { - t.Errorf("expected %v, got %v", redacted, string(mutatingConfig.AuthInfos[changingAuthInfo].ClientKeyData)) - } -} diff --git a/pkg/client/unversioned/clientcmd/api/latest/BUILD b/pkg/client/unversioned/clientcmd/api/latest/BUILD deleted file mode 100644 index 582d4bf355..0000000000 --- a/pkg/client/unversioned/clientcmd/api/latest/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = ["latest.go"], - tags = ["automanaged"], - deps = [ - "//pkg/client/unversioned/clientcmd/api:go_default_library", - "//pkg/client/unversioned/clientcmd/api/v1:go_default_library", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/json", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/versioning", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/client/unversioned/clientcmd/api/latest/latest.go b/pkg/client/unversioned/clientcmd/api/latest/latest.go deleted file mode 100644 index 0f899d51d3..0000000000 --- a/pkg/client/unversioned/clientcmd/api/latest/latest.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package latest - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/runtime/serializer/json" - "k8s.io/apimachinery/pkg/runtime/serializer/versioning" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" -) - -// Version is the string that represents the current external default version. -const Version = "v1" - -var ExternalVersion = schema.GroupVersion{Group: "", Version: "v1"} - -// OldestVersion is the string that represents the oldest server version supported, -// for client code that wants to hardcode the lowest common denominator. -const OldestVersion = "v1" - -// Versions is the list of versions that are recognized in code. The order provided -// may be assumed to be least feature rich to most feature rich, and clients may -// choose to prefer the latter items in the list over the former items when presented -// with a set of versions to choose. -var Versions = []string{"v1"} - -var ( - Codec runtime.Codec - Scheme *runtime.Scheme -) - -func init() { - Scheme = runtime.NewScheme() - if err := api.AddToScheme(Scheme); err != nil { - // Programmer error, detect immediately - panic(err) - } - if err := v1.AddToScheme(Scheme); err != nil { - // Programmer error, detect immediately - panic(err) - } - yamlSerializer := json.NewYAMLSerializer(json.DefaultMetaFactory, Scheme, Scheme) - Codec = versioning.NewDefaultingCodecForScheme( - Scheme, - yamlSerializer, - yamlSerializer, - schema.GroupVersion{Version: Version}, - runtime.InternalGroupVersioner, - ) -} diff --git a/pkg/client/unversioned/clientcmd/api/register.go b/pkg/client/unversioned/clientcmd/api/register.go deleted file mode 100644 index 2eec3881cd..0000000000 --- a/pkg/client/unversioned/clientcmd/api/register.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package api - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// SchemeGroupVersion is group version used to register these objects -// TODO this should be in the "kubeconfig" group -var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: runtime.APIVersionInternal} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Config{}, - ) - return nil -} - -func (obj *Config) GetObjectKind() schema.ObjectKind { return obj } -func (obj *Config) SetGroupVersionKind(gvk schema.GroupVersionKind) { - obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() -} -func (obj *Config) GroupVersionKind() schema.GroupVersionKind { - return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) -} diff --git a/pkg/client/unversioned/clientcmd/api/types.go b/pkg/client/unversioned/clientcmd/api/types.go deleted file mode 100644 index fa9d40a9bb..0000000000 --- a/pkg/client/unversioned/clientcmd/api/types.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package api - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -// Where possible, json tags match the cli argument names. -// Top level config objects and all values required for proper functioning are not "omitempty". Any truly optional piece of config is allowed to be omitted. - -// Config holds the information needed to build connect to remote kubernetes clusters as a given user -// IMPORTANT if you add fields to this struct, please update IsConfigEmpty() -type Config struct { - // Legacy field from pkg/api/types.go TypeMeta. - // TODO(jlowdermilk): remove this after eliminating downstream dependencies. - // +optional - Kind string `json:"kind,omitempty"` - // DEPRECATED: APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc). - // Because a cluster can run multiple API groups and potentially multiple versions of each, it no longer makes sense to specify - // a single value for the cluster version. - // This field isn't really needed anyway, so we are deprecating it without replacement. - // It will be ignored if it is present. - // +optional - APIVersion string `json:"apiVersion,omitempty"` - // Preferences holds general information to be use for cli interactions - Preferences Preferences `json:"preferences"` - // Clusters is a map of referencable names to cluster configs - Clusters map[string]*Cluster `json:"clusters"` - // AuthInfos is a map of referencable names to user configs - AuthInfos map[string]*AuthInfo `json:"users"` - // Contexts is a map of referencable names to context configs - Contexts map[string]*Context `json:"contexts"` - // CurrentContext is the name of the context that you would like to use by default - CurrentContext string `json:"current-context"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions map[string]runtime.Object `json:"extensions,omitempty"` -} - -// IMPORTANT if you add fields to this struct, please update IsConfigEmpty() -type Preferences struct { - // +optional - Colors bool `json:"colors,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions map[string]runtime.Object `json:"extensions,omitempty"` -} - -// Cluster contains information about how to communicate with a kubernetes cluster -type Cluster struct { - // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. - LocationOfOrigin string - // Server is the address of the kubernetes cluster (https://hostname:port). - Server string `json:"server"` - // APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc). - // +optional - APIVersion string `json:"api-version,omitempty"` - // InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure. - // +optional - InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"` - // CertificateAuthority is the path to a cert file for the certificate authority. - // +optional - CertificateAuthority string `json:"certificate-authority,omitempty"` - // CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority - // +optional - CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions map[string]runtime.Object `json:"extensions,omitempty"` -} - -// AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are. -type AuthInfo struct { - // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. - LocationOfOrigin string - // ClientCertificate is the path to a client cert file for TLS. - // +optional - ClientCertificate string `json:"client-certificate,omitempty"` - // ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate - // +optional - ClientCertificateData []byte `json:"client-certificate-data,omitempty"` - // ClientKey is the path to a client key file for TLS. - // +optional - ClientKey string `json:"client-key,omitempty"` - // ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey - // +optional - ClientKeyData []byte `json:"client-key-data,omitempty"` - // Token is the bearer token for authentication to the kubernetes cluster. - // +optional - Token string `json:"token,omitempty"` - // TokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence. - // +optional - TokenFile string `json:"tokenFile,omitempty"` - // Impersonate is the username to act-as. - // +optional - Impersonate string `json:"act-as,omitempty"` - // Username is the username for basic authentication to the kubernetes cluster. - // +optional - Username string `json:"username,omitempty"` - // Password is the password for basic authentication to the kubernetes cluster. - // +optional - Password string `json:"password,omitempty"` - // AuthProvider specifies a custom authentication plugin for the kubernetes cluster. - // +optional - AuthProvider *AuthProviderConfig `json:"auth-provider,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions map[string]runtime.Object `json:"extensions,omitempty"` -} - -// Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with) -type Context struct { - // LocationOfOrigin indicates where this object came from. It is used for round tripping config post-merge, but never serialized. - LocationOfOrigin string - // Cluster is the name of the cluster for this context - Cluster string `json:"cluster"` - // AuthInfo is the name of the authInfo for this context - AuthInfo string `json:"user"` - // Namespace is the default namespace to use on unspecified requests - // +optional - Namespace string `json:"namespace,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions map[string]runtime.Object `json:"extensions,omitempty"` -} - -// AuthProviderConfig holds the configuration for a specified auth provider. -type AuthProviderConfig struct { - Name string `json:"name"` - // +optional - Config map[string]string `json:"config,omitempty"` -} - -// NewConfig is a convenience function that returns a new Config object with non-nil maps -func NewConfig() *Config { - return &Config{ - Preferences: *NewPreferences(), - Clusters: make(map[string]*Cluster), - AuthInfos: make(map[string]*AuthInfo), - Contexts: make(map[string]*Context), - Extensions: make(map[string]runtime.Object), - } -} - -// NewConfig is a convenience function that returns a new Config object with non-nil maps -func NewContext() *Context { - return &Context{Extensions: make(map[string]runtime.Object)} -} - -// NewConfig is a convenience function that returns a new Config object with non-nil maps -func NewCluster() *Cluster { - return &Cluster{Extensions: make(map[string]runtime.Object)} -} - -// NewConfig is a convenience function that returns a new Config object with non-nil maps -func NewAuthInfo() *AuthInfo { - return &AuthInfo{Extensions: make(map[string]runtime.Object)} -} - -// NewConfig is a convenience function that returns a new Config object with non-nil maps -func NewPreferences() *Preferences { - return &Preferences{Extensions: make(map[string]runtime.Object)} -} diff --git a/pkg/client/unversioned/clientcmd/api/types_test.go b/pkg/client/unversioned/clientcmd/api/types_test.go deleted file mode 100644 index bd34834521..0000000000 --- a/pkg/client/unversioned/clientcmd/api/types_test.go +++ /dev/null @@ -1,135 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package api - -import ( - "fmt" - - "github.com/ghodss/yaml" -) - -func Example_emptyConfig() { - defaultConfig := NewConfig() - - output, err := yaml.Marshal(defaultConfig) - if err != nil { - fmt.Printf("Unexpected error: %v", err) - } - - fmt.Printf("%v", string(output)) - // Output: - // clusters: {} - // contexts: {} - // current-context: "" - // preferences: {} - // users: {} -} - -func Example_ofOptionsConfig() { - defaultConfig := NewConfig() - defaultConfig.Preferences.Colors = true - defaultConfig.Clusters["alfa"] = &Cluster{ - Server: "https://alfa.org:8080", - InsecureSkipTLSVerify: true, - CertificateAuthority: "path/to/my/cert-ca-filename", - } - defaultConfig.Clusters["bravo"] = &Cluster{ - Server: "https://bravo.org:8080", - InsecureSkipTLSVerify: false, - } - defaultConfig.AuthInfos["white-mage-via-cert"] = &AuthInfo{ - ClientCertificate: "path/to/my/client-cert-filename", - ClientKey: "path/to/my/client-key-filename", - } - defaultConfig.AuthInfos["red-mage-via-token"] = &AuthInfo{ - Token: "my-secret-token", - } - defaultConfig.AuthInfos["black-mage-via-auth-provider"] = &AuthInfo{ - AuthProvider: &AuthProviderConfig{ - Name: "gcp", - Config: map[string]string{ - "foo": "bar", - "token": "s3cr3t-t0k3n", - }, - }, - } - defaultConfig.Contexts["bravo-as-black-mage"] = &Context{ - Cluster: "bravo", - AuthInfo: "black-mage-via-auth-provider", - Namespace: "yankee", - } - defaultConfig.Contexts["alfa-as-black-mage"] = &Context{ - Cluster: "alfa", - AuthInfo: "black-mage-via-auth-provider", - Namespace: "zulu", - } - defaultConfig.Contexts["alfa-as-white-mage"] = &Context{ - Cluster: "alfa", - AuthInfo: "white-mage-via-cert", - } - defaultConfig.CurrentContext = "alfa-as-white-mage" - - output, err := yaml.Marshal(defaultConfig) - if err != nil { - fmt.Printf("Unexpected error: %v", err) - } - - fmt.Printf("%v", string(output)) - // Output: - // clusters: - // alfa: - // LocationOfOrigin: "" - // certificate-authority: path/to/my/cert-ca-filename - // insecure-skip-tls-verify: true - // server: https://alfa.org:8080 - // bravo: - // LocationOfOrigin: "" - // server: https://bravo.org:8080 - // contexts: - // alfa-as-black-mage: - // LocationOfOrigin: "" - // cluster: alfa - // namespace: zulu - // user: black-mage-via-auth-provider - // alfa-as-white-mage: - // LocationOfOrigin: "" - // cluster: alfa - // user: white-mage-via-cert - // bravo-as-black-mage: - // LocationOfOrigin: "" - // cluster: bravo - // namespace: yankee - // user: black-mage-via-auth-provider - // current-context: alfa-as-white-mage - // preferences: - // colors: true - // users: - // black-mage-via-auth-provider: - // LocationOfOrigin: "" - // auth-provider: - // config: - // foo: bar - // token: s3cr3t-t0k3n - // name: gcp - // red-mage-via-token: - // LocationOfOrigin: "" - // token: my-secret-token - // white-mage-via-cert: - // LocationOfOrigin: "" - // client-certificate: path/to/my/client-cert-filename - // client-key: path/to/my/client-key-filename -} diff --git a/pkg/client/unversioned/clientcmd/api/v1/BUILD b/pkg/client/unversioned/clientcmd/api/v1/BUILD deleted file mode 100644 index dbae4de1b7..0000000000 --- a/pkg/client/unversioned/clientcmd/api/v1/BUILD +++ /dev/null @@ -1,37 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "conversion.go", - "register.go", - "types.go", - ], - tags = ["automanaged"], - deps = [ - "//pkg/client/unversioned/clientcmd/api:go_default_library", - "//vendor:k8s.io/apimachinery/pkg/conversion", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/client/unversioned/clientcmd/api/v1/conversion.go b/pkg/client/unversioned/clientcmd/api/v1/conversion.go deleted file mode 100644 index 602c07988d..0000000000 --- a/pkg/client/unversioned/clientcmd/api/v1/conversion.go +++ /dev/null @@ -1,227 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "sort" - - "k8s.io/apimachinery/pkg/conversion" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" -) - -func addConversionFuncs(scheme *runtime.Scheme) error { - return scheme.AddConversionFuncs( - func(in *Cluster, out *api.Cluster, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *api.Cluster, out *Cluster, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *Preferences, out *api.Preferences, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *api.Preferences, out *Preferences, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *AuthInfo, out *api.AuthInfo, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *api.AuthInfo, out *AuthInfo, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *Context, out *api.Context, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - func(in *api.Context, out *Context, s conversion.Scope) error { - return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) - }, - - func(in *Config, out *api.Config, s conversion.Scope) error { - out.CurrentContext = in.CurrentContext - if err := s.Convert(&in.Preferences, &out.Preferences, 0); err != nil { - return err - } - - out.Clusters = make(map[string]*api.Cluster) - if err := s.Convert(&in.Clusters, &out.Clusters, 0); err != nil { - return err - } - out.AuthInfos = make(map[string]*api.AuthInfo) - if err := s.Convert(&in.AuthInfos, &out.AuthInfos, 0); err != nil { - return err - } - out.Contexts = make(map[string]*api.Context) - if err := s.Convert(&in.Contexts, &out.Contexts, 0); err != nil { - return err - } - out.Extensions = make(map[string]runtime.Object) - if err := s.Convert(&in.Extensions, &out.Extensions, 0); err != nil { - return err - } - return nil - }, - func(in *api.Config, out *Config, s conversion.Scope) error { - out.CurrentContext = in.CurrentContext - if err := s.Convert(&in.Preferences, &out.Preferences, 0); err != nil { - return err - } - - out.Clusters = make([]NamedCluster, 0, 0) - if err := s.Convert(&in.Clusters, &out.Clusters, 0); err != nil { - return err - } - out.AuthInfos = make([]NamedAuthInfo, 0, 0) - if err := s.Convert(&in.AuthInfos, &out.AuthInfos, 0); err != nil { - return err - } - out.Contexts = make([]NamedContext, 0, 0) - if err := s.Convert(&in.Contexts, &out.Contexts, 0); err != nil { - return err - } - out.Extensions = make([]NamedExtension, 0, 0) - if err := s.Convert(&in.Extensions, &out.Extensions, 0); err != nil { - return err - } - return nil - }, - func(in *[]NamedCluster, out *map[string]*api.Cluster, s conversion.Scope) error { - for _, curr := range *in { - newCluster := api.NewCluster() - if err := s.Convert(&curr.Cluster, newCluster, 0); err != nil { - return err - } - (*out)[curr.Name] = newCluster - } - - return nil - }, - func(in *map[string]*api.Cluster, out *[]NamedCluster, s conversion.Scope) error { - allKeys := make([]string, 0, len(*in)) - for key := range *in { - allKeys = append(allKeys, key) - } - sort.Strings(allKeys) - - for _, key := range allKeys { - newCluster := (*in)[key] - oldCluster := &Cluster{} - if err := s.Convert(newCluster, oldCluster, 0); err != nil { - return err - } - - namedCluster := NamedCluster{key, *oldCluster} - *out = append(*out, namedCluster) - } - - return nil - }, - func(in *[]NamedAuthInfo, out *map[string]*api.AuthInfo, s conversion.Scope) error { - for _, curr := range *in { - newAuthInfo := api.NewAuthInfo() - if err := s.Convert(&curr.AuthInfo, newAuthInfo, 0); err != nil { - return err - } - (*out)[curr.Name] = newAuthInfo - } - - return nil - }, - func(in *map[string]*api.AuthInfo, out *[]NamedAuthInfo, s conversion.Scope) error { - allKeys := make([]string, 0, len(*in)) - for key := range *in { - allKeys = append(allKeys, key) - } - sort.Strings(allKeys) - - for _, key := range allKeys { - newAuthInfo := (*in)[key] - oldAuthInfo := &AuthInfo{} - if err := s.Convert(newAuthInfo, oldAuthInfo, 0); err != nil { - return err - } - - namedAuthInfo := NamedAuthInfo{key, *oldAuthInfo} - *out = append(*out, namedAuthInfo) - } - - return nil - }, - func(in *[]NamedContext, out *map[string]*api.Context, s conversion.Scope) error { - for _, curr := range *in { - newContext := api.NewContext() - if err := s.Convert(&curr.Context, newContext, 0); err != nil { - return err - } - (*out)[curr.Name] = newContext - } - - return nil - }, - func(in *map[string]*api.Context, out *[]NamedContext, s conversion.Scope) error { - allKeys := make([]string, 0, len(*in)) - for key := range *in { - allKeys = append(allKeys, key) - } - sort.Strings(allKeys) - - for _, key := range allKeys { - newContext := (*in)[key] - oldContext := &Context{} - if err := s.Convert(newContext, oldContext, 0); err != nil { - return err - } - - namedContext := NamedContext{key, *oldContext} - *out = append(*out, namedContext) - } - - return nil - }, - func(in *[]NamedExtension, out *map[string]runtime.Object, s conversion.Scope) error { - for _, curr := range *in { - var newExtension runtime.Object - if err := s.Convert(&curr.Extension, &newExtension, 0); err != nil { - return err - } - (*out)[curr.Name] = newExtension - } - - return nil - }, - func(in *map[string]runtime.Object, out *[]NamedExtension, s conversion.Scope) error { - allKeys := make([]string, 0, len(*in)) - for key := range *in { - allKeys = append(allKeys, key) - } - sort.Strings(allKeys) - - for _, key := range allKeys { - newExtension := (*in)[key] - oldExtension := &runtime.RawExtension{} - if err := s.Convert(newExtension, oldExtension, 0); err != nil { - return err - } - - namedExtension := NamedExtension{key, *oldExtension} - *out = append(*out, namedExtension) - } - - return nil - }, - ) -} diff --git a/pkg/client/unversioned/clientcmd/api/v1/register.go b/pkg/client/unversioned/clientcmd/api/v1/register.go deleted file mode 100644 index bc87706db3..0000000000 --- a/pkg/client/unversioned/clientcmd/api/v1/register.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// SchemeGroupVersion is group version used to register these objects -// TODO this should be in the "kubeconfig" group -var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: "v1"} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addConversionFuncs) - AddToScheme = SchemeBuilder.AddToScheme -) - -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Config{}, - ) - return nil -} - -func (obj *Config) GetObjectKind() schema.ObjectKind { return obj } -func (obj *Config) SetGroupVersionKind(gvk schema.GroupVersionKind) { - obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() -} -func (obj *Config) GroupVersionKind() schema.GroupVersionKind { - return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) -} diff --git a/pkg/client/unversioned/clientcmd/api/v1/types.go b/pkg/client/unversioned/clientcmd/api/v1/types.go deleted file mode 100644 index a0777ba53e..0000000000 --- a/pkg/client/unversioned/clientcmd/api/v1/types.go +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1 - -import ( - "k8s.io/apimachinery/pkg/runtime" -) - -// Where possible, json tags match the cli argument names. -// Top level config objects and all values required for proper functioning are not "omitempty". Any truly optional piece of config is allowed to be omitted. - -// Config holds the information needed to build connect to remote kubernetes clusters as a given user -type Config struct { - // Legacy field from pkg/api/types.go TypeMeta. - // TODO(jlowdermilk): remove this after eliminating downstream dependencies. - // +optional - Kind string `json:"kind,omitempty"` - // DEPRECATED: APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc). - // Because a cluster can run multiple API groups and potentially multiple versions of each, it no longer makes sense to specify - // a single value for the cluster version. - // This field isn't really needed anyway, so we are deprecating it without replacement. - // It will be ignored if it is present. - // +optional - APIVersion string `json:"apiVersion,omitempty"` - // Preferences holds general information to be use for cli interactions - Preferences Preferences `json:"preferences"` - // Clusters is a map of referencable names to cluster configs - Clusters []NamedCluster `json:"clusters"` - // AuthInfos is a map of referencable names to user configs - AuthInfos []NamedAuthInfo `json:"users"` - // Contexts is a map of referencable names to context configs - Contexts []NamedContext `json:"contexts"` - // CurrentContext is the name of the context that you would like to use by default - CurrentContext string `json:"current-context"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` -} - -type Preferences struct { - // +optional - Colors bool `json:"colors,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` -} - -// Cluster contains information about how to communicate with a kubernetes cluster -type Cluster struct { - // Server is the address of the kubernetes cluster (https://hostname:port). - Server string `json:"server"` - // APIVersion is the preferred api version for communicating with the kubernetes cluster (v1, v2, etc). - // +optional - APIVersion string `json:"api-version,omitempty"` - // InsecureSkipTLSVerify skips the validity check for the server's certificate. This will make your HTTPS connections insecure. - // +optional - InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"` - // CertificateAuthority is the path to a cert file for the certificate authority. - // +optional - CertificateAuthority string `json:"certificate-authority,omitempty"` - // CertificateAuthorityData contains PEM-encoded certificate authority certificates. Overrides CertificateAuthority - // +optional - CertificateAuthorityData []byte `json:"certificate-authority-data,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` -} - -// AuthInfo contains information that describes identity information. This is use to tell the kubernetes cluster who you are. -type AuthInfo struct { - // ClientCertificate is the path to a client cert file for TLS. - // +optional - ClientCertificate string `json:"client-certificate,omitempty"` - // ClientCertificateData contains PEM-encoded data from a client cert file for TLS. Overrides ClientCertificate - // +optional - ClientCertificateData []byte `json:"client-certificate-data,omitempty"` - // ClientKey is the path to a client key file for TLS. - // +optional - ClientKey string `json:"client-key,omitempty"` - // ClientKeyData contains PEM-encoded data from a client key file for TLS. Overrides ClientKey - // +optional - ClientKeyData []byte `json:"client-key-data,omitempty"` - // Token is the bearer token for authentication to the kubernetes cluster. - // +optional - Token string `json:"token,omitempty"` - // TokenFile is a pointer to a file that contains a bearer token (as described above). If both Token and TokenFile are present, Token takes precedence. - // +optional - TokenFile string `json:"tokenFile,omitempty"` - // Impersonate is the username to imperonate. The name matches the flag. - // +optional - Impersonate string `json:"as,omitempty"` - // Username is the username for basic authentication to the kubernetes cluster. - // +optional - Username string `json:"username,omitempty"` - // Password is the password for basic authentication to the kubernetes cluster. - // +optional - Password string `json:"password,omitempty"` - // AuthProvider specifies a custom authentication plugin for the kubernetes cluster. - // +optional - AuthProvider *AuthProviderConfig `json:"auth-provider,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` -} - -// Context is a tuple of references to a cluster (how do I communicate with a kubernetes cluster), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with) -type Context struct { - // Cluster is the name of the cluster for this context - Cluster string `json:"cluster"` - // AuthInfo is the name of the authInfo for this context - AuthInfo string `json:"user"` - // Namespace is the default namespace to use on unspecified requests - // +optional - Namespace string `json:"namespace,omitempty"` - // Extensions holds additional information. This is useful for extenders so that reads and writes don't clobber unknown fields - // +optional - Extensions []NamedExtension `json:"extensions,omitempty"` -} - -// NamedCluster relates nicknames to cluster information -type NamedCluster struct { - // Name is the nickname for this Cluster - Name string `json:"name"` - // Cluster holds the cluster information - Cluster Cluster `json:"cluster"` -} - -// NamedContext relates nicknames to context information -type NamedContext struct { - // Name is the nickname for this Context - Name string `json:"name"` - // Context holds the context information - Context Context `json:"context"` -} - -// NamedAuthInfo relates nicknames to auth information -type NamedAuthInfo struct { - // Name is the nickname for this AuthInfo - Name string `json:"name"` - // AuthInfo holds the auth information - AuthInfo AuthInfo `json:"user"` -} - -// NamedExtension relates nicknames to extension information -type NamedExtension struct { - // Name is the nickname for this Extension - Name string `json:"name"` - // Extension holds the extension information - Extension runtime.RawExtension `json:"extension"` -} - -// AuthProviderConfig holds the configuration for a specified auth provider. -type AuthProviderConfig struct { - Name string `json:"name"` - Config map[string]string `json:"config"` -} diff --git a/pkg/client/unversioned/clientcmd/client_config.go b/pkg/client/unversioned/clientcmd/client_config.go index 8fd01923e8..e871638627 100644 --- a/pkg/client/unversioned/clientcmd/client_config.go +++ b/pkg/client/unversioned/clientcmd/client_config.go @@ -27,10 +27,10 @@ import ( "github.com/golang/glog" "github.com/imdario/mergo" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/restclient" clientauth "k8s.io/kubernetes/pkg/client/unversioned/auth" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) var ( diff --git a/pkg/client/unversioned/clientcmd/client_config_test.go b/pkg/client/unversioned/clientcmd/client_config_test.go index e42a94378f..43008d24b4 100644 --- a/pkg/client/unversioned/clientcmd/client_config_test.go +++ b/pkg/client/unversioned/clientcmd/client_config_test.go @@ -24,8 +24,8 @@ import ( "testing" "github.com/imdario/mergo" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/restclient" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) func TestOldMergoLib(t *testing.T) { diff --git a/pkg/client/unversioned/clientcmd/config.go b/pkg/client/unversioned/clientcmd/config.go index 9df69a7412..28f5b795dc 100644 --- a/pkg/client/unversioned/clientcmd/config.go +++ b/pkg/client/unversioned/clientcmd/config.go @@ -26,8 +26,8 @@ import ( "github.com/golang/glog" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/restclient" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) // ConfigAccess is used by subcommands and methods in this package to load and modify the appropriate config files diff --git a/pkg/client/unversioned/clientcmd/loader.go b/pkg/client/unversioned/clientcmd/loader.go index 822e0aff35..9d121585e6 100644 --- a/pkg/client/unversioned/clientcmd/loader.go +++ b/pkg/client/unversioned/clientcmd/loader.go @@ -33,9 +33,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" utilerrors "k8s.io/apimachinery/pkg/util/errors" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" "k8s.io/kubernetes/pkg/client/restclient" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" - clientcmdlatest "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest" "k8s.io/kubernetes/pkg/util/homedir" ) diff --git a/pkg/client/unversioned/clientcmd/loader_test.go b/pkg/client/unversioned/clientcmd/loader_test.go index 078aeddcf9..2558243da5 100644 --- a/pkg/client/unversioned/clientcmd/loader_test.go +++ b/pkg/client/unversioned/clientcmd/loader_test.go @@ -29,8 +29,8 @@ import ( "github.com/ghodss/yaml" "k8s.io/apimachinery/pkg/runtime" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" - clientcmdlatest "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" ) var ( diff --git a/pkg/client/unversioned/clientcmd/merged_client_builder.go b/pkg/client/unversioned/clientcmd/merged_client_builder.go index 75cdd27045..30c618bbf9 100644 --- a/pkg/client/unversioned/clientcmd/merged_client_builder.go +++ b/pkg/client/unversioned/clientcmd/merged_client_builder.go @@ -22,8 +22,8 @@ import ( "github.com/golang/glog" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/restclient" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) // DeferredLoadingClientConfig is a ClientConfig interface that is backed by a client config loader. diff --git a/pkg/client/unversioned/clientcmd/merged_client_builder_test.go b/pkg/client/unversioned/clientcmd/merged_client_builder_test.go index ec4b4072a9..ace3679dd3 100644 --- a/pkg/client/unversioned/clientcmd/merged_client_builder_test.go +++ b/pkg/client/unversioned/clientcmd/merged_client_builder_test.go @@ -20,8 +20,8 @@ import ( "fmt" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/restclient" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type testLoader struct { diff --git a/pkg/client/unversioned/clientcmd/overrides.go b/pkg/client/unversioned/clientcmd/overrides.go index 38de6a6cdd..8622981a9e 100644 --- a/pkg/client/unversioned/clientcmd/overrides.go +++ b/pkg/client/unversioned/clientcmd/overrides.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/pflag" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) // ConfigOverrides holds values that should override whatever information is pulled from the actual Config object. You can't diff --git a/pkg/client/unversioned/clientcmd/validation.go b/pkg/client/unversioned/clientcmd/validation.go index db19b99020..ceeeb042e8 100644 --- a/pkg/client/unversioned/clientcmd/validation.go +++ b/pkg/client/unversioned/clientcmd/validation.go @@ -25,7 +25,7 @@ import ( utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/validation" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) var ( diff --git a/pkg/client/unversioned/clientcmd/validation_test.go b/pkg/client/unversioned/clientcmd/validation_test.go index 391b049fc2..ab7dc26851 100644 --- a/pkg/client/unversioned/clientcmd/validation_test.go +++ b/pkg/client/unversioned/clientcmd/validation_test.go @@ -23,7 +23,7 @@ import ( "testing" utilerrors "k8s.io/apimachinery/pkg/util/errors" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) func TestConfirmUsableBadInfoButOkConfig(t *testing.T) { diff --git a/pkg/kubectl/cmd/config/BUILD b/pkg/kubectl/cmd/config/BUILD index 21d9695990..6d4c314d8a 100644 --- a/pkg/kubectl/cmd/config/BUILD +++ b/pkg/kubectl/cmd/config/BUILD @@ -29,8 +29,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", - "//pkg/client/unversioned/clientcmd/api/latest:go_default_library", "//pkg/kubectl:go_default_library", "//pkg/kubectl/cmd/templates:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", @@ -38,6 +36,8 @@ go_library( "//vendor:github.com/spf13/cobra", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/tools/clientcmd/api", + "//vendor:k8s.io/client-go/tools/clientcmd/api/latest", ], ) @@ -58,10 +58,10 @@ go_test( deps = [ "//pkg/api:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", "//pkg/util/flag:go_default_library", "//vendor:k8s.io/apimachinery/pkg/util/diff", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/pkg/kubectl/cmd/config/config_test.go b/pkg/kubectl/cmd/config/config_test.go index 74c665a2c0..b0927a85dd 100644 --- a/pkg/kubectl/cmd/config/config_test.go +++ b/pkg/kubectl/cmd/config/config_test.go @@ -27,9 +27,9 @@ import ( "testing" "k8s.io/apimachinery/pkg/util/diff" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) diff --git a/pkg/kubectl/cmd/config/create_authinfo.go b/pkg/kubectl/cmd/config/create_authinfo.go index 8629353b36..c217aee14f 100644 --- a/pkg/kubectl/cmd/config/create_authinfo.go +++ b/pkg/kubectl/cmd/config/create_authinfo.go @@ -26,8 +26,8 @@ import ( "github.com/spf13/cobra" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/util/flag" diff --git a/pkg/kubectl/cmd/config/create_cluster.go b/pkg/kubectl/cmd/config/create_cluster.go index 9c697bc2be..82e11da885 100644 --- a/pkg/kubectl/cmd/config/create_cluster.go +++ b/pkg/kubectl/cmd/config/create_cluster.go @@ -25,8 +25,8 @@ import ( "github.com/spf13/cobra" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/util/flag" diff --git a/pkg/kubectl/cmd/config/create_context.go b/pkg/kubectl/cmd/config/create_context.go index e4184b9e93..48989cd0ea 100644 --- a/pkg/kubectl/cmd/config/create_context.go +++ b/pkg/kubectl/cmd/config/create_context.go @@ -23,8 +23,8 @@ import ( "github.com/spf13/cobra" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/util/flag" diff --git a/pkg/kubectl/cmd/config/current_context_test.go b/pkg/kubectl/cmd/config/current_context_test.go index abd11ffb4b..cd2db6fbac 100644 --- a/pkg/kubectl/cmd/config/current_context_test.go +++ b/pkg/kubectl/cmd/config/current_context_test.go @@ -23,8 +23,8 @@ import ( "strings" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type currentContextTest struct { diff --git a/pkg/kubectl/cmd/config/delete_cluster_test.go b/pkg/kubectl/cmd/config/delete_cluster_test.go index 1e4c620b27..523854097d 100644 --- a/pkg/kubectl/cmd/config/delete_cluster_test.go +++ b/pkg/kubectl/cmd/config/delete_cluster_test.go @@ -24,8 +24,8 @@ import ( "reflect" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type deleteClusterTest struct { diff --git a/pkg/kubectl/cmd/config/delete_context_test.go b/pkg/kubectl/cmd/config/delete_context_test.go index a417bebe83..130de20ed5 100644 --- a/pkg/kubectl/cmd/config/delete_context_test.go +++ b/pkg/kubectl/cmd/config/delete_context_test.go @@ -24,8 +24,8 @@ import ( "reflect" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type deleteContextTest struct { diff --git a/pkg/kubectl/cmd/config/get_clusters_test.go b/pkg/kubectl/cmd/config/get_clusters_test.go index 8493de3fcd..ec77b79f8f 100644 --- a/pkg/kubectl/cmd/config/get_clusters_test.go +++ b/pkg/kubectl/cmd/config/get_clusters_test.go @@ -22,8 +22,8 @@ import ( "os" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type getClustersTest struct { diff --git a/pkg/kubectl/cmd/config/get_contexts.go b/pkg/kubectl/cmd/config/get_contexts.go index 92ede9bb87..dfa67c9eb2 100644 --- a/pkg/kubectl/cmd/config/get_contexts.go +++ b/pkg/kubectl/cmd/config/get_contexts.go @@ -25,8 +25,8 @@ import ( "github.com/spf13/cobra" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" diff --git a/pkg/kubectl/cmd/config/get_contexts_test.go b/pkg/kubectl/cmd/config/get_contexts_test.go index 6bb38896d8..b4c78a7bf1 100644 --- a/pkg/kubectl/cmd/config/get_contexts_test.go +++ b/pkg/kubectl/cmd/config/get_contexts_test.go @@ -22,8 +22,8 @@ import ( "os" "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" ) type getContextsTest struct { diff --git a/pkg/kubectl/cmd/config/navigation_step_parser.go b/pkg/kubectl/cmd/config/navigation_step_parser.go index 7709e665f0..0345c79dd7 100644 --- a/pkg/kubectl/cmd/config/navigation_step_parser.go +++ b/pkg/kubectl/cmd/config/navigation_step_parser.go @@ -22,7 +22,7 @@ import ( "strings" "k8s.io/apimachinery/pkg/util/sets" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) type navigationSteps struct { diff --git a/pkg/kubectl/cmd/config/navigation_step_parser_test.go b/pkg/kubectl/cmd/config/navigation_step_parser_test.go index 0d2eefc93b..a468c5c9df 100644 --- a/pkg/kubectl/cmd/config/navigation_step_parser_test.go +++ b/pkg/kubectl/cmd/config/navigation_step_parser_test.go @@ -22,7 +22,7 @@ import ( "testing" "k8s.io/apimachinery/pkg/util/diff" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) type stepParserTest struct { diff --git a/pkg/kubectl/cmd/config/use_context.go b/pkg/kubectl/cmd/config/use_context.go index 6138d9a7a1..0f2fed7f87 100644 --- a/pkg/kubectl/cmd/config/use_context.go +++ b/pkg/kubectl/cmd/config/use_context.go @@ -23,8 +23,8 @@ import ( "github.com/spf13/cobra" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) diff --git a/pkg/kubectl/cmd/config/view.go b/pkg/kubectl/cmd/config/view.go index 5193c80c4e..157d713c01 100644 --- a/pkg/kubectl/cmd/config/view.go +++ b/pkg/kubectl/cmd/config/view.go @@ -23,9 +23,9 @@ import ( "github.com/spf13/cobra" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + "k8s.io/client-go/tools/clientcmd/api/latest" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" diff --git a/pkg/kubectl/cmd/util/BUILD b/pkg/kubectl/cmd/util/BUILD index 81247da7a6..fce01360ab 100644 --- a/pkg/kubectl/cmd/util/BUILD +++ b/pkg/kubectl/cmd/util/BUILD @@ -93,7 +93,6 @@ go_test( "//pkg/client/testing/core:go_default_library", "//pkg/client/typed/discovery:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/controller:go_default_library", "//pkg/kubectl:go_default_library", "//pkg/kubectl/resource:go_default_library", @@ -110,6 +109,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/util/validation/field", "//vendor:k8s.io/apimachinery/pkg/version", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/pkg/kubectl/cmd/util/factory_test.go b/pkg/kubectl/cmd/util/factory_test.go index b691f189a8..20b81781e7 100644 --- a/pkg/kubectl/cmd/util/factory_test.go +++ b/pkg/kubectl/cmd/util/factory_test.go @@ -37,6 +37,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/v1" @@ -46,7 +47,6 @@ import ( manualfake "k8s.io/kubernetes/pkg/client/restclient/fake" testcore "k8s.io/kubernetes/pkg/client/testing/core" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/resource" diff --git a/plugin/pkg/admission/imagepolicy/BUILD b/plugin/pkg/admission/imagepolicy/BUILD index 6b5f5fdf91..2e1a7bce1b 100644 --- a/plugin/pkg/admission/imagepolicy/BUILD +++ b/plugin/pkg/admission/imagepolicy/BUILD @@ -45,9 +45,9 @@ go_test( "//pkg/api:go_default_library", "//pkg/apis/imagepolicy/install:go_default_library", "//pkg/apis/imagepolicy/v1alpha1:go_default_library", - "//pkg/client/unversioned/clientcmd/api/v1:go_default_library", "//vendor:k8s.io/apiserver/pkg/admission", "//vendor:k8s.io/apiserver/pkg/authentication/user", + "//vendor:k8s.io/client-go/tools/clientcmd/api/v1", ], ) diff --git a/plugin/pkg/admission/imagepolicy/admission_test.go b/plugin/pkg/admission/imagepolicy/admission_test.go index 347ad6aad6..caded8ffc3 100644 --- a/plugin/pkg/admission/imagepolicy/admission_test.go +++ b/plugin/pkg/admission/imagepolicy/admission_test.go @@ -30,9 +30,9 @@ import ( "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/authentication/user" + "k8s.io/client-go/tools/clientcmd/api/v1" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" "fmt" "io/ioutil" diff --git a/plugin/pkg/auth/authenticator/token/webhook/BUILD b/plugin/pkg/auth/authenticator/token/webhook/BUILD index a2308ab738..5603b208b4 100644 --- a/plugin/pkg/auth/authenticator/token/webhook/BUILD +++ b/plugin/pkg/auth/authenticator/token/webhook/BUILD @@ -35,9 +35,9 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/apis/authentication/v1beta1:go_default_library", - "//pkg/client/unversioned/clientcmd/api/v1:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apiserver/pkg/authentication/user", + "//vendor:k8s.io/client-go/tools/clientcmd/api/v1", ], ) diff --git a/plugin/pkg/auth/authenticator/token/webhook/webhook_test.go b/plugin/pkg/auth/authenticator/token/webhook/webhook_test.go index aefdf05685..18847c83f1 100644 --- a/plugin/pkg/auth/authenticator/token/webhook/webhook_test.go +++ b/plugin/pkg/auth/authenticator/token/webhook/webhook_test.go @@ -32,8 +32,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/authentication/user" + "k8s.io/client-go/tools/clientcmd/api/v1" "k8s.io/kubernetes/pkg/apis/authentication/v1beta1" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" ) // Service mocks a remote authentication service. diff --git a/plugin/pkg/auth/authorizer/webhook/BUILD b/plugin/pkg/auth/authorizer/webhook/BUILD index c7c8561198..06851547a8 100644 --- a/plugin/pkg/auth/authorizer/webhook/BUILD +++ b/plugin/pkg/auth/authorizer/webhook/BUILD @@ -35,11 +35,11 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/apis/authorization/v1beta1:go_default_library", - "//pkg/client/unversioned/clientcmd/api/v1:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/diff", "//vendor:k8s.io/apiserver/pkg/authentication/user", "//vendor:k8s.io/apiserver/pkg/authorization/authorizer", + "//vendor:k8s.io/client-go/tools/clientcmd/api/v1", ], ) diff --git a/plugin/pkg/auth/authorizer/webhook/webhook_test.go b/plugin/pkg/auth/authorizer/webhook/webhook_test.go index 0d6f0d2abf..f434cf5e9a 100644 --- a/plugin/pkg/auth/authorizer/webhook/webhook_test.go +++ b/plugin/pkg/auth/authorizer/webhook/webhook_test.go @@ -36,8 +36,8 @@ import ( "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authorization/authorizer" + "k8s.io/client-go/tools/clientcmd/api/v1" "k8s.io/kubernetes/pkg/apis/authorization/v1beta1" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" ) func TestNewFromConfig(t *testing.T) { diff --git a/staging/copy.sh b/staging/copy.sh index c48b1f6ebe..8dade75ef9 100755 --- a/staging/copy.sh +++ b/staging/copy.sh @@ -64,11 +64,13 @@ cd "${CLIENT_REPO}" # save copies code from client-go into the temp folder to make sure we don't lose it by accident # TODO this is temporary until everything in certain directories is authoritative function save() { - cp -r "${CLIENT_REPO}/$1" "${CLIENT_REPO_TEMP}" + mkdir -p "${CLIENT_REPO_TEMP}/$1" + cp -r "${CLIENT_REPO}/$1/"* "${CLIENT_REPO_TEMP}/$1" } # save everything for which the staging directory is the source of truth -save "/transport" +save "transport" +save "tools/clientcmd/api" @@ -160,12 +162,9 @@ echo "rearranging directory layout" function mvfolder { local src=${1%/#/} local dst=${2%/#/} - # create the parent directory of dst - if [ "${dst%/*}" != "${dst}" ]; then - mkdir -p "${CLIENT_REPO_TEMP}/${dst%/*}" - fi + mkdir -p "${CLIENT_REPO_TEMP}/${dst}" # move - mv "${CLIENT_REPO_TEMP}/${src}" "${CLIENT_REPO_TEMP}/${dst}" + mv "${CLIENT_REPO_TEMP}/${src}"/* "${CLIENT_REPO_TEMP}/${dst}" # rewrite package local src_package="${src##*/}" local dst_package="${dst##*/}" diff --git a/test/e2e/framework/BUILD b/test/e2e/framework/BUILD index 3e96045c1f..c095574f42 100644 --- a/test/e2e/framework/BUILD +++ b/test/e2e/framework/BUILD @@ -54,7 +54,6 @@ go_library( "//pkg/client/typed/discovery:go_default_library", "//pkg/client/typed/dynamic:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/client/unversioned/remotecommand:go_default_library", "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/gce:go_default_library", @@ -110,6 +109,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/watch", "//vendor:k8s.io/client-go/kubernetes", "//vendor:k8s.io/client-go/rest", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 1c4b7276b7..f1bbe21433 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -61,6 +61,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1" @@ -75,7 +76,6 @@ import ( "k8s.io/kubernetes/pkg/client/typed/discovery" "k8s.io/kubernetes/pkg/client/typed/dynamic" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" gcecloud "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" "k8s.io/kubernetes/pkg/controller" deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util" diff --git a/test/e2e_federation/BUILD b/test/e2e_federation/BUILD index cd3baea57a..50368e636d 100644 --- a/test/e2e_federation/BUILD +++ b/test/e2e_federation/BUILD @@ -34,7 +34,6 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", - "//pkg/client/unversioned/clientcmd/api:go_default_library", "//pkg/util/intstr:go_default_library", "//test/e2e/common:go_default_library", "//test/e2e/framework:go_default_library", @@ -44,6 +43,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/test/e2e_federation/federation-authn.go b/test/e2e_federation/federation-authn.go index f1096715db..e431ce1bdd 100644 --- a/test/e2e_federation/federation-authn.go +++ b/test/e2e_federation/federation-authn.go @@ -20,9 +20,9 @@ import ( "fmt" "k8s.io/apimachinery/pkg/api/errors" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/test/e2e/framework" fedframework "k8s.io/kubernetes/test/e2e_federation/framework" diff --git a/test/e2e_federation/federation-util.go b/test/e2e_federation/federation-util.go index 7f164bbb0f..be2a37d741 100644 --- a/test/e2e_federation/federation-util.go +++ b/test/e2e_federation/federation-util.go @@ -25,6 +25,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" fedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/pkg/api" @@ -32,7 +33,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/test/e2e/common" "k8s.io/kubernetes/test/e2e/framework" fedframework "k8s.io/kubernetes/test/e2e_federation/framework" diff --git a/test/integration/auth/auth_test.go b/test/integration/auth/auth_test.go index d6b08635af..9e81f299b8 100644 --- a/test/integration/auth/auth_test.go +++ b/test/integration/auth/auth_test.go @@ -42,13 +42,13 @@ import ( "k8s.io/apiserver/pkg/authentication/serviceaccount" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authorization/authorizer" + "k8s.io/client-go/tools/clientcmd/api/v1" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" authenticationv1beta1 "k8s.io/kubernetes/pkg/apis/authentication/v1beta1" "k8s.io/kubernetes/pkg/apis/autoscaling" "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/auth/authorizer/abac" - "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/v1" apiserverauthorizer "k8s.io/kubernetes/pkg/genericapiserver/authorizer" "k8s.io/kubernetes/plugin/pkg/admission/admit" "k8s.io/kubernetes/plugin/pkg/auth/authenticator/token/tokentest" diff --git a/test/integration/kubectl/kubectl_test.go b/test/integration/kubectl/kubectl_test.go index 0918a22ce3..8d9893ca56 100644 --- a/test/integration/kubectl/kubectl_test.go +++ b/test/integration/kubectl/kubectl_test.go @@ -21,8 +21,8 @@ package kubectl import ( "testing" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd" - clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/test/integration/framework" ) diff --git a/vendor/BUILD b/vendor/BUILD index 2b1145d422..4f7e721b40 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -10744,6 +10744,7 @@ go_library( "//vendor:k8s.io/client-go/kubernetes/typed/extensions/v1beta1", "//vendor:k8s.io/client-go/kubernetes/typed/policy/v1beta1", "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1alpha1", + "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1", "//vendor:k8s.io/client-go/kubernetes/typed/storage/v1beta1", "//vendor:k8s.io/client-go/pkg/api", "//vendor:k8s.io/client-go/pkg/api/install", @@ -10798,6 +10799,8 @@ go_library( "//vendor:k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake", "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1alpha1", "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake", + "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1", + "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake", "//vendor:k8s.io/client-go/kubernetes/typed/storage/v1beta1", "//vendor:k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake", "//vendor:k8s.io/client-go/pkg/api", @@ -11453,6 +11456,7 @@ go_library( "k8s.io/client-go/pkg/api/doc.go", "k8s.io/client-go/pkg/api/field_constants.go", "k8s.io/client-go/pkg/api/helpers.go", + "k8s.io/client-go/pkg/api/json.go", "k8s.io/client-go/pkg/api/mapper.go", "k8s.io/client-go/pkg/api/meta.go", "k8s.io/client-go/pkg/api/ref.go", @@ -12364,6 +12368,7 @@ go_library( "//vendor:k8s.io/client-go/pkg/apimachinery/announced", "//vendor:k8s.io/client-go/pkg/apis/rbac", "//vendor:k8s.io/client-go/pkg/apis/rbac/v1alpha1", + "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", ], ) @@ -13554,3 +13559,82 @@ filegroup( srcs = [":package-srcs"], tags = ["automanaged"], ) + +go_library( + name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1", + srcs = [ + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/runtime/serializer", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/api", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", + "//vendor:k8s.io/client-go/rest", + ], +) + +go_library( + name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake", + srcs = [ + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/labels", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", + "//vendor:k8s.io/client-go/rest", + "//vendor:k8s.io/client-go/testing", + ], +) + +go_library( + name = "k8s.io/client-go/pkg/apis/rbac/v1beta1", + srcs = [ + "k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:github.com/gogo/protobuf/proto", + "//vendor:github.com/ugorji/go/codec", + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/conversion", + "//vendor:k8s.io/apimachinery/pkg/runtime", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac", + ], +) From 6c6616b41c1e78ff17fe1ebf7e3301634e2cdb23 Mon Sep 17 00:00:00 2001 From: deads2k Date: Wed, 18 Jan 2017 16:01:15 -0500 Subject: [PATCH 3/4] move restclient/watch --- pkg/client/restclient/BUILD | 5 +- pkg/client/restclient/request.go | 2 +- pkg/client/restclient/request_test.go | 2 +- pkg/client/restclient/watch/BUILD | 56 ---------- pkg/client/restclient/watch/decoder.go | 72 ------------- pkg/client/restclient/watch/decoder_test.go | 114 -------------------- pkg/client/restclient/watch/encoder.go | 56 ---------- pkg/client/restclient/watch/encoder_test.go | 79 -------------- pkg/client/typed/dynamic/BUILD | 2 +- pkg/client/typed/dynamic/client_test.go | 2 +- pkg/kubectl/cmd/BUILD | 2 +- pkg/kubectl/cmd/get_test.go | 2 +- pkg/kubectl/resource/BUILD | 2 +- pkg/kubectl/resource/builder_test.go | 2 +- staging/copy.sh | 1 + vendor/BUILD | 79 ++++++++++++++ 16 files changed, 90 insertions(+), 388 deletions(-) delete mode 100644 pkg/client/restclient/watch/BUILD delete mode 100644 pkg/client/restclient/watch/decoder.go delete mode 100644 pkg/client/restclient/watch/decoder_test.go delete mode 100644 pkg/client/restclient/watch/encoder.go delete mode 100644 pkg/client/restclient/watch/encoder_test.go diff --git a/pkg/client/restclient/BUILD b/pkg/client/restclient/BUILD index 87150ee092..536ebd1726 100644 --- a/pkg/client/restclient/BUILD +++ b/pkg/client/restclient/BUILD @@ -26,7 +26,6 @@ go_library( "//pkg/api/v1:go_default_library", "//pkg/api/validation/path:go_default_library", "//pkg/client/metrics:go_default_library", - "//pkg/client/restclient/watch:go_default_library", "//pkg/fields:go_default_library", "//pkg/util/cert:go_default_library", "//pkg/util/flowcontrol:go_default_library", @@ -42,6 +41,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/rest/watch", "//vendor:k8s.io/client-go/tools/clientcmd/api", "//vendor:k8s.io/client-go/transport", ], @@ -63,7 +63,6 @@ go_test( "//pkg/api:go_default_library", "//pkg/api/testapi:go_default_library", "//pkg/api/v1:go_default_library", - "//pkg/client/restclient/watch:go_default_library", "//pkg/util/clock:go_default_library", "//pkg/util/flowcontrol:go_default_library", "//pkg/util/httpstream:go_default_library", @@ -79,6 +78,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/diff", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/rest/watch", "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) @@ -95,7 +95,6 @@ filegroup( srcs = [ ":package-srcs", "//pkg/client/restclient/fake:all-srcs", - "//pkg/client/restclient/watch:all-srcs", ], tags = ["automanaged"], ) diff --git a/pkg/client/restclient/request.go b/pkg/client/restclient/request.go index e3a652f334..7edbac605a 100644 --- a/pkg/client/restclient/request.go +++ b/pkg/client/restclient/request.go @@ -42,10 +42,10 @@ import ( "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/watch" + restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api/v1" pathvalidation "k8s.io/kubernetes/pkg/api/validation/path" "k8s.io/kubernetes/pkg/client/metrics" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/util/flowcontrol" ) diff --git a/pkg/client/restclient/request_test.go b/pkg/client/restclient/request_test.go index 631e7de0c8..d4c00d8f7d 100755 --- a/pkg/client/restclient/request_test.go +++ b/pkg/client/restclient/request_test.go @@ -42,10 +42,10 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/watch" + restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/v1" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" "k8s.io/kubernetes/pkg/util/clock" "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/httpstream" diff --git a/pkg/client/restclient/watch/BUILD b/pkg/client/restclient/watch/BUILD deleted file mode 100644 index d28d6181da..0000000000 --- a/pkg/client/restclient/watch/BUILD +++ /dev/null @@ -1,56 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "decoder.go", - "encoder.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/streaming", - "//vendor:k8s.io/apimachinery/pkg/watch", - ], -) - -go_test( - name = "go_default_xtest", - srcs = [ - "decoder_test.go", - "encoder_test.go", - ], - tags = ["automanaged"], - deps = [ - "//pkg/api:go_default_library", - "//pkg/api/testapi:go_default_library", - "//pkg/client/restclient/watch:go_default_library", - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/streaming", - "//vendor:k8s.io/apimachinery/pkg/util/wait", - "//vendor:k8s.io/apimachinery/pkg/watch", - ], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/client/restclient/watch/decoder.go b/pkg/client/restclient/watch/decoder.go deleted file mode 100644 index 73bb63addf..0000000000 --- a/pkg/client/restclient/watch/decoder.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package versioned - -import ( - "fmt" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/watch" -) - -// Decoder implements the watch.Decoder interface for io.ReadClosers that -// have contents which consist of a series of watchEvent objects encoded -// with the given streaming decoder. The internal objects will be then -// decoded by the embedded decoder. -type Decoder struct { - decoder streaming.Decoder - embeddedDecoder runtime.Decoder -} - -// NewDecoder creates an Decoder for the given writer and codec. -func NewDecoder(decoder streaming.Decoder, embeddedDecoder runtime.Decoder) *Decoder { - return &Decoder{ - decoder: decoder, - embeddedDecoder: embeddedDecoder, - } -} - -// Decode blocks until it can return the next object in the reader. Returns an error -// if the reader is closed or an object can't be decoded. -func (d *Decoder) Decode() (watch.EventType, runtime.Object, error) { - var got metav1.WatchEvent - res, _, err := d.decoder.Decode(nil, &got) - if err != nil { - return "", nil, err - } - if res != &got { - return "", nil, fmt.Errorf("unable to decode to metav1.Event") - } - switch got.Type { - case string(watch.Added), string(watch.Modified), string(watch.Deleted), string(watch.Error): - default: - return "", nil, fmt.Errorf("got invalid watch event type: %v", got.Type) - } - - obj, err := runtime.Decode(d.embeddedDecoder, got.Object.Raw) - if err != nil { - return "", nil, fmt.Errorf("unable to decode watch event: %v", err) - } - return watch.EventType(got.Type), obj, nil -} - -// Close closes the underlying r. -func (d *Decoder) Close() { - d.decoder.Close() -} diff --git a/pkg/client/restclient/watch/decoder_test.go b/pkg/client/restclient/watch/decoder_test.go deleted file mode 100644 index a468929fe5..0000000000 --- a/pkg/client/restclient/watch/decoder_test.go +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package versioned_test - -import ( - "encoding/json" - "io" - "testing" - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/testapi" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" -) - -func TestDecoder(t *testing.T) { - table := []watch.EventType{watch.Added, watch.Deleted, watch.Modified, watch.Error} - - for _, eventType := range table { - out, in := io.Pipe() - codec := testapi.Default.Codec() - decoder := restclientwatch.NewDecoder(streaming.NewDecoder(out, codec), codec) - - expect := &api.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}} - encoder := json.NewEncoder(in) - go func() { - data, err := runtime.Encode(testapi.Default.Codec(), expect) - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - event := metav1.WatchEvent{ - Type: string(eventType), - Object: runtime.RawExtension{Raw: json.RawMessage(data)}, - } - if err := encoder.Encode(&event); err != nil { - t.Errorf("Unexpected error %v", err) - } - in.Close() - }() - - done := make(chan struct{}) - go func() { - action, got, err := decoder.Decode() - if err != nil { - t.Fatalf("Unexpected error %v", err) - } - if e, a := eventType, action; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e, a := expect, got; !api.Semantic.DeepDerivative(e, a) { - t.Errorf("Expected %v, got %v", e, a) - } - t.Logf("Exited read") - close(done) - }() - <-done - - done = make(chan struct{}) - go func() { - _, _, err := decoder.Decode() - if err == nil { - t.Errorf("Unexpected nil error") - } - close(done) - }() - <-done - - decoder.Close() - } -} - -func TestDecoder_SourceClose(t *testing.T) { - out, in := io.Pipe() - codec := testapi.Default.Codec() - decoder := restclientwatch.NewDecoder(streaming.NewDecoder(out, codec), codec) - - done := make(chan struct{}) - - go func() { - _, _, err := decoder.Decode() - if err == nil { - t.Errorf("Unexpected nil error") - } - close(done) - }() - - in.Close() - - select { - case <-done: - break - case <-time.After(wait.ForeverTestTimeout): - t.Error("Timeout") - } -} diff --git a/pkg/client/restclient/watch/encoder.go b/pkg/client/restclient/watch/encoder.go deleted file mode 100644 index e55aa12d9b..0000000000 --- a/pkg/client/restclient/watch/encoder.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package versioned - -import ( - "encoding/json" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/watch" -) - -// Encoder serializes watch.Events into io.Writer. The internal objects -// are encoded using embedded encoder, and the outer Event is serialized -// using encoder. -// TODO: this type is only used by tests -type Encoder struct { - encoder streaming.Encoder - embeddedEncoder runtime.Encoder -} - -func NewEncoder(encoder streaming.Encoder, embeddedEncoder runtime.Encoder) *Encoder { - return &Encoder{ - encoder: encoder, - embeddedEncoder: embeddedEncoder, - } -} - -// Encode writes an event to the writer. Returns an error -// if the writer is closed or an object can't be encoded. -func (e *Encoder) Encode(event *watch.Event) error { - data, err := runtime.Encode(e.embeddedEncoder, event.Object) - if err != nil { - return err - } - // FIXME: get rid of json.RawMessage. - return e.encoder.Encode(&metav1.WatchEvent{ - Type: string(event.Type), - Object: runtime.RawExtension{Raw: json.RawMessage(data)}, - }) -} diff --git a/pkg/client/restclient/watch/encoder_test.go b/pkg/client/restclient/watch/encoder_test.go deleted file mode 100644 index 96b965bf05..0000000000 --- a/pkg/client/restclient/watch/encoder_test.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package versioned_test - -import ( - "bytes" - "io/ioutil" - "testing" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/testapi" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" -) - -func TestEncodeDecodeRoundTrip(t *testing.T) { - testCases := []struct { - Type watch.EventType - Object runtime.Object - Codec runtime.Codec - }{ - { - watch.Added, - &api.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, - testapi.Default.Codec(), - }, - { - watch.Modified, - &api.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, - testapi.Default.Codec(), - }, - { - watch.Deleted, - &api.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, - testapi.Default.Codec(), - }, - } - for i, testCase := range testCases { - buf := &bytes.Buffer{} - - codec := testCase.Codec - encoder := restclientwatch.NewEncoder(streaming.NewEncoder(buf, codec), codec) - if err := encoder.Encode(&watch.Event{Type: testCase.Type, Object: testCase.Object}); err != nil { - t.Errorf("%d: unexpected error: %v", i, err) - continue - } - - rc := ioutil.NopCloser(buf) - decoder := restclientwatch.NewDecoder(streaming.NewDecoder(rc, codec), codec) - event, obj, err := decoder.Decode() - if err != nil { - t.Errorf("%d: unexpected error: %v", i, err) - continue - } - if !api.Semantic.DeepDerivative(testCase.Object, obj) { - t.Errorf("%d: expected %#v, got %#v", i, testCase.Object, obj) - } - if event != testCase.Type { - t.Errorf("%d: unexpected type: %#v", i, event) - } - } -} diff --git a/pkg/client/typed/dynamic/BUILD b/pkg/client/typed/dynamic/BUILD index 4529415a69..639c59a4bd 100644 --- a/pkg/client/typed/dynamic/BUILD +++ b/pkg/client/typed/dynamic/BUILD @@ -44,7 +44,6 @@ go_test( deps = [ "//pkg/api/v1:go_default_library", "//pkg/client/restclient:go_default_library", - "//pkg/client/restclient/watch:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "//vendor:k8s.io/apimachinery/pkg/runtime", @@ -52,6 +51,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/streaming", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/rest/watch", ], ) diff --git a/pkg/client/typed/dynamic/client_test.go b/pkg/client/typed/dynamic/client_test.go index 69f5b450f8..9166256df3 100644 --- a/pkg/client/typed/dynamic/client_test.go +++ b/pkg/client/typed/dynamic/client_test.go @@ -32,9 +32,9 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" ) func getJSON(version, kind, name string) []byte { diff --git a/pkg/kubectl/cmd/BUILD b/pkg/kubectl/cmd/BUILD index 4d31bbabc8..a9f46120cc 100644 --- a/pkg/kubectl/cmd/BUILD +++ b/pkg/kubectl/cmd/BUILD @@ -183,7 +183,6 @@ go_test( "//pkg/apis/policy:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/restclient/fake:go_default_library", - "//pkg/client/restclient/watch:go_default_library", "//pkg/client/typed/dynamic:go_default_library", "//pkg/kubectl:go_default_library", "//pkg/kubectl/cmd/testing:go_default_library", @@ -205,6 +204,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/rest/watch", "//vendor:k8s.io/heapster/metrics/apis/metrics/v1alpha1", ], ) diff --git a/pkg/kubectl/cmd/get_test.go b/pkg/kubectl/cmd/get_test.go index fccd176c19..7c751e9551 100644 --- a/pkg/kubectl/cmd/get_test.go +++ b/pkg/kubectl/cmd/get_test.go @@ -33,12 +33,12 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/json" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/watch" + restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/restclient/fake" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" ) diff --git a/pkg/kubectl/resource/BUILD b/pkg/kubectl/resource/BUILD index b904175d3b..ceadd120fe 100644 --- a/pkg/kubectl/resource/BUILD +++ b/pkg/kubectl/resource/BUILD @@ -65,7 +65,6 @@ go_test( "//pkg/api/testing:go_default_library", "//pkg/api/v1:go_default_library", "//pkg/client/restclient/fake:go_default_library", - "//pkg/client/restclient/watch:go_default_library", "//pkg/util/testing:go_default_library", "//vendor:github.com/ghodss/yaml", "//vendor:github.com/stretchr/testify/assert", @@ -76,6 +75,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/runtime/serializer/streaming", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/rest/watch", ], ) diff --git a/pkg/kubectl/resource/builder_test.go b/pkg/kubectl/resource/builder_test.go index 83edf3e28c..91b562d794 100644 --- a/pkg/kubectl/resource/builder_test.go +++ b/pkg/kubectl/resource/builder_test.go @@ -37,13 +37,13 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/streaming" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/watch" + restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient/fake" - restclientwatch "k8s.io/kubernetes/pkg/client/restclient/watch" utiltesting "k8s.io/kubernetes/pkg/util/testing" ) diff --git a/staging/copy.sh b/staging/copy.sh index 8dade75ef9..813b89081c 100755 --- a/staging/copy.sh +++ b/staging/copy.sh @@ -71,6 +71,7 @@ function save() { # save everything for which the staging directory is the source of truth save "transport" save "tools/clientcmd/api" +save "rest/watch" diff --git a/vendor/BUILD b/vendor/BUILD index 4f7e721b40..b4ba2040f9 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -13638,3 +13638,82 @@ go_library( "//vendor:k8s.io/client-go/pkg/apis/rbac", ], ) + +go_library( + name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1", + srcs = [ + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/runtime/serializer", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/api", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", + "//vendor:k8s.io/client-go/rest", + ], +) + +go_library( + name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake", + srcs = [ + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go", + "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/labels", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", + "//vendor:k8s.io/client-go/rest", + "//vendor:k8s.io/client-go/testing", + ], +) + +go_library( + name = "k8s.io/client-go/pkg/apis/rbac/v1beta1", + srcs = [ + "k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go", + "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:github.com/gogo/protobuf/proto", + "//vendor:github.com/ugorji/go/codec", + "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/apimachinery/pkg/conversion", + "//vendor:k8s.io/apimachinery/pkg/runtime", + "//vendor:k8s.io/apimachinery/pkg/runtime/schema", + "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/api/v1", + "//vendor:k8s.io/client-go/pkg/apis/rbac", + ], +) From c47717134be05d5cdd08aff8774acd079abdead6 Mon Sep 17 00:00:00 2001 From: deads2k Date: Wed, 18 Jan 2017 16:28:49 -0500 Subject: [PATCH 4/4] move utils used in restclient to client-go --- .../clientset_generated/clientset/BUILD | 2 +- .../clientset/clientset.go | 2 +- .../internalclientset/BUILD | 2 +- .../internalclientset/clientset.go | 2 +- .../generators/generator_for_clientset.go | 2 +- .../test_internalclientset/BUILD | 4 +- .../test_internalclientset/clientset.go | 2 +- .../test_internalclientset/clientset_test.go | 2 +- .../federation_clientset/BUILD | 2 +- .../federation_clientset/clientset.go | 2 +- .../federation_internalclientset/BUILD | 2 +- .../federation_internalclientset/clientset.go | 2 +- .../pkg/federation-controller/configmap/BUILD | 2 +- .../configmap/configmap_controller.go | 2 +- .../pkg/federation-controller/daemonset/BUILD | 2 +- .../daemonset/daemonset_controller.go | 2 +- .../federation-controller/deployment/BUILD | 2 +- .../deployment/deploymentcontroller.go | 2 +- .../pkg/federation-controller/ingress/BUILD | 2 +- .../ingress/ingress_controller.go | 2 +- .../pkg/federation-controller/namespace/BUILD | 2 +- .../namespace/namespace_controller.go | 2 +- .../federation-controller/replicaset/BUILD | 2 +- .../replicaset/replicasetcontroller.go | 2 +- .../pkg/federation-controller/secret/BUILD | 2 +- .../secret/secret_controller.go | 2 +- .../pkg/federation-controller/util/BUILD | 2 +- .../pkg/federation-controller/util/backoff.go | 2 +- pkg/client/cache/BUILD | 4 +- pkg/client/cache/expiration_cache.go | 2 +- pkg/client/cache/expiration_cache_fakes.go | 2 +- pkg/client/cache/expiration_cache_test.go | 2 +- .../clientset_generated/clientset/BUILD | 2 +- .../clientset/clientset.go | 2 +- .../internalclientset/BUILD | 2 +- .../internalclientset/clientset.go | 2 +- pkg/client/record/BUILD | 4 +- pkg/client/record/event.go | 2 +- pkg/client/record/event_test.go | 2 +- pkg/client/record/events_cache.go | 2 +- pkg/client/record/events_cache_test.go | 2 +- pkg/client/restclient/BUILD | 6 +- pkg/client/restclient/client.go | 2 +- pkg/client/restclient/config.go | 2 +- pkg/client/restclient/config_test.go | 2 +- pkg/client/restclient/fake/BUILD | 2 +- pkg/client/restclient/fake/fake.go | 2 +- pkg/client/restclient/request.go | 2 +- pkg/client/restclient/request_test.go | 4 +- pkg/client/restclient/urlbackoff.go | 2 +- pkg/client/restclient/urlbackoff_test.go | 2 +- pkg/client/typed/dynamic/BUILD | 2 +- pkg/client/typed/dynamic/client.go | 2 +- pkg/cloudprovider/providers/gce/BUILD | 2 +- pkg/cloudprovider/providers/gce/gce.go | 2 +- .../providers/gce/token_source.go | 2 +- pkg/controller/BUILD | 6 +- pkg/controller/controller_utils.go | 4 +- pkg/controller/controller_utils_test.go | 2 +- pkg/controller/deployment/BUILD | 2 +- pkg/controller/deployment/rolling.go | 2 +- pkg/controller/deployment/util/BUILD | 2 +- .../deployment/util/deployment_util.go | 2 +- pkg/controller/garbagecollector/BUILD | 4 +- .../garbagecollector/garbagecollector.go | 2 +- .../garbagecollector/garbagecollector_test.go | 2 +- pkg/controller/garbagecollector/metrics.go | 2 +- pkg/controller/node/BUILD | 4 +- pkg/controller/node/nodecontroller.go | 2 +- pkg/controller/node/rate_limited_queue.go | 2 +- .../node/rate_limited_queue_test.go | 2 +- pkg/controller/node/testutil/BUILD | 2 +- pkg/controller/node/testutil/test_utils.go | 2 +- pkg/kubectl/BUILD | 2 +- pkg/kubectl/rolling_updater.go | 2 +- pkg/kubectl/sorting_printer.go | 2 +- pkg/kubelet/BUILD | 10 +- pkg/kubelet/active_deadline.go | 2 +- pkg/kubelet/active_deadline_test.go | 2 +- pkg/kubelet/container/BUILD | 2 +- pkg/kubelet/container/runtime.go | 2 +- pkg/kubelet/container/testing/BUILD | 2 +- pkg/kubelet/container/testing/fake_runtime.go | 2 +- pkg/kubelet/container/testing/runtime_mock.go | 2 +- pkg/kubelet/dockershim/BUILD | 2 +- pkg/kubelet/dockershim/docker_service_test.go | 2 +- pkg/kubelet/dockertools/BUILD | 8 +- pkg/kubelet/dockertools/docker_manager.go | 2 +- .../dockertools/docker_manager_test.go | 4 +- pkg/kubelet/dockertools/fake_docker_client.go | 2 +- pkg/kubelet/dockertools/fake_manager.go | 2 +- pkg/kubelet/eviction/BUILD | 4 +- pkg/kubelet/eviction/eviction_manager.go | 2 +- pkg/kubelet/eviction/eviction_manager_test.go | 2 +- pkg/kubelet/images/BUILD | 6 +- pkg/kubelet/images/helpers.go | 2 +- pkg/kubelet/images/image_gc_manager_test.go | 2 +- pkg/kubelet/images/image_manager.go | 2 +- pkg/kubelet/images/image_manager_test.go | 4 +- pkg/kubelet/kubelet.go | 6 +- pkg/kubelet/kubelet_test.go | 4 +- pkg/kubelet/kuberuntime/BUILD | 4 +- .../kuberuntime/fake_kuberuntime_manager.go | 2 +- .../kuberuntime/kuberuntime_manager.go | 2 +- .../kuberuntime/kuberuntime_manager_test.go | 2 +- pkg/kubelet/pleg/BUILD | 4 +- pkg/kubelet/pleg/generic.go | 2 +- pkg/kubelet/pleg/generic_test.go | 2 +- pkg/kubelet/pod_workers_test.go | 2 +- pkg/kubelet/rkt/BUILD | 2 +- pkg/kubelet/rkt/rkt.go | 2 +- pkg/kubelet/runonce_test.go | 2 +- pkg/kubelet/server/streaming/BUILD | 2 +- pkg/kubelet/server/streaming/request_cache.go | 2 +- pkg/kubelet/util/cache/BUILD | 2 +- pkg/kubelet/util/cache/object_cache_test.go | 2 +- pkg/kubelet/util/queue/BUILD | 4 +- pkg/kubelet/util/queue/work_queue.go | 2 +- pkg/kubelet/util/queue/work_queue_test.go | 2 +- pkg/master/tunneler/BUILD | 4 +- pkg/master/tunneler/ssh.go | 2 +- pkg/master/tunneler/ssh_test.go | 2 +- pkg/proxy/iptables/BUILD | 2 +- pkg/proxy/iptables/proxier.go | 2 +- pkg/storage/BUILD | 4 +- pkg/storage/watch_cache.go | 2 +- pkg/storage/watch_cache_test.go | 2 +- pkg/util/BUILD | 3 - pkg/util/clock/BUILD | 35 --- pkg/util/clock/clock.go | 218 ---------------- pkg/util/clock/clock_test.go | 184 ------------- pkg/util/flowcontrol/BUILD | 47 ---- pkg/util/flowcontrol/backoff.go | 149 ----------- pkg/util/flowcontrol/backoff_test.go | 195 -------------- pkg/util/flowcontrol/throttle.go | 132 ---------- pkg/util/flowcontrol/throttle_test.go | 177 ------------- pkg/util/integer/BUILD | 35 --- pkg/util/integer/integer.go | 67 ----- pkg/util/integer/integer_test.go | 244 ------------------ pkg/util/metrics/BUILD | 2 +- pkg/util/metrics/util.go | 2 +- pkg/util/workqueue/BUILD | 4 +- pkg/util/workqueue/delaying_queue.go | 2 +- pkg/util/workqueue/delaying_queue_test.go | 2 +- .../workqueue/rate_limitting_queue_test.go | 2 +- .../pkg/admission/namespace/lifecycle/BUILD | 4 +- .../namespace/lifecycle/admission.go | 2 +- .../namespace/lifecycle/admission_test.go | 2 +- staging/copy.sh | 3 + .../pkg/util/cache/lruexpirecache_test.go | 2 +- test/e2e/BUILD | 2 +- test/e2e/service_latency.go | 2 +- vendor/BUILD | 81 +----- 153 files changed, 176 insertions(+), 1738 deletions(-) delete mode 100644 pkg/util/clock/BUILD delete mode 100644 pkg/util/clock/clock.go delete mode 100644 pkg/util/clock/clock_test.go delete mode 100644 pkg/util/flowcontrol/BUILD delete mode 100644 pkg/util/flowcontrol/backoff.go delete mode 100644 pkg/util/flowcontrol/backoff_test.go delete mode 100644 pkg/util/flowcontrol/throttle.go delete mode 100644 pkg/util/flowcontrol/throttle_test.go delete mode 100644 pkg/util/integer/BUILD delete mode 100644 pkg/util/integer/integer.go delete mode 100644 pkg/util/integer/integer_test.go diff --git a/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/BUILD b/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/BUILD index bde00c5780..548c6c62d4 100644 --- a/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/BUILD +++ b/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/BUILD @@ -18,9 +18,9 @@ go_library( "//cmd/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1alpha1:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/clientset.go b/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/clientset.go index 6195f1084b..bf9bf30fff 100644 --- a/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/clientset.go +++ b/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/clientset.go @@ -18,10 +18,10 @@ package clientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" v1alpha1apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1alpha1" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/BUILD b/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/BUILD index a59b5d53c3..9fa54a7080 100644 --- a/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/BUILD +++ b/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/BUILD @@ -18,9 +18,9 @@ go_library( "//cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/typed/apiregistration/internalversion:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/clientset.go b/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/clientset.go index 64a53e67fd..b4eaefcd50 100644 --- a/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/clientset.go +++ b/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/clientset.go @@ -18,10 +18,10 @@ package internalclientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" internalversionapiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/client/clientset_generated/internalclientset/typed/apiregistration/internalversion" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/cmd/libs/go2idl/client-gen/generators/generator_for_clientset.go b/cmd/libs/go2idl/client-gen/generators/generator_for_clientset.go index fc33fb6147..7b79045943 100644 --- a/cmd/libs/go2idl/client-gen/generators/generator_for_clientset.go +++ b/cmd/libs/go2idl/client-gen/generators/generator_for_clientset.go @@ -62,7 +62,7 @@ func (g *genClientset) Imports(c *generator.Context) (imports []string) { } } imports = append(imports, "github.com/golang/glog") - imports = append(imports, "k8s.io/kubernetes/pkg/util/flowcontrol") + imports = append(imports, "k8s.io/client-go/pkg/util/flowcontrol") // import solely to initialize client auth plugins. imports = append(imports, "_ \"k8s.io/kubernetes/plugin/pkg/client/auth\"") return diff --git a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/BUILD b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/BUILD index 2d14abf54f..f9b085a23c 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/BUILD +++ b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/BUILD @@ -19,9 +19,9 @@ go_library( "//cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup/internalversion:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) @@ -32,7 +32,7 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/client/restclient:go_default_library", - "//pkg/util/flowcontrol:go_default_library", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset.go b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset.go index 34c4b9a933..8486aa869a 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset.go +++ b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset.go @@ -18,10 +18,10 @@ package test_internalclientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" internalversiontestgroup "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup/internalversion" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset_test.go b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset_test.go index e6558f2bd7..7a2c394a9f 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset_test.go +++ b/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/clientset_test.go @@ -19,8 +19,8 @@ package test_internalclientset import ( "testing" + "k8s.io/client-go/pkg/util/flowcontrol" restclient "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) func ClientSetRateLimiterTest(t *testing.T) { diff --git a/federation/client/clientset_generated/federation_clientset/BUILD b/federation/client/clientset_generated/federation_clientset/BUILD index b342b923c3..a9cb8d00a8 100644 --- a/federation/client/clientset_generated/federation_clientset/BUILD +++ b/federation/client/clientset_generated/federation_clientset/BUILD @@ -23,9 +23,9 @@ go_library( "//federation/client/clientset_generated/federation_clientset/typed/federation/v1beta1:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/client/clientset_generated/federation_clientset/clientset.go b/federation/client/clientset_generated/federation_clientset/clientset.go index b9f91ba56d..569efda9f0 100644 --- a/federation/client/clientset_generated/federation_clientset/clientset.go +++ b/federation/client/clientset_generated/federation_clientset/clientset.go @@ -18,13 +18,13 @@ package federation_clientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" v1batch "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/typed/batch/v1" v1core "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/typed/core/v1" v1beta1extensions "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/typed/extensions/v1beta1" v1beta1federation "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/typed/federation/v1beta1" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/federation/client/clientset_generated/federation_internalclientset/BUILD b/federation/client/clientset_generated/federation_internalclientset/BUILD index 964d13dfe0..8c602ac66a 100644 --- a/federation/client/clientset_generated/federation_internalclientset/BUILD +++ b/federation/client/clientset_generated/federation_internalclientset/BUILD @@ -23,9 +23,9 @@ go_library( "//federation/client/clientset_generated/federation_internalclientset/typed/federation/internalversion:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/client/clientset_generated/federation_internalclientset/clientset.go b/federation/client/clientset_generated/federation_internalclientset/clientset.go index 6d9bb063e6..59040401cd 100644 --- a/federation/client/clientset_generated/federation_internalclientset/clientset.go +++ b/federation/client/clientset_generated/federation_internalclientset/clientset.go @@ -18,13 +18,13 @@ package federation_internalclientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" internalversionbatch "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/batch/internalversion" internalversioncore "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/core/internalversion" internalversionextensions "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/extensions/internalversion" internalversionfederation "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset/typed/federation/internalversion" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/federation/pkg/federation-controller/configmap/BUILD b/federation/pkg/federation-controller/configmap/BUILD index 39ebbfbaf0..935c1d6665 100644 --- a/federation/pkg/federation-controller/configmap/BUILD +++ b/federation/pkg/federation-controller/configmap/BUILD @@ -23,11 +23,11 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/configmap/configmap_controller.go b/federation/pkg/federation-controller/configmap/configmap_controller.go index 7424a61f1e..e0d0d04abc 100644 --- a/federation/pkg/federation-controller/configmap/configmap_controller.go +++ b/federation/pkg/federation-controller/configmap/configmap_controller.go @@ -22,6 +22,7 @@ import ( pkgruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -32,7 +33,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/federation/pkg/federation-controller/daemonset/BUILD b/federation/pkg/federation-controller/daemonset/BUILD index eff72f9075..3fa647990c 100644 --- a/federation/pkg/federation-controller/daemonset/BUILD +++ b/federation/pkg/federation-controller/daemonset/BUILD @@ -25,12 +25,12 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/daemonset/daemonset_controller.go b/federation/pkg/federation-controller/daemonset/daemonset_controller.go index 540105a69c..b5ada4daa7 100644 --- a/federation/pkg/federation-controller/daemonset/daemonset_controller.go +++ b/federation/pkg/federation-controller/daemonset/daemonset_controller.go @@ -25,6 +25,7 @@ import ( pkgruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -37,7 +38,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/federation/pkg/federation-controller/deployment/BUILD b/federation/pkg/federation-controller/deployment/BUILD index eeae690555..ef6445c53b 100644 --- a/federation/pkg/federation-controller/deployment/BUILD +++ b/federation/pkg/federation-controller/deployment/BUILD @@ -28,13 +28,13 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/workqueue:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/deployment/deploymentcontroller.go b/federation/pkg/federation-controller/deployment/deploymentcontroller.go index ae9b652e93..de16b9b2f4 100644 --- a/federation/pkg/federation-controller/deployment/deploymentcontroller.go +++ b/federation/pkg/federation-controller/deployment/deploymentcontroller.go @@ -29,6 +29,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" fed "k8s.io/kubernetes/federation/apis/federation" fedv1 "k8s.io/kubernetes/federation/apis/federation/v1beta1" fedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" @@ -44,7 +45,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/workqueue" ) diff --git a/federation/pkg/federation-controller/ingress/BUILD b/federation/pkg/federation-controller/ingress/BUILD index 890d6b7d92..5ecde2a4b4 100644 --- a/federation/pkg/federation-controller/ingress/BUILD +++ b/federation/pkg/federation-controller/ingress/BUILD @@ -25,7 +25,6 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", @@ -33,6 +32,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/runtime/schema", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/ingress/ingress_controller.go b/federation/pkg/federation-controller/ingress/ingress_controller.go index d20e040dfe..a76caa0170 100644 --- a/federation/pkg/federation-controller/ingress/ingress_controller.go +++ b/federation/pkg/federation-controller/ingress/ingress_controller.go @@ -27,6 +27,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -39,7 +40,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/federation/pkg/federation-controller/namespace/BUILD b/federation/pkg/federation-controller/namespace/BUILD index 9ee3f79c28..2607e5e179 100644 --- a/federation/pkg/federation-controller/namespace/BUILD +++ b/federation/pkg/federation-controller/namespace/BUILD @@ -24,11 +24,11 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/namespace/namespace_controller.go b/federation/pkg/federation-controller/namespace/namespace_controller.go index 58f543cbed..6671a2906f 100644 --- a/federation/pkg/federation-controller/namespace/namespace_controller.go +++ b/federation/pkg/federation-controller/namespace/namespace_controller.go @@ -23,6 +23,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -34,7 +35,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/federation/pkg/federation-controller/replicaset/BUILD b/federation/pkg/federation-controller/replicaset/BUILD index d369c378de..a7fc086ea2 100644 --- a/federation/pkg/federation-controller/replicaset/BUILD +++ b/federation/pkg/federation-controller/replicaset/BUILD @@ -28,13 +28,13 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/workqueue:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/replicaset/replicasetcontroller.go b/federation/pkg/federation-controller/replicaset/replicasetcontroller.go index f7811f7043..101a758a37 100644 --- a/federation/pkg/federation-controller/replicaset/replicasetcontroller.go +++ b/federation/pkg/federation-controller/replicaset/replicasetcontroller.go @@ -29,6 +29,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" fed "k8s.io/kubernetes/federation/apis/federation" fedv1 "k8s.io/kubernetes/federation/apis/federation/v1beta1" fedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" @@ -44,7 +45,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/workqueue" ) diff --git a/federation/pkg/federation-controller/secret/BUILD b/federation/pkg/federation-controller/secret/BUILD index 72d72d4686..a2177d44b2 100644 --- a/federation/pkg/federation-controller/secret/BUILD +++ b/federation/pkg/federation-controller/secret/BUILD @@ -24,12 +24,12 @@ go_library( "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/record:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/federation/pkg/federation-controller/secret/secret_controller.go b/federation/pkg/federation-controller/secret/secret_controller.go index e507c6986d..339a0660d8 100644 --- a/federation/pkg/federation-controller/secret/secret_controller.go +++ b/federation/pkg/federation-controller/secret/secret_controller.go @@ -24,6 +24,7 @@ import ( pkgruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" "k8s.io/kubernetes/federation/pkg/federation-controller/util" @@ -35,7 +36,6 @@ import ( kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/federation/pkg/federation-controller/util/BUILD b/federation/pkg/federation-controller/util/BUILD index 45da0b55ba..e2a8b023b4 100644 --- a/federation/pkg/federation-controller/util/BUILD +++ b/federation/pkg/federation-controller/util/BUILD @@ -36,13 +36,13 @@ go_library( "//pkg/client/restclient:go_default_library", "//pkg/client/unversioned/clientcmd:go_default_library", "//pkg/controller/deployment/util:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", "//vendor:k8s.io/client-go/tools/clientcmd/api", ], ) diff --git a/federation/pkg/federation-controller/util/backoff.go b/federation/pkg/federation-controller/util/backoff.go index ff18e8be9a..29084fd931 100644 --- a/federation/pkg/federation-controller/util/backoff.go +++ b/federation/pkg/federation-controller/util/backoff.go @@ -19,7 +19,7 @@ package util import ( "time" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" ) func StartBackoffGC(backoff *flowcontrol.Backoff, stopCh <-chan struct{}) { diff --git a/pkg/client/cache/BUILD b/pkg/client/cache/BUILD index a1182dd28f..d86eba393e 100644 --- a/pkg/client/cache/BUILD +++ b/pkg/client/cache/BUILD @@ -45,7 +45,6 @@ go_library( "//pkg/apis/storage/v1beta1:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/fields:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/api/meta", @@ -58,6 +57,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -88,7 +88,6 @@ go_test( "//pkg/client/restclient:go_default_library", "//pkg/client/testing/cache:go_default_library", "//pkg/fields:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/testing:go_default_library", "//vendor:github.com/google/gofuzz", "//vendor:k8s.io/apimachinery/pkg/api/errors", @@ -98,6 +97,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/client/cache/expiration_cache.go b/pkg/client/cache/expiration_cache.go index 88ef89b3ee..10d68c533a 100644 --- a/pkg/client/cache/expiration_cache.go +++ b/pkg/client/cache/expiration_cache.go @@ -21,7 +21,7 @@ import ( "time" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) // ExpirationCache implements the store interface diff --git a/pkg/client/cache/expiration_cache_fakes.go b/pkg/client/cache/expiration_cache_fakes.go index 7f5b81f244..e4d4063c44 100644 --- a/pkg/client/cache/expiration_cache_fakes.go +++ b/pkg/client/cache/expiration_cache_fakes.go @@ -18,7 +18,7 @@ package cache import ( "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) type fakeThreadSafeMap struct { diff --git a/pkg/client/cache/expiration_cache_test.go b/pkg/client/cache/expiration_cache_test.go index c2cae09198..0938e9fc12 100644 --- a/pkg/client/cache/expiration_cache_test.go +++ b/pkg/client/cache/expiration_cache_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) func TestTTLExpirationBasic(t *testing.T) { diff --git a/pkg/client/clientset_generated/clientset/BUILD b/pkg/client/clientset_generated/clientset/BUILD index e6548cc9b6..e83b132bce 100644 --- a/pkg/client/clientset_generated/clientset/BUILD +++ b/pkg/client/clientset_generated/clientset/BUILD @@ -43,9 +43,9 @@ go_library( "//pkg/client/clientset_generated/clientset/typed/storage/v1beta1:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/client/clientset_generated/clientset/clientset.go b/pkg/client/clientset_generated/clientset/clientset.go index 7326a4fc7d..541a070ec3 100644 --- a/pkg/client/clientset_generated/clientset/clientset.go +++ b/pkg/client/clientset_generated/clientset/clientset.go @@ -18,6 +18,7 @@ package clientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" v1beta1apps "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/apps/v1beta1" v1beta1authentication "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authentication/v1beta1" v1beta1authorization "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/authorization/v1beta1" @@ -33,7 +34,6 @@ import ( v1beta1storage "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/storage/v1beta1" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/pkg/client/clientset_generated/internalclientset/BUILD b/pkg/client/clientset_generated/internalclientset/BUILD index e6f83b05e1..7446d5cf62 100644 --- a/pkg/client/clientset_generated/internalclientset/BUILD +++ b/pkg/client/clientset_generated/internalclientset/BUILD @@ -42,9 +42,9 @@ go_library( "//pkg/client/clientset_generated/internalclientset/typed/storage/internalversion:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/client/typed/discovery:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//plugin/pkg/client/auth:go_default_library", "//vendor:github.com/golang/glog", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/client/clientset_generated/internalclientset/clientset.go b/pkg/client/clientset_generated/internalclientset/clientset.go index 985eb1f054..91aa5ebef2 100644 --- a/pkg/client/clientset_generated/internalclientset/clientset.go +++ b/pkg/client/clientset_generated/internalclientset/clientset.go @@ -18,6 +18,7 @@ package internalclientset import ( "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" internalversionapps "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion" internalversionauthentication "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion" internalversionauthorization "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion" @@ -31,7 +32,6 @@ import ( internalversionstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/internalversion" restclient "k8s.io/kubernetes/pkg/client/restclient" discovery "k8s.io/kubernetes/pkg/client/typed/discovery" - "k8s.io/kubernetes/pkg/util/flowcontrol" _ "k8s.io/kubernetes/plugin/pkg/client/auth" ) diff --git a/pkg/client/record/BUILD b/pkg/client/record/BUILD index 1f58063a7a..9f2dca8de8 100644 --- a/pkg/client/record/BUILD +++ b/pkg/client/record/BUILD @@ -20,7 +20,6 @@ go_library( deps = [ "//pkg/api/v1:go_default_library", "//pkg/client/restclient:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/strategicpatch:go_default_library", "//vendor:github.com/golang/glog", "//vendor:github.com/golang/groupcache/lru", @@ -30,6 +29,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -45,12 +45,12 @@ go_test( "//pkg/api/install:go_default_library", "//pkg/api/v1:go_default_library", "//pkg/client/restclient:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/strategicpatch:go_default_library", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/diff", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/client/record/event.go b/pkg/client/record/event.go index 6fef483676..85eae35ec4 100644 --- a/pkg/client/record/event.go +++ b/pkg/client/record/event.go @@ -26,9 +26,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/clock" "net/http" diff --git a/pkg/client/record/event_test.go b/pkg/client/record/event_test.go index 34d32dafa4..01faca26fc 100644 --- a/pkg/client/record/event_test.go +++ b/pkg/client/record/event_test.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/pkg/util/clock" _ "k8s.io/kubernetes/pkg/api/install" // To register api.Pod used in tests below "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/clock" "k8s.io/kubernetes/pkg/util/strategicpatch" ) diff --git a/pkg/client/record/events_cache.go b/pkg/client/record/events_cache.go index 09ea3dcbec..ab7df3fef6 100644 --- a/pkg/client/record/events_cache.go +++ b/pkg/client/record/events_cache.go @@ -27,8 +27,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" - "k8s.io/kubernetes/pkg/util/clock" "k8s.io/kubernetes/pkg/util/strategicpatch" ) diff --git a/pkg/client/record/events_cache_test.go b/pkg/client/record/events_cache_test.go index 966ba09d23..bf0e4e0be8 100644 --- a/pkg/client/record/events_cache_test.go +++ b/pkg/client/record/events_cache_test.go @@ -24,8 +24,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/diff" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" - "k8s.io/kubernetes/pkg/util/clock" ) func makeObjectReference(kind, name, namespace string) v1.ObjectReference { diff --git a/pkg/client/restclient/BUILD b/pkg/client/restclient/BUILD index 536ebd1726..1c6ec070b9 100644 --- a/pkg/client/restclient/BUILD +++ b/pkg/client/restclient/BUILD @@ -28,7 +28,6 @@ go_library( "//pkg/client/metrics:go_default_library", "//pkg/fields:go_default_library", "//pkg/util/cert:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/version:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", @@ -41,6 +40,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/net", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", "//vendor:k8s.io/client-go/rest/watch", "//vendor:k8s.io/client-go/tools/clientcmd/api", "//vendor:k8s.io/client-go/transport", @@ -63,8 +63,6 @@ go_test( "//pkg/api:go_default_library", "//pkg/api/testapi:go_default_library", "//pkg/api/v1:go_default_library", - "//pkg/util/clock:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/httpstream:go_default_library", "//pkg/util/intstr:go_default_library", "//pkg/util/testing:go_default_library", @@ -78,6 +76,8 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/diff", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", "//vendor:k8s.io/client-go/rest/watch", "//vendor:k8s.io/client-go/tools/clientcmd/api", ], diff --git a/pkg/client/restclient/client.go b/pkg/client/restclient/client.go index 88653e6837..141e08e92b 100644 --- a/pkg/client/restclient/client.go +++ b/pkg/client/restclient/client.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" ) const ( diff --git a/pkg/client/restclient/config.go b/pkg/client/restclient/config.go index 71591a4826..1e6a992df1 100644 --- a/pkg/client/restclient/config.go +++ b/pkg/client/restclient/config.go @@ -32,10 +32,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/pkg/util/flowcontrol" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" certutil "k8s.io/kubernetes/pkg/util/cert" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/version" ) diff --git a/pkg/client/restclient/config_test.go b/pkg/client/restclient/config_test.go index d53c2783d5..5cdb36b67f 100644 --- a/pkg/client/restclient/config_test.go +++ b/pkg/client/restclient/config_test.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/diff" + "k8s.io/client-go/pkg/util/flowcontrol" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) func TestIsConfigTransportTLS(t *testing.T) { diff --git a/pkg/client/restclient/fake/BUILD b/pkg/client/restclient/fake/BUILD index 122f578008..324f19efc6 100644 --- a/pkg/client/restclient/fake/BUILD +++ b/pkg/client/restclient/fake/BUILD @@ -15,10 +15,10 @@ go_library( "//pkg/api:go_default_library", "//pkg/api/testapi:go_default_library", "//pkg/client/restclient:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime/schema", "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/client/restclient/fake/fake.go b/pkg/client/restclient/fake/fake.go index 4418e26c7e..8fb4a9cbd4 100644 --- a/pkg/client/restclient/fake/fake.go +++ b/pkg/client/restclient/fake/fake.go @@ -25,10 +25,10 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) func CreateHTTPClient(roundTripper func(*http.Request) (*http.Response, error)) *http.Client { diff --git a/pkg/client/restclient/request.go b/pkg/client/restclient/request.go index 7edbac605a..cbecaedef4 100644 --- a/pkg/client/restclient/request.go +++ b/pkg/client/restclient/request.go @@ -42,12 +42,12 @@ import ( "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api/v1" pathvalidation "k8s.io/kubernetes/pkg/api/validation/path" "k8s.io/kubernetes/pkg/client/metrics" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) var ( diff --git a/pkg/client/restclient/request_test.go b/pkg/client/restclient/request_test.go index d4c00d8f7d..5be8c855ea 100755 --- a/pkg/client/restclient/request_test.go +++ b/pkg/client/restclient/request_test.go @@ -42,12 +42,12 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/flowcontrol" restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/v1" - "k8s.io/kubernetes/pkg/util/clock" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/httpstream" "k8s.io/kubernetes/pkg/util/intstr" utiltesting "k8s.io/kubernetes/pkg/util/testing" diff --git a/pkg/client/restclient/urlbackoff.go b/pkg/client/restclient/urlbackoff.go index 595f22c41a..246c70acc9 100644 --- a/pkg/client/restclient/urlbackoff.go +++ b/pkg/client/restclient/urlbackoff.go @@ -22,7 +22,7 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" ) // Set of resp. Codes that we backoff for. diff --git a/pkg/client/restclient/urlbackoff_test.go b/pkg/client/restclient/urlbackoff_test.go index 269f3536e0..0c4d963816 100644 --- a/pkg/client/restclient/urlbackoff_test.go +++ b/pkg/client/restclient/urlbackoff_test.go @@ -21,7 +21,7 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" ) func parse(raw string) *url.URL { diff --git a/pkg/client/typed/dynamic/BUILD b/pkg/client/typed/dynamic/BUILD index 639c59a4bd..d88846e2e8 100644 --- a/pkg/client/typed/dynamic/BUILD +++ b/pkg/client/typed/dynamic/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/api:go_default_library", "//pkg/api/v1:go_default_library", "//pkg/client/restclient:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:k8s.io/apimachinery/pkg/api/meta", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", @@ -30,6 +29,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/runtime/serializer", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/client/typed/dynamic/client.go b/pkg/client/typed/dynamic/client.go index 8bcd4df08e..d2601003f9 100644 --- a/pkg/client/typed/dynamic/client.go +++ b/pkg/client/typed/dynamic/client.go @@ -34,10 +34,10 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) // Client is a Kubernetes client that allows you to access metadata diff --git a/pkg/cloudprovider/providers/gce/BUILD b/pkg/cloudprovider/providers/gce/BUILD index 677e771b87..5d0b35183a 100644 --- a/pkg/cloudprovider/providers/gce/BUILD +++ b/pkg/cloudprovider/providers/gce/BUILD @@ -20,7 +20,6 @@ go_library( "//pkg/api/v1:go_default_library", "//pkg/api/v1/service:go_default_library", "//pkg/cloudprovider:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/net/sets:go_default_library", "//pkg/volume:go_default_library", "//vendor:cloud.google.com/go/compute/metadata", @@ -37,6 +36,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/cloudprovider/providers/gce/gce.go b/pkg/cloudprovider/providers/gce/gce.go index 14d53f9e6a..9b3424f849 100644 --- a/pkg/cloudprovider/providers/gce/gce.go +++ b/pkg/cloudprovider/providers/gce/gce.go @@ -35,10 +35,10 @@ import ( utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" apiservice "k8s.io/kubernetes/pkg/api/v1/service" "k8s.io/kubernetes/pkg/cloudprovider" - "k8s.io/kubernetes/pkg/util/flowcontrol" netsets "k8s.io/kubernetes/pkg/util/net/sets" "k8s.io/kubernetes/pkg/volume" diff --git a/pkg/cloudprovider/providers/gce/token_source.go b/pkg/cloudprovider/providers/gce/token_source.go index a30cae577c..3caf054653 100644 --- a/pkg/cloudprovider/providers/gce/token_source.go +++ b/pkg/cloudprovider/providers/gce/token_source.go @@ -22,7 +22,7 @@ import ( "strings" "time" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" "github.com/prometheus/client_golang/prometheus" "golang.org/x/oauth2" diff --git a/pkg/controller/BUILD b/pkg/controller/BUILD index ebac5b88aa..ff269d5428 100644 --- a/pkg/controller/BUILD +++ b/pkg/controller/BUILD @@ -30,9 +30,7 @@ go_library( "//pkg/client/restclient:go_default_library", "//pkg/fields:go_default_library", "//pkg/serviceaccount:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/hash:go_default_library", - "//pkg/util/integer:go_default_library", "//vendor:github.com/golang/glog", "//vendor:github.com/golang/groupcache/lru", "//vendor:k8s.io/apimachinery/pkg/api/errors", @@ -45,6 +43,8 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", "//vendor:k8s.io/apiserver/pkg/authentication/serviceaccount", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/integer", ], ) @@ -62,12 +62,12 @@ go_test( "//pkg/client/record:go_default_library", "//pkg/client/restclient:go_default_library", "//pkg/securitycontext:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/testing:go_default_library", "//pkg/util/uuid:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/controller/controller_utils.go b/pkg/controller/controller_utils.go index 852fa0e5ef..9d484b4e25 100644 --- a/pkg/controller/controller_utils.go +++ b/pkg/controller/controller_utils.go @@ -30,6 +30,8 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/integer" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/validation" @@ -37,8 +39,6 @@ import ( "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/client/record" - "k8s.io/kubernetes/pkg/util/clock" - "k8s.io/kubernetes/pkg/util/integer" ) const ( diff --git a/pkg/controller/controller_utils_test.go b/pkg/controller/controller_utils_test.go index 007a50a5bd..b4c70489aa 100644 --- a/pkg/controller/controller_utils_test.go +++ b/pkg/controller/controller_utils_test.go @@ -30,6 +30,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/v1" @@ -38,7 +39,6 @@ import ( "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/securitycontext" - "k8s.io/kubernetes/pkg/util/clock" utiltesting "k8s.io/kubernetes/pkg/util/testing" "k8s.io/kubernetes/pkg/util/uuid" ) diff --git a/pkg/controller/deployment/BUILD b/pkg/controller/deployment/BUILD index 3ce7d4e2f8..6804394e71 100644 --- a/pkg/controller/deployment/BUILD +++ b/pkg/controller/deployment/BUILD @@ -30,7 +30,6 @@ go_library( "//pkg/controller:go_default_library", "//pkg/controller/deployment/util:go_default_library", "//pkg/controller/informers:go_default_library", - "//pkg/util/integer:go_default_library", "//pkg/util/labels:go_default_library", "//pkg/util/metrics:go_default_library", "//pkg/util/workqueue:go_default_library", @@ -42,6 +41,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/integer", ], ) diff --git a/pkg/controller/deployment/rolling.go b/pkg/controller/deployment/rolling.go index d6ddf9da8c..2cacc6be7d 100644 --- a/pkg/controller/deployment/rolling.go +++ b/pkg/controller/deployment/rolling.go @@ -21,10 +21,10 @@ import ( "sort" "github.com/golang/glog" + "k8s.io/client-go/pkg/util/integer" extensions "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/controller" deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util" - "k8s.io/kubernetes/pkg/util/integer" ) // rolloutRolling implements the logic for rolling a new replica set. diff --git a/pkg/controller/deployment/util/BUILD b/pkg/controller/deployment/util/BUILD index 3a8961b636..ca64818d04 100644 --- a/pkg/controller/deployment/util/BUILD +++ b/pkg/controller/deployment/util/BUILD @@ -29,7 +29,6 @@ go_library( "//pkg/client/retry:go_default_library", "//pkg/controller:go_default_library", "//pkg/util/hash:go_default_library", - "//pkg/util/integer:go_default_library", "//pkg/util/intstr:go_default_library", "//pkg/util/labels:go_default_library", "//vendor:github.com/golang/glog", @@ -39,6 +38,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/integer", ], ) diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index 9fe963a914..52f88b3246 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -31,6 +31,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/integer" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/annotations" "k8s.io/kubernetes/pkg/api/v1" @@ -39,7 +40,6 @@ import ( "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset" "k8s.io/kubernetes/pkg/controller" - "k8s.io/kubernetes/pkg/util/integer" intstrutil "k8s.io/kubernetes/pkg/util/intstr" labelsutil "k8s.io/kubernetes/pkg/util/labels" ) diff --git a/pkg/controller/garbagecollector/BUILD b/pkg/controller/garbagecollector/BUILD index 90063a18a9..c80addae2a 100644 --- a/pkg/controller/garbagecollector/BUILD +++ b/pkg/controller/garbagecollector/BUILD @@ -22,7 +22,6 @@ go_library( "//pkg/client/cache:go_default_library", "//pkg/client/typed/dynamic:go_default_library", "//pkg/controller/garbagecollector/metaonly:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/metrics:go_default_library", "//pkg/util/workqueue:go_default_library", "//vendor:github.com/golang/glog", @@ -40,6 +39,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -55,7 +55,6 @@ go_test( "//pkg/client/restclient:go_default_library", "//pkg/client/typed/dynamic:go_default_library", "//pkg/controller/garbagecollector/metaonly:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/workqueue:go_default_library", "//vendor:github.com/stretchr/testify/assert", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", @@ -64,6 +63,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/json", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/controller/garbagecollector/garbagecollector.go b/pkg/controller/garbagecollector/garbagecollector.go index 7ecde9e0f1..8a1b679673 100644 --- a/pkg/controller/garbagecollector/garbagecollector.go +++ b/pkg/controller/garbagecollector/garbagecollector.go @@ -35,11 +35,11 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/typed/dynamic" "k8s.io/kubernetes/pkg/controller/garbagecollector/metaonly" - "k8s.io/kubernetes/pkg/util/clock" "k8s.io/kubernetes/pkg/util/workqueue" ) diff --git a/pkg/controller/garbagecollector/garbagecollector_test.go b/pkg/controller/garbagecollector/garbagecollector_test.go index 9e54bf2e0a..830051c930 100644 --- a/pkg/controller/garbagecollector/garbagecollector_test.go +++ b/pkg/controller/garbagecollector/garbagecollector_test.go @@ -33,12 +33,12 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/typed/dynamic" "k8s.io/kubernetes/pkg/controller/garbagecollector/metaonly" - "k8s.io/kubernetes/pkg/util/clock" "k8s.io/kubernetes/pkg/util/workqueue" ) diff --git a/pkg/controller/garbagecollector/metrics.go b/pkg/controller/garbagecollector/metrics.go index af385e0d1e..6b502a9302 100644 --- a/pkg/controller/garbagecollector/metrics.go +++ b/pkg/controller/garbagecollector/metrics.go @@ -20,7 +20,7 @@ import ( "sync" "time" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkg/controller/node/BUILD b/pkg/controller/node/BUILD index c68fe262c4..505a7db4d3 100644 --- a/pkg/controller/node/BUILD +++ b/pkg/controller/node/BUILD @@ -31,7 +31,6 @@ go_library( "//pkg/controller/informers:go_default_library", "//pkg/fields:go_default_library", "//pkg/kubelet/util/format:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/metrics:go_default_library", "//pkg/util/node:go_default_library", "//pkg/util/system:go_default_library", @@ -46,6 +45,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) @@ -73,7 +73,6 @@ go_test( "//pkg/controller:go_default_library", "//pkg/controller/informers:go_default_library", "//pkg/controller/node/testutil:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/node:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", @@ -81,6 +80,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/util/diff", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/controller/node/nodecontroller.go b/pkg/controller/node/nodecontroller.go index 2a2454f728..ee16317a98 100644 --- a/pkg/controller/node/nodecontroller.go +++ b/pkg/controller/node/nodecontroller.go @@ -29,6 +29,7 @@ import ( "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/cache" @@ -38,7 +39,6 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/controller/informers" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/metrics" utilnode "k8s.io/kubernetes/pkg/util/node" "k8s.io/kubernetes/pkg/util/system" diff --git a/pkg/controller/node/rate_limited_queue.go b/pkg/controller/node/rate_limited_queue.go index a335f6f374..560898df8f 100644 --- a/pkg/controller/node/rate_limited_queue.go +++ b/pkg/controller/node/rate_limited_queue.go @@ -22,7 +22,7 @@ import ( "time" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" "github.com/golang/glog" ) diff --git a/pkg/controller/node/rate_limited_queue_test.go b/pkg/controller/node/rate_limited_queue_test.go index 5218f31ca1..7de22c1b99 100644 --- a/pkg/controller/node/rate_limited_queue_test.go +++ b/pkg/controller/node/rate_limited_queue_test.go @@ -22,7 +22,7 @@ import ( "time" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" ) func CheckQueueEq(lhs []string, rhs TimedQueue) bool { diff --git a/pkg/controller/node/testutil/BUILD b/pkg/controller/node/testutil/BUILD index ba0f86af96..5ec7c42561 100644 --- a/pkg/controller/node/testutil/BUILD +++ b/pkg/controller/node/testutil/BUILD @@ -17,7 +17,6 @@ go_library( "//pkg/api/v1:go_default_library", "//pkg/client/clientset_generated/clientset/fake:go_default_library", "//pkg/client/clientset_generated/clientset/typed/core/v1:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/node:go_default_library", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", @@ -25,6 +24,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/controller/node/testutil/test_utils.go b/pkg/controller/node/testutil/test_utils.go index 2a762c57e4..c78cc8442c 100644 --- a/pkg/controller/node/testutil/test_utils.go +++ b/pkg/controller/node/testutil/test_utils.go @@ -28,12 +28,12 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake" v1core "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/core/v1" - "k8s.io/kubernetes/pkg/util/clock" utilnode "k8s.io/kubernetes/pkg/util/node" ) diff --git a/pkg/kubectl/BUILD b/pkg/kubectl/BUILD index 9b53cec848..e56df83de7 100644 --- a/pkg/kubectl/BUILD +++ b/pkg/kubectl/BUILD @@ -88,7 +88,6 @@ go_library( "//pkg/kubectl/resource:go_default_library", "//pkg/kubelet/qos:go_default_library", "//pkg/util:go_default_library", - "//pkg/util/integer:go_default_library", "//pkg/util/intstr:go_default_library", "//pkg/util/jsonpath:go_default_library", "//pkg/util/node:go_default_library", @@ -112,6 +111,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/validation", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/integer", ], ) diff --git a/pkg/kubectl/rolling_updater.go b/pkg/kubectl/rolling_updater.go index 0f703e5c20..f782cb2605 100644 --- a/pkg/kubectl/rolling_updater.go +++ b/pkg/kubectl/rolling_updater.go @@ -29,13 +29,13 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/integer" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" "k8s.io/kubernetes/pkg/client/retry" client "k8s.io/kubernetes/pkg/client/unversioned" deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util" - "k8s.io/kubernetes/pkg/util/integer" "k8s.io/kubernetes/pkg/util/intstr" ) diff --git a/pkg/kubectl/sorting_printer.go b/pkg/kubectl/sorting_printer.go index 2219b22178..7c7d0295a6 100644 --- a/pkg/kubectl/sorting_printer.go +++ b/pkg/kubectl/sorting_printer.go @@ -28,8 +28,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/pkg/util/integer" "k8s.io/kubernetes/pkg/api/v1" - "k8s.io/kubernetes/pkg/util/integer" "k8s.io/kubernetes/pkg/util/jsonpath" ) diff --git a/pkg/kubelet/BUILD b/pkg/kubelet/BUILD index ca82778561..ba91b740a2 100644 --- a/pkg/kubelet/BUILD +++ b/pkg/kubelet/BUILD @@ -87,12 +87,9 @@ go_library( "//pkg/securitycontext:go_default_library", "//pkg/util:go_default_library", "//pkg/util/bandwidth:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/config:go_default_library", "//pkg/util/dbus:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", - "//pkg/util/integer:go_default_library", "//pkg/util/io:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/mount:go_default_library", @@ -125,6 +122,9 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/validation/field", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/client-go/kubernetes", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", + "//vendor:k8s.io/client-go/pkg/util/integer", ], ) @@ -181,8 +181,6 @@ go_test( "//pkg/kubelet/util/sliceutils:go_default_library", "//pkg/kubelet/volumemanager:go_default_library", "//pkg/util/bandwidth:go_default_library", - "//pkg/util/clock:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strategicpatch:go_default_library", "//pkg/util/testing:go_default_library", @@ -206,6 +204,8 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/active_deadline.go b/pkg/kubelet/active_deadline.go index 9356f0e31c..2e24c55030 100644 --- a/pkg/kubelet/active_deadline.go +++ b/pkg/kubelet/active_deadline.go @@ -20,11 +20,11 @@ import ( "fmt" "time" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/kubelet/lifecycle" "k8s.io/kubernetes/pkg/kubelet/status" - "k8s.io/kubernetes/pkg/util/clock" ) const ( diff --git a/pkg/kubelet/active_deadline_test.go b/pkg/kubelet/active_deadline_test.go index 77caabe33b..894d99ff06 100644 --- a/pkg/kubelet/active_deadline_test.go +++ b/pkg/kubelet/active_deadline_test.go @@ -22,9 +22,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" - "k8s.io/kubernetes/pkg/util/clock" ) // mockPodStatusProvider returns the status on the specified pod diff --git a/pkg/kubelet/container/BUILD b/pkg/kubelet/container/BUILD index 5abab43a92..ca9c55ff64 100644 --- a/pkg/kubelet/container/BUILD +++ b/pkg/kubelet/container/BUILD @@ -31,7 +31,6 @@ go_library( "//pkg/kubelet/api/v1alpha1/runtime:go_default_library", "//pkg/kubelet/util/format:go_default_library", "//pkg/kubelet/util/ioutils:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/hash:go_default_library", "//pkg/util/term:go_default_library", "//pkg/volume:go_default_library", @@ -43,6 +42,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/runtime", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/container/runtime.go b/pkg/kubelet/container/runtime.go index 5f68e65c15..3a3650dbbe 100644 --- a/pkg/kubelet/container/runtime.go +++ b/pkg/kubelet/container/runtime.go @@ -26,9 +26,9 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" runtimeapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/term" "k8s.io/kubernetes/pkg/volume" ) diff --git a/pkg/kubelet/container/testing/BUILD b/pkg/kubelet/container/testing/BUILD index 9f6f6a753d..514e370d40 100644 --- a/pkg/kubelet/container/testing/BUILD +++ b/pkg/kubelet/container/testing/BUILD @@ -20,12 +20,12 @@ go_library( deps = [ "//pkg/api/v1:go_default_library", "//pkg/kubelet/container:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/term:go_default_library", "//pkg/volume:go_default_library", "//vendor:github.com/golang/mock/gomock", "//vendor:github.com/stretchr/testify/mock", "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/container/testing/fake_runtime.go b/pkg/kubelet/container/testing/fake_runtime.go index f207b54e52..1fcc55ccbd 100644 --- a/pkg/kubelet/container/testing/fake_runtime.go +++ b/pkg/kubelet/container/testing/fake_runtime.go @@ -25,9 +25,9 @@ import ( "time" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" . "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/term" "k8s.io/kubernetes/pkg/volume" ) diff --git a/pkg/kubelet/container/testing/runtime_mock.go b/pkg/kubelet/container/testing/runtime_mock.go index c7dd19733e..32992f5ebb 100644 --- a/pkg/kubelet/container/testing/runtime_mock.go +++ b/pkg/kubelet/container/testing/runtime_mock.go @@ -22,9 +22,9 @@ import ( "github.com/stretchr/testify/mock" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" . "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/term" "k8s.io/kubernetes/pkg/volume" ) diff --git a/pkg/kubelet/dockershim/BUILD b/pkg/kubelet/dockershim/BUILD index f661e0f933..d140d6dabb 100644 --- a/pkg/kubelet/dockershim/BUILD +++ b/pkg/kubelet/dockershim/BUILD @@ -78,12 +78,12 @@ go_test( "//pkg/kubelet/types:go_default_library", "//pkg/security/apparmor:go_default_library", "//pkg/securitycontext:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/docker/engine-api/types", "//vendor:github.com/docker/engine-api/types/container", "//vendor:github.com/golang/mock/gomock", "//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/require", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/dockershim/docker_service_test.go b/pkg/kubelet/dockershim/docker_service_test.go index 127c3ccba2..2450303d65 100644 --- a/pkg/kubelet/dockershim/docker_service_test.go +++ b/pkg/kubelet/dockershim/docker_service_test.go @@ -24,12 +24,12 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "k8s.io/client-go/pkg/util/clock" runtimeapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" containertest "k8s.io/kubernetes/pkg/kubelet/container/testing" "k8s.io/kubernetes/pkg/kubelet/dockertools" "k8s.io/kubernetes/pkg/kubelet/network" "k8s.io/kubernetes/pkg/kubelet/network/mock_network" - "k8s.io/kubernetes/pkg/util/clock" ) // newTestNetworkPlugin returns a mock plugin that implements network.NetworkPlugin diff --git a/pkg/kubelet/dockertools/BUILD b/pkg/kubelet/dockertools/BUILD index 928a2ee19c..d574b11243 100644 --- a/pkg/kubelet/dockertools/BUILD +++ b/pkg/kubelet/dockertools/BUILD @@ -47,9 +47,7 @@ go_library( "//pkg/kubelet/util/format:go_default_library", "//pkg/security/apparmor:go_default_library", "//pkg/securitycontext:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/oom:go_default_library", "//pkg/util/procfs:go_default_library", "//pkg/util/selinux:go_default_library", @@ -76,6 +74,8 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) @@ -116,9 +116,7 @@ go_test( "//pkg/kubelet/types:go_default_library", "//pkg/kubelet/util/format:go_default_library", "//pkg/security/apparmor:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/hash:go_default_library", "//pkg/util/intstr:go_default_library", "//pkg/util/strings:go_default_library", @@ -134,6 +132,8 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/dockertools/docker_manager.go b/pkg/kubelet/dockertools/docker_manager.go index da5cec98b1..5c1ac78e62 100644 --- a/pkg/kubelet/dockertools/docker_manager.go +++ b/pkg/kubelet/dockertools/docker_manager.go @@ -47,6 +47,7 @@ import ( kubetypes "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" @@ -65,7 +66,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/util/format" "k8s.io/kubernetes/pkg/security/apparmor" "k8s.io/kubernetes/pkg/securitycontext" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/oom" "k8s.io/kubernetes/pkg/util/procfs" "k8s.io/kubernetes/pkg/util/selinux" diff --git a/pkg/kubelet/dockertools/docker_manager_test.go b/pkg/kubelet/dockertools/docker_manager_test.go index b02b262053..a72b2676d8 100644 --- a/pkg/kubelet/dockertools/docker_manager_test.go +++ b/pkg/kubelet/dockertools/docker_manager_test.go @@ -40,6 +40,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" kubetypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/v1" @@ -53,9 +55,7 @@ import ( nettest "k8s.io/kubernetes/pkg/kubelet/network/testing" proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results" "k8s.io/kubernetes/pkg/kubelet/types" - "k8s.io/kubernetes/pkg/util/clock" uexec "k8s.io/kubernetes/pkg/util/exec" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/intstr" ) diff --git a/pkg/kubelet/dockertools/fake_docker_client.go b/pkg/kubelet/dockertools/fake_docker_client.go index 25c8b4433c..433df3ba1b 100644 --- a/pkg/kubelet/dockertools/fake_docker_client.go +++ b/pkg/kubelet/dockertools/fake_docker_client.go @@ -28,7 +28,7 @@ import ( dockertypes "github.com/docker/engine-api/types" dockercontainer "github.com/docker/engine-api/types/container" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" ) diff --git a/pkg/kubelet/dockertools/fake_manager.go b/pkg/kubelet/dockertools/fake_manager.go index bff9dcaa0e..e71f102704 100644 --- a/pkg/kubelet/dockertools/fake_manager.go +++ b/pkg/kubelet/dockertools/fake_manager.go @@ -19,6 +19,7 @@ package dockertools import ( cadvisorapi "github.com/google/cadvisor/info/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" @@ -26,7 +27,6 @@ import ( proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/cache" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/oom" "k8s.io/kubernetes/pkg/util/procfs" ) diff --git a/pkg/kubelet/eviction/BUILD b/pkg/kubelet/eviction/BUILD index d84d36eced..7141109e4b 100644 --- a/pkg/kubelet/eviction/BUILD +++ b/pkg/kubelet/eviction/BUILD @@ -33,11 +33,11 @@ go_library( "//pkg/kubelet/types:go_default_library", "//pkg/kubelet/util/format:go_default_library", "//pkg/quota/evaluator/core:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -58,9 +58,9 @@ go_test( "//pkg/kubelet/lifecycle:go_default_library", "//pkg/kubelet/types:go_default_library", "//pkg/quota:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/eviction/eviction_manager.go b/pkg/kubelet/eviction/eviction_manager.go index 1370ca6237..74e71a3dfe 100644 --- a/pkg/kubelet/eviction/eviction_manager.go +++ b/pkg/kubelet/eviction/eviction_manager.go @@ -24,6 +24,7 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" @@ -34,7 +35,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/server/stats" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/format" - "k8s.io/kubernetes/pkg/util/clock" ) // managerImpl implements Manager diff --git a/pkg/kubelet/eviction/eviction_manager_test.go b/pkg/kubelet/eviction/eviction_manager_test.go index fe3322c215..c86cde42d7 100644 --- a/pkg/kubelet/eviction/eviction_manager_test.go +++ b/pkg/kubelet/eviction/eviction_manager_test.go @@ -21,13 +21,13 @@ import ( "time" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" statsapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats" "k8s.io/kubernetes/pkg/kubelet/lifecycle" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" - "k8s.io/kubernetes/pkg/util/clock" ) // mockPodKiller is used to testing which pod is killed diff --git a/pkg/kubelet/images/BUILD b/pkg/kubelet/images/BUILD index e6465a4702..4fd24acb5c 100644 --- a/pkg/kubelet/images/BUILD +++ b/pkg/kubelet/images/BUILD @@ -25,13 +25,13 @@ go_library( "//pkg/kubelet/cadvisor:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/events:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/parsers:go_default_library", "//vendor:github.com/docker/distribution/reference", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) @@ -49,12 +49,12 @@ go_test( "//pkg/kubelet/cadvisor/testing:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/container/testing:go_default_library", - "//pkg/util/clock:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/google/cadvisor/info/v2", "//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/require", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", + "//vendor:k8s.io/client-go/pkg/util/clock", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/images/helpers.go b/pkg/kubelet/images/helpers.go index f7329fba15..d63ebd37b8 100644 --- a/pkg/kubelet/images/helpers.go +++ b/pkg/kubelet/images/helpers.go @@ -19,9 +19,9 @@ package images import ( "fmt" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) // throttleImagePulling wraps kubecontainer.ImageService to throttle image diff --git a/pkg/kubelet/images/image_gc_manager_test.go b/pkg/kubelet/images/image_gc_manager_test.go index c8c9ad8715..c2901a8053 100644 --- a/pkg/kubelet/images/image_gc_manager_test.go +++ b/pkg/kubelet/images/image_gc_manager_test.go @@ -24,11 +24,11 @@ import ( cadvisorapiv2 "github.com/google/cadvisor/info/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/client/record" cadvisortest "k8s.io/kubernetes/pkg/kubelet/cadvisor/testing" "k8s.io/kubernetes/pkg/kubelet/container" containertest "k8s.io/kubernetes/pkg/kubelet/container/testing" - "k8s.io/kubernetes/pkg/util/clock" ) var zero time.Time diff --git a/pkg/kubelet/images/image_manager.go b/pkg/kubelet/images/image_manager.go index 4c62b0d8c4..7162f385bb 100644 --- a/pkg/kubelet/images/image_manager.go +++ b/pkg/kubelet/images/image_manager.go @@ -21,11 +21,11 @@ import ( dockerref "github.com/docker/distribution/reference" "github.com/golang/glog" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/events" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/parsers" ) diff --git a/pkg/kubelet/images/image_manager_test.go b/pkg/kubelet/images/image_manager_test.go index 6355b7fc05..ed00922ae9 100644 --- a/pkg/kubelet/images/image_manager_test.go +++ b/pkg/kubelet/images/image_manager_test.go @@ -23,12 +23,12 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" . "k8s.io/kubernetes/pkg/kubelet/container" ctest "k8s.io/kubernetes/pkg/kubelet/container/testing" - "k8s.io/kubernetes/pkg/util/clock" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) type pullerTestCase struct { diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 9f7b0ca9f2..a5349d34eb 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -39,6 +39,9 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/integer" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" @@ -82,12 +85,9 @@ import ( "k8s.io/kubernetes/pkg/kubelet/volumemanager" "k8s.io/kubernetes/pkg/security/apparmor" "k8s.io/kubernetes/pkg/util/bandwidth" - "k8s.io/kubernetes/pkg/util/clock" utilconfig "k8s.io/kubernetes/pkg/util/config" utildbus "k8s.io/kubernetes/pkg/util/dbus" utilexec "k8s.io/kubernetes/pkg/util/exec" - "k8s.io/kubernetes/pkg/util/flowcontrol" - "k8s.io/kubernetes/pkg/util/integer" kubeio "k8s.io/kubernetes/pkg/util/io" utilipt "k8s.io/kubernetes/pkg/util/iptables" "k8s.io/kubernetes/pkg/util/mount" diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index cc141e3e85..a7c1d6bb5c 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -33,6 +33,8 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/clock" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/componentconfig" @@ -59,8 +61,6 @@ import ( kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/queue" kubeletvolume "k8s.io/kubernetes/pkg/kubelet/volumemanager" - "k8s.io/kubernetes/pkg/util/clock" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" _ "k8s.io/kubernetes/pkg/volume/host_path" diff --git a/pkg/kubelet/kuberuntime/BUILD b/pkg/kubelet/kuberuntime/BUILD index eedb2a790b..25619ef2b3 100644 --- a/pkg/kubelet/kuberuntime/BUILD +++ b/pkg/kubelet/kuberuntime/BUILD @@ -45,7 +45,6 @@ go_library( "//pkg/kubelet/util/cache:go_default_library", "//pkg/kubelet/util/format:go_default_library", "//pkg/securitycontext:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/parsers:go_default_library", "//pkg/util/selinux:go_default_library", "//pkg/util/version:go_default_library", @@ -58,6 +57,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) @@ -84,7 +84,6 @@ go_test( "//pkg/kubelet/container/testing:go_default_library", "//pkg/kubelet/network:go_default_library", "//pkg/kubelet/network/testing:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/intstr:go_default_library", "//vendor:github.com/golang/mock/gomock", "//vendor:github.com/google/cadvisor/info/v1", @@ -92,6 +91,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/kuberuntime/fake_kuberuntime_manager.go b/pkg/kubelet/kuberuntime/fake_kuberuntime_manager.go index 982927022d..03e470274b 100644 --- a/pkg/kubelet/kuberuntime/fake_kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/fake_kuberuntime_manager.go @@ -24,6 +24,7 @@ import ( cadvisorapi "github.com/google/cadvisor/info/v1" "k8s.io/apimachinery/pkg/types" kubetypes "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/credentialprovider" @@ -33,7 +34,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/lifecycle" "k8s.io/kubernetes/pkg/kubelet/network" proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) type fakeHTTP struct { diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index 0da889fcff..4028427d4a 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -28,6 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubetypes "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/credentialprovider" @@ -42,7 +43,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/cache" "k8s.io/kubernetes/pkg/kubelet/util/format" - "k8s.io/kubernetes/pkg/util/flowcontrol" utilversion "k8s.io/kubernetes/pkg/util/version" ) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go index f6f7cb7ae3..599e13283a 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go @@ -27,6 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" kubetypes "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/componentconfig" apitest "k8s.io/kubernetes/pkg/kubelet/api/testing" @@ -35,7 +36,6 @@ import ( containertest "k8s.io/kubernetes/pkg/kubelet/container/testing" "k8s.io/kubernetes/pkg/kubelet/network" nettest "k8s.io/kubernetes/pkg/kubelet/network/testing" - "k8s.io/kubernetes/pkg/util/flowcontrol" ) var ( diff --git a/pkg/kubelet/pleg/BUILD b/pkg/kubelet/pleg/BUILD index d3be41ed9b..8480566837 100644 --- a/pkg/kubelet/pleg/BUILD +++ b/pkg/kubelet/pleg/BUILD @@ -19,11 +19,11 @@ go_library( deps = [ "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/metrics:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -35,10 +35,10 @@ go_test( deps = [ "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/container/testing:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/stretchr/testify/assert", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/diff", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/pleg/generic.go b/pkg/kubelet/pleg/generic.go index 3215b14edd..63a0cba42c 100644 --- a/pkg/kubelet/pleg/generic.go +++ b/pkg/kubelet/pleg/generic.go @@ -25,9 +25,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/clock" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/metrics" - "k8s.io/kubernetes/pkg/util/clock" ) // GenericPLEG is an extremely simple generic PLEG that relies solely on diff --git a/pkg/kubelet/pleg/generic_test.go b/pkg/kubelet/pleg/generic_test.go index 9fa15d994c..d38cf2e309 100644 --- a/pkg/kubelet/pleg/generic_test.go +++ b/pkg/kubelet/pleg/generic_test.go @@ -27,9 +27,9 @@ import ( "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/diff" + "k8s.io/client-go/pkg/util/clock" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" containertest "k8s.io/kubernetes/pkg/kubelet/container/testing" - "k8s.io/kubernetes/pkg/util/clock" ) const ( diff --git a/pkg/kubelet/pod_workers_test.go b/pkg/kubelet/pod_workers_test.go index b073b6ff23..830c095985 100644 --- a/pkg/kubelet/pod_workers_test.go +++ b/pkg/kubelet/pod_workers_test.go @@ -24,13 +24,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" containertest "k8s.io/kubernetes/pkg/kubelet/container/testing" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/queue" - "k8s.io/kubernetes/pkg/util/clock" ) // fakePodWorkers runs sync pod function in serial, so we can have diff --git a/pkg/kubelet/rkt/BUILD b/pkg/kubelet/rkt/BUILD index 5ef5867c1a..e93087d040 100644 --- a/pkg/kubelet/rkt/BUILD +++ b/pkg/kubelet/rkt/BUILD @@ -38,7 +38,6 @@ go_library( "//pkg/kubelet/util/format:go_default_library", "//pkg/securitycontext:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/parsers:go_default_library", "//pkg/util/selinux:go_default_library", "//pkg/util/strings:go_default_library", @@ -58,6 +57,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/errors", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/kubelet/rkt/rkt.go b/pkg/kubelet/rkt/rkt.go index c13a4f8c96..f9d56cf7e4 100644 --- a/pkg/kubelet/rkt/rkt.go +++ b/pkg/kubelet/rkt/rkt.go @@ -45,6 +45,7 @@ import ( kubetypes "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/errors" utilwait "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/record" "k8s.io/kubernetes/pkg/credentialprovider" @@ -60,7 +61,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/util/format" "k8s.io/kubernetes/pkg/securitycontext" utilexec "k8s.io/kubernetes/pkg/util/exec" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/selinux" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/util/term" diff --git a/pkg/kubelet/runonce_test.go b/pkg/kubelet/runonce_test.go index e604ddee04..047b5a819a 100644 --- a/pkg/kubelet/runonce_test.go +++ b/pkg/kubelet/runonce_test.go @@ -25,6 +25,7 @@ import ( cadvisorapiv2 "github.com/google/cadvisor/info/v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/componentconfig" "k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake" @@ -41,7 +42,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/server/stats" "k8s.io/kubernetes/pkg/kubelet/status" "k8s.io/kubernetes/pkg/kubelet/volumemanager" - "k8s.io/kubernetes/pkg/util/clock" utiltesting "k8s.io/kubernetes/pkg/util/testing" "k8s.io/kubernetes/pkg/volume" volumetest "k8s.io/kubernetes/pkg/volume/testing" diff --git a/pkg/kubelet/server/streaming/BUILD b/pkg/kubelet/server/streaming/BUILD index 6444113c10..06a95fe96a 100644 --- a/pkg/kubelet/server/streaming/BUILD +++ b/pkg/kubelet/server/streaming/BUILD @@ -20,12 +20,12 @@ go_library( "//pkg/kubelet/api/v1alpha1/runtime:go_default_library", "//pkg/kubelet/server/portforward:go_default_library", "//pkg/kubelet/server/remotecommand:go_default_library", - "//pkg/util/clock:go_default_library", "//pkg/util/term:go_default_library", "//vendor:github.com/emicklei/go-restful", "//vendor:google.golang.org/grpc", "//vendor:google.golang.org/grpc/codes", "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/server/streaming/request_cache.go b/pkg/kubelet/server/streaming/request_cache.go index c8b68a464f..5376b7d94d 100644 --- a/pkg/kubelet/server/streaming/request_cache.go +++ b/pkg/kubelet/server/streaming/request_cache.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) var ( diff --git a/pkg/kubelet/util/cache/BUILD b/pkg/kubelet/util/cache/BUILD index a9ca7a8af7..73868424b2 100644 --- a/pkg/kubelet/util/cache/BUILD +++ b/pkg/kubelet/util/cache/BUILD @@ -22,7 +22,7 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/client/cache:go_default_library", - "//pkg/util/clock:go_default_library", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/util/cache/object_cache_test.go b/pkg/kubelet/util/cache/object_cache_test.go index 86b1851e32..1dc2d8861f 100644 --- a/pkg/kubelet/util/cache/object_cache_test.go +++ b/pkg/kubelet/util/cache/object_cache_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" + "k8s.io/client-go/pkg/util/clock" expirationcache "k8s.io/kubernetes/pkg/client/cache" - "k8s.io/kubernetes/pkg/util/clock" ) type testObject struct { diff --git a/pkg/kubelet/util/queue/BUILD b/pkg/kubelet/util/queue/BUILD index ccd99be1d7..320f8c1ee6 100644 --- a/pkg/kubelet/util/queue/BUILD +++ b/pkg/kubelet/util/queue/BUILD @@ -13,8 +13,8 @@ go_library( srcs = ["work_queue.go"], tags = ["automanaged"], deps = [ - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/types", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -24,9 +24,9 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/kubelet/util/queue/work_queue.go b/pkg/kubelet/util/queue/work_queue.go index 29fa7c84f7..e88d4079be 100644 --- a/pkg/kubelet/util/queue/work_queue.go +++ b/pkg/kubelet/util/queue/work_queue.go @@ -21,7 +21,7 @@ import ( "time" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) // WorkQueue allows queuing items with a timestamp. An item is diff --git a/pkg/kubelet/util/queue/work_queue_test.go b/pkg/kubelet/util/queue/work_queue_test.go index 6ce50f36c1..670c0b9aab 100644 --- a/pkg/kubelet/util/queue/work_queue_test.go +++ b/pkg/kubelet/util/queue/work_queue_test.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) func newTestBasicWorkQueue() (*basicWorkQueue, *clock.FakeClock) { diff --git a/pkg/master/tunneler/BUILD b/pkg/master/tunneler/BUILD index c0b65ffb43..78b1deea97 100644 --- a/pkg/master/tunneler/BUILD +++ b/pkg/master/tunneler/BUILD @@ -14,8 +14,8 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/clock:go_default_library", "//vendor:github.com/stretchr/testify/assert", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -26,10 +26,10 @@ go_library( deps = [ "//pkg/ssh:go_default_library", "//pkg/util:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:github.com/prometheus/client_golang/prometheus", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/master/tunneler/ssh.go b/pkg/master/tunneler/ssh.go index 73d0059ba7..4ef2696d42 100644 --- a/pkg/master/tunneler/ssh.go +++ b/pkg/master/tunneler/ssh.go @@ -27,9 +27,9 @@ import ( "time" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/ssh" "k8s.io/kubernetes/pkg/util" - "k8s.io/kubernetes/pkg/util/clock" "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/master/tunneler/ssh_test.go b/pkg/master/tunneler/ssh_test.go index a169028d7f..9f0918785f 100644 --- a/pkg/master/tunneler/ssh_test.go +++ b/pkg/master/tunneler/ssh_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" "github.com/stretchr/testify/assert" ) diff --git a/pkg/proxy/iptables/BUILD b/pkg/proxy/iptables/BUILD index 085088fe26..f7f3853d91 100644 --- a/pkg/proxy/iptables/BUILD +++ b/pkg/proxy/iptables/BUILD @@ -21,7 +21,6 @@ go_library( "//pkg/proxy/healthcheck:go_default_library", "//pkg/util/config:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/slice:go_default_library", "//pkg/util/sysctl:go_default_library", @@ -30,6 +29,7 @@ go_library( "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/util/sets", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/proxy/iptables/proxier.go b/pkg/proxy/iptables/proxier.go index 1bb7bb2f2e..c2b94072b8 100644 --- a/pkg/proxy/iptables/proxier.go +++ b/pkg/proxy/iptables/proxier.go @@ -36,6 +36,7 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api" apiservice "k8s.io/kubernetes/pkg/api/service" "k8s.io/kubernetes/pkg/api/v1" @@ -44,7 +45,6 @@ import ( "k8s.io/kubernetes/pkg/proxy/healthcheck" featuregate "k8s.io/kubernetes/pkg/util/config" utilexec "k8s.io/kubernetes/pkg/util/exec" - "k8s.io/kubernetes/pkg/util/flowcontrol" utiliptables "k8s.io/kubernetes/pkg/util/iptables" "k8s.io/kubernetes/pkg/util/slice" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" diff --git a/pkg/storage/BUILD b/pkg/storage/BUILD index af1d5be64f..abc240a024 100644 --- a/pkg/storage/BUILD +++ b/pkg/storage/BUILD @@ -28,7 +28,6 @@ go_library( "//pkg/client/cache:go_default_library", "//pkg/fields:go_default_library", "//pkg/util:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:golang.org/x/net/context", "//vendor:k8s.io/apimachinery/pkg/api/errors", @@ -42,6 +41,7 @@ go_library( "//vendor:k8s.io/apimachinery/pkg/util/validation/field", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -61,7 +61,6 @@ go_test( "//pkg/api/v1:go_default_library", "//pkg/client/cache:go_default_library", "//pkg/fields:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/labels", @@ -70,6 +69,7 @@ go_test( "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/watch", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/storage/watch_cache.go b/pkg/storage/watch_cache.go index 67b1d869a6..c7c25e2a31 100644 --- a/pkg/storage/watch_cache.go +++ b/pkg/storage/watch_cache.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/util" - "k8s.io/kubernetes/pkg/util/clock" ) const ( diff --git a/pkg/storage/watch_cache_test.go b/pkg/storage/watch_cache_test.go index 32a9c00f60..24fc9131f2 100644 --- a/pkg/storage/watch_cache_test.go +++ b/pkg/storage/watch_cache_test.go @@ -28,11 +28,11 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/fields" - "k8s.io/kubernetes/pkg/util/clock" ) func makeTestPod(name string, resourceVersion uint64) *api.Pod { diff --git a/pkg/util/BUILD b/pkg/util/BUILD index dca967f295..801a859066 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -52,7 +52,6 @@ filegroup( "//pkg/util/cert:all-srcs", "//pkg/util/chmod:all-srcs", "//pkg/util/chown:all-srcs", - "//pkg/util/clock:all-srcs", "//pkg/util/config:all-srcs", "//pkg/util/configz:all-srcs", "//pkg/util/crlf:all-srcs", @@ -63,7 +62,6 @@ filegroup( "//pkg/util/exec:all-srcs", "//pkg/util/flag:all-srcs", "//pkg/util/flock:all-srcs", - "//pkg/util/flowcontrol:all-srcs", "//pkg/util/framer:all-srcs", "//pkg/util/goroutinemap:all-srcs", "//pkg/util/hash:all-srcs", @@ -71,7 +69,6 @@ filegroup( "//pkg/util/httpstream:all-srcs", "//pkg/util/i18n:all-srcs", "//pkg/util/initsystem:all-srcs", - "//pkg/util/integer:all-srcs", "//pkg/util/interrupt:all-srcs", "//pkg/util/intstr:all-srcs", "//pkg/util/io:all-srcs", diff --git a/pkg/util/clock/BUILD b/pkg/util/clock/BUILD deleted file mode 100644 index 488fcac735..0000000000 --- a/pkg/util/clock/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = ["clock.go"], - tags = ["automanaged"], -) - -go_test( - name = "go_default_test", - srcs = ["clock_test.go"], - library = ":go_default_library", - tags = ["automanaged"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/clock/clock.go b/pkg/util/clock/clock.go deleted file mode 100644 index 2ea1b53c1a..0000000000 --- a/pkg/util/clock/clock.go +++ /dev/null @@ -1,218 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package clock - -import ( - "sync" - "time" -) - -// Clock allows for injecting fake or real clocks into code that -// needs to do arbitrary things based on time. -type Clock interface { - Now() time.Time - Since(time.Time) time.Duration - After(d time.Duration) <-chan time.Time - Sleep(d time.Duration) - Tick(d time.Duration) <-chan time.Time -} - -var ( - _ = Clock(RealClock{}) - _ = Clock(&FakeClock{}) - _ = Clock(&IntervalClock{}) -) - -// RealClock really calls time.Now() -type RealClock struct{} - -// Now returns the current time. -func (RealClock) Now() time.Time { - return time.Now() -} - -// Since returns time since the specified timestamp. -func (RealClock) Since(ts time.Time) time.Duration { - return time.Since(ts) -} - -// Same as time.After(d). -func (RealClock) After(d time.Duration) <-chan time.Time { - return time.After(d) -} - -func (RealClock) Tick(d time.Duration) <-chan time.Time { - return time.Tick(d) -} - -func (RealClock) Sleep(d time.Duration) { - time.Sleep(d) -} - -// FakeClock implements Clock, but returns an arbitrary time. -type FakeClock struct { - lock sync.RWMutex - time time.Time - - // waiters are waiting for the fake time to pass their specified time - waiters []fakeClockWaiter -} - -type fakeClockWaiter struct { - targetTime time.Time - stepInterval time.Duration - skipIfBlocked bool - destChan chan<- time.Time -} - -func NewFakeClock(t time.Time) *FakeClock { - return &FakeClock{ - time: t, - } -} - -// Now returns f's time. -func (f *FakeClock) Now() time.Time { - f.lock.RLock() - defer f.lock.RUnlock() - return f.time -} - -// Since returns time since the time in f. -func (f *FakeClock) Since(ts time.Time) time.Duration { - f.lock.RLock() - defer f.lock.RUnlock() - return f.time.Sub(ts) -} - -// Fake version of time.After(d). -func (f *FakeClock) After(d time.Duration) <-chan time.Time { - f.lock.Lock() - defer f.lock.Unlock() - stopTime := f.time.Add(d) - ch := make(chan time.Time, 1) // Don't block! - f.waiters = append(f.waiters, fakeClockWaiter{ - targetTime: stopTime, - destChan: ch, - }) - return ch -} - -func (f *FakeClock) Tick(d time.Duration) <-chan time.Time { - f.lock.Lock() - defer f.lock.Unlock() - tickTime := f.time.Add(d) - ch := make(chan time.Time, 1) // hold one tick - f.waiters = append(f.waiters, fakeClockWaiter{ - targetTime: tickTime, - stepInterval: d, - skipIfBlocked: true, - destChan: ch, - }) - - return ch -} - -// Move clock by Duration, notify anyone that's called After or Tick -func (f *FakeClock) Step(d time.Duration) { - f.lock.Lock() - defer f.lock.Unlock() - f.setTimeLocked(f.time.Add(d)) -} - -// Sets the time. -func (f *FakeClock) SetTime(t time.Time) { - f.lock.Lock() - defer f.lock.Unlock() - f.setTimeLocked(t) -} - -// Actually changes the time and checks any waiters. f must be write-locked. -func (f *FakeClock) setTimeLocked(t time.Time) { - f.time = t - newWaiters := make([]fakeClockWaiter, 0, len(f.waiters)) - for i := range f.waiters { - w := &f.waiters[i] - if !w.targetTime.After(t) { - - if w.skipIfBlocked { - select { - case w.destChan <- t: - default: - } - } else { - w.destChan <- t - } - - if w.stepInterval > 0 { - for !w.targetTime.After(t) { - w.targetTime = w.targetTime.Add(w.stepInterval) - } - newWaiters = append(newWaiters, *w) - } - - } else { - newWaiters = append(newWaiters, f.waiters[i]) - } - } - f.waiters = newWaiters -} - -// Returns true if After has been called on f but not yet satisfied (so you can -// write race-free tests). -func (f *FakeClock) HasWaiters() bool { - f.lock.RLock() - defer f.lock.RUnlock() - return len(f.waiters) > 0 -} - -func (f *FakeClock) Sleep(d time.Duration) { - f.Step(d) -} - -// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration -type IntervalClock struct { - Time time.Time - Duration time.Duration -} - -// Now returns i's time. -func (i *IntervalClock) Now() time.Time { - i.Time = i.Time.Add(i.Duration) - return i.Time -} - -// Since returns time since the time in i. -func (i *IntervalClock) Since(ts time.Time) time.Duration { - return i.Time.Sub(ts) -} - -// Unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) After(d time.Duration) <-chan time.Time { - panic("IntervalClock doesn't implement After") -} - -// Unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) Tick(d time.Duration) <-chan time.Time { - panic("IntervalClock doesn't implement Tick") -} - -func (*IntervalClock) Sleep(d time.Duration) { - panic("IntervalClock doesn't implement Sleep") -} diff --git a/pkg/util/clock/clock_test.go b/pkg/util/clock/clock_test.go deleted file mode 100644 index 27d34605f5..0000000000 --- a/pkg/util/clock/clock_test.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package clock - -import ( - "testing" - "time" -) - -func TestFakeClock(t *testing.T) { - startTime := time.Now() - tc := NewFakeClock(startTime) - tc.Step(time.Second) - now := tc.Now() - if now.Sub(startTime) != time.Second { - t.Errorf("input: %s now=%s gap=%s expected=%s", startTime, now, now.Sub(startTime), time.Second) - } - - tt := tc.Now() - tc.SetTime(tt.Add(time.Hour)) - if tc.Now().Sub(tt) != time.Hour { - t.Errorf("input: %s now=%s gap=%s expected=%s", tt, tc.Now(), tc.Now().Sub(tt), time.Hour) - } -} - -func TestFakeClockSleep(t *testing.T) { - startTime := time.Now() - tc := NewFakeClock(startTime) - tc.Sleep(time.Duration(1) * time.Hour) - now := tc.Now() - if now.Sub(startTime) != time.Hour { - t.Errorf("Fake sleep failed, expected time to advance by one hour, instead, its %v", now.Sub(startTime)) - } -} - -func TestFakeAfter(t *testing.T) { - tc := NewFakeClock(time.Now()) - if tc.HasWaiters() { - t.Errorf("unexpected waiter?") - } - oneSec := tc.After(time.Second) - if !tc.HasWaiters() { - t.Errorf("unexpected lack of waiter?") - } - - oneOhOneSec := tc.After(time.Second + time.Millisecond) - twoSec := tc.After(2 * time.Second) - select { - case <-oneSec: - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - } - - tc.Step(999 * time.Millisecond) - select { - case <-oneSec: - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - } - - tc.Step(time.Millisecond) - select { - case <-oneSec: - // Expected! - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - t.Errorf("unexpected non-channel read") - } - tc.Step(time.Millisecond) - select { - case <-oneSec: - // should not double-trigger! - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - // Expected! - case <-twoSec: - t.Errorf("unexpected channel read") - default: - t.Errorf("unexpected non-channel read") - } -} - -func TestFakeTick(t *testing.T) { - tc := NewFakeClock(time.Now()) - if tc.HasWaiters() { - t.Errorf("unexpected waiter?") - } - oneSec := tc.Tick(time.Second) - if !tc.HasWaiters() { - t.Errorf("unexpected lack of waiter?") - } - - oneOhOneSec := tc.Tick(time.Second + time.Millisecond) - twoSec := tc.Tick(2 * time.Second) - select { - case <-oneSec: - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - } - - tc.Step(999 * time.Millisecond) // t=.999 - select { - case <-oneSec: - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - } - - tc.Step(time.Millisecond) // t=1.000 - select { - case <-oneSec: - // Expected! - case <-oneOhOneSec: - t.Errorf("unexpected channel read") - case <-twoSec: - t.Errorf("unexpected channel read") - default: - t.Errorf("unexpected non-channel read") - } - tc.Step(time.Millisecond) // t=1.001 - select { - case <-oneSec: - // should not double-trigger! - t.Errorf("unexpected channel read") - case <-oneOhOneSec: - // Expected! - case <-twoSec: - t.Errorf("unexpected channel read") - default: - t.Errorf("unexpected non-channel read") - } - - tc.Step(time.Second) // t=2.001 - tc.Step(time.Second) // t=3.001 - tc.Step(time.Second) // t=4.001 - tc.Step(time.Second) // t=5.001 - - // The one second ticker should not accumulate ticks - accumulatedTicks := 0 - drained := false - for !drained { - select { - case <-oneSec: - accumulatedTicks++ - default: - drained = true - } - } - if accumulatedTicks != 1 { - t.Errorf("unexpected number of accumulated ticks: %d", accumulatedTicks) - } -} diff --git a/pkg/util/flowcontrol/BUILD b/pkg/util/flowcontrol/BUILD deleted file mode 100644 index bac277096e..0000000000 --- a/pkg/util/flowcontrol/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = [ - "backoff.go", - "throttle.go", - ], - tags = ["automanaged"], - deps = [ - "//pkg/util/clock:go_default_library", - "//pkg/util/integer:go_default_library", - "//vendor:github.com/juju/ratelimit", - ], -) - -go_test( - name = "go_default_test", - srcs = [ - "backoff_test.go", - "throttle_test.go", - ], - library = ":go_default_library", - tags = ["automanaged"], - deps = ["//pkg/util/clock:go_default_library"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/flowcontrol/backoff.go b/pkg/util/flowcontrol/backoff.go deleted file mode 100644 index 2d91cc5e02..0000000000 --- a/pkg/util/flowcontrol/backoff.go +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flowcontrol - -import ( - "sync" - "time" - - "k8s.io/kubernetes/pkg/util/clock" - "k8s.io/kubernetes/pkg/util/integer" -) - -type backoffEntry struct { - backoff time.Duration - lastUpdate time.Time -} - -type Backoff struct { - sync.Mutex - Clock clock.Clock - defaultDuration time.Duration - maxDuration time.Duration - perItemBackoff map[string]*backoffEntry -} - -func NewFakeBackOff(initial, max time.Duration, tc *clock.FakeClock) *Backoff { - return &Backoff{ - perItemBackoff: map[string]*backoffEntry{}, - Clock: tc, - defaultDuration: initial, - maxDuration: max, - } -} - -func NewBackOff(initial, max time.Duration) *Backoff { - return &Backoff{ - perItemBackoff: map[string]*backoffEntry{}, - Clock: clock.RealClock{}, - defaultDuration: initial, - maxDuration: max, - } -} - -// Get the current backoff Duration -func (p *Backoff) Get(id string) time.Duration { - p.Lock() - defer p.Unlock() - var delay time.Duration - entry, ok := p.perItemBackoff[id] - if ok { - delay = entry.backoff - } - return delay -} - -// move backoff to the next mark, capping at maxDuration -func (p *Backoff) Next(id string, eventTime time.Time) { - p.Lock() - defer p.Unlock() - entry, ok := p.perItemBackoff[id] - if !ok || hasExpired(eventTime, entry.lastUpdate, p.maxDuration) { - entry = p.initEntryUnsafe(id) - } else { - delay := entry.backoff * 2 // exponential - entry.backoff = time.Duration(integer.Int64Min(int64(delay), int64(p.maxDuration))) - } - entry.lastUpdate = p.Clock.Now() -} - -// Reset forces clearing of all backoff data for a given key. -func (p *Backoff) Reset(id string) { - p.Lock() - defer p.Unlock() - delete(p.perItemBackoff, id) -} - -// Returns True if the elapsed time since eventTime is smaller than the current backoff window -func (p *Backoff) IsInBackOffSince(id string, eventTime time.Time) bool { - p.Lock() - defer p.Unlock() - entry, ok := p.perItemBackoff[id] - if !ok { - return false - } - if hasExpired(eventTime, entry.lastUpdate, p.maxDuration) { - return false - } - return p.Clock.Now().Sub(eventTime) < entry.backoff -} - -// Returns True if time since lastupdate is less than the current backoff window. -func (p *Backoff) IsInBackOffSinceUpdate(id string, eventTime time.Time) bool { - p.Lock() - defer p.Unlock() - entry, ok := p.perItemBackoff[id] - if !ok { - return false - } - if hasExpired(eventTime, entry.lastUpdate, p.maxDuration) { - return false - } - return eventTime.Sub(entry.lastUpdate) < entry.backoff -} - -// Garbage collect records that have aged past maxDuration. Backoff users are expected -// to invoke this periodically. -func (p *Backoff) GC() { - p.Lock() - defer p.Unlock() - now := p.Clock.Now() - for id, entry := range p.perItemBackoff { - if now.Sub(entry.lastUpdate) > p.maxDuration*2 { - // GC when entry has not been updated for 2*maxDuration - delete(p.perItemBackoff, id) - } - } -} - -func (p *Backoff) DeleteEntry(id string) { - p.Lock() - defer p.Unlock() - delete(p.perItemBackoff, id) -} - -// Take a lock on *Backoff, before calling initEntryUnsafe -func (p *Backoff) initEntryUnsafe(id string) *backoffEntry { - entry := &backoffEntry{backoff: p.defaultDuration} - p.perItemBackoff[id] = entry - return entry -} - -// After 2*maxDuration we restart the backoff factor to the beginning -func hasExpired(eventTime time.Time, lastUpdate time.Time, maxDuration time.Duration) bool { - return eventTime.Sub(lastUpdate) > maxDuration*2 // consider stable if it's ok for twice the maxDuration -} diff --git a/pkg/util/flowcontrol/backoff_test.go b/pkg/util/flowcontrol/backoff_test.go deleted file mode 100644 index df663221d8..0000000000 --- a/pkg/util/flowcontrol/backoff_test.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flowcontrol - -import ( - "testing" - "time" - - "k8s.io/kubernetes/pkg/util/clock" -) - -func TestSlowBackoff(t *testing.T) { - id := "_idSlow" - tc := clock.NewFakeClock(time.Now()) - step := time.Second - maxDuration := 50 * step - - b := NewFakeBackOff(step, maxDuration, tc) - cases := []time.Duration{0, 1, 2, 4, 8, 16, 32, 50, 50, 50} - for ix, c := range cases { - tc.Step(step) - w := b.Get(id) - if w != c*step { - t.Errorf("input: '%d': expected %s, got %s", ix, c*step, w) - } - b.Next(id, tc.Now()) - } - - //Now confirm that the Reset cancels backoff. - b.Next(id, tc.Now()) - b.Reset(id) - if b.Get(id) != 0 { - t.Errorf("Reset didn't clear the backoff.") - } - -} - -func TestBackoffReset(t *testing.T) { - id := "_idReset" - tc := clock.NewFakeClock(time.Now()) - step := time.Second - maxDuration := step * 5 - b := NewFakeBackOff(step, maxDuration, tc) - startTime := tc.Now() - - // get to backoff = maxDuration - for i := 0; i <= int(maxDuration/step); i++ { - tc.Step(step) - b.Next(id, tc.Now()) - } - - // backoff should be capped at maxDuration - if !b.IsInBackOffSince(id, tc.Now()) { - t.Errorf("expected to be in Backoff got %s", b.Get(id)) - } - - lastUpdate := tc.Now() - tc.Step(2*maxDuration + step) // time += 11s, 11 > 2*maxDuration - if b.IsInBackOffSince(id, lastUpdate) { - t.Errorf("expected to not be in Backoff after reset (start=%s, now=%s, lastUpdate=%s), got %s", startTime, tc.Now(), lastUpdate, b.Get(id)) - } -} - -func TestBackoffHightWaterMark(t *testing.T) { - id := "_idHiWaterMark" - tc := clock.NewFakeClock(time.Now()) - step := time.Second - maxDuration := 5 * step - b := NewFakeBackOff(step, maxDuration, tc) - - // get to backoff = maxDuration - for i := 0; i <= int(maxDuration/step); i++ { - tc.Step(step) - b.Next(id, tc.Now()) - } - - // backoff high watermark expires after 2*maxDuration - tc.Step(maxDuration + step) - b.Next(id, tc.Now()) - - if b.Get(id) != maxDuration { - t.Errorf("expected Backoff to stay at high watermark %s got %s", maxDuration, b.Get(id)) - } -} - -func TestBackoffGC(t *testing.T) { - id := "_idGC" - tc := clock.NewFakeClock(time.Now()) - step := time.Second - maxDuration := 5 * step - - b := NewFakeBackOff(step, maxDuration, tc) - - for i := 0; i <= int(maxDuration/step); i++ { - tc.Step(step) - b.Next(id, tc.Now()) - } - lastUpdate := tc.Now() - tc.Step(maxDuration + step) - b.GC() - _, found := b.perItemBackoff[id] - if !found { - t.Errorf("expected GC to skip entry, elapsed time=%s maxDuration=%s", tc.Now().Sub(lastUpdate), maxDuration) - } - - tc.Step(maxDuration + step) - b.GC() - r, found := b.perItemBackoff[id] - if found { - t.Errorf("expected GC of entry after %s got entry %v", tc.Now().Sub(lastUpdate), r) - } -} - -func TestIsInBackOffSinceUpdate(t *testing.T) { - id := "_idIsInBackOffSinceUpdate" - tc := clock.NewFakeClock(time.Now()) - step := time.Second - maxDuration := 10 * step - b := NewFakeBackOff(step, maxDuration, tc) - startTime := tc.Now() - - cases := []struct { - tick time.Duration - inBackOff bool - value int - }{ - {tick: 0, inBackOff: false, value: 0}, - {tick: 1, inBackOff: false, value: 1}, - {tick: 2, inBackOff: true, value: 2}, - {tick: 3, inBackOff: false, value: 2}, - {tick: 4, inBackOff: true, value: 4}, - {tick: 5, inBackOff: true, value: 4}, - {tick: 6, inBackOff: true, value: 4}, - {tick: 7, inBackOff: false, value: 4}, - {tick: 8, inBackOff: true, value: 8}, - {tick: 9, inBackOff: true, value: 8}, - {tick: 10, inBackOff: true, value: 8}, - {tick: 11, inBackOff: true, value: 8}, - {tick: 12, inBackOff: true, value: 8}, - {tick: 13, inBackOff: true, value: 8}, - {tick: 14, inBackOff: true, value: 8}, - {tick: 15, inBackOff: false, value: 8}, - {tick: 16, inBackOff: true, value: 10}, - {tick: 17, inBackOff: true, value: 10}, - {tick: 18, inBackOff: true, value: 10}, - {tick: 19, inBackOff: true, value: 10}, - {tick: 20, inBackOff: true, value: 10}, - {tick: 21, inBackOff: true, value: 10}, - {tick: 22, inBackOff: true, value: 10}, - {tick: 23, inBackOff: true, value: 10}, - {tick: 24, inBackOff: true, value: 10}, - {tick: 25, inBackOff: false, value: 10}, - {tick: 26, inBackOff: true, value: 10}, - {tick: 27, inBackOff: true, value: 10}, - {tick: 28, inBackOff: true, value: 10}, - {tick: 29, inBackOff: true, value: 10}, - {tick: 30, inBackOff: true, value: 10}, - {tick: 31, inBackOff: true, value: 10}, - {tick: 32, inBackOff: true, value: 10}, - {tick: 33, inBackOff: true, value: 10}, - {tick: 34, inBackOff: true, value: 10}, - {tick: 35, inBackOff: false, value: 10}, - {tick: 56, inBackOff: false, value: 0}, - {tick: 57, inBackOff: false, value: 1}, - } - - for _, c := range cases { - tc.SetTime(startTime.Add(c.tick * step)) - if c.inBackOff != b.IsInBackOffSinceUpdate(id, tc.Now()) { - t.Errorf("expected IsInBackOffSinceUpdate %v got %v at tick %s", c.inBackOff, b.IsInBackOffSinceUpdate(id, tc.Now()), c.tick*step) - } - - if c.inBackOff && (time.Duration(c.value)*step != b.Get(id)) { - t.Errorf("expected backoff value=%s got %s at tick %s", time.Duration(c.value)*step, b.Get(id), c.tick*step) - } - - if !c.inBackOff { - b.Next(id, tc.Now()) - } - } -} diff --git a/pkg/util/flowcontrol/throttle.go b/pkg/util/flowcontrol/throttle.go deleted file mode 100644 index 881a2f57d7..0000000000 --- a/pkg/util/flowcontrol/throttle.go +++ /dev/null @@ -1,132 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flowcontrol - -import ( - "sync" - - "github.com/juju/ratelimit" -) - -type RateLimiter interface { - // TryAccept returns true if a token is taken immediately. Otherwise, - // it returns false. - TryAccept() bool - // Accept returns once a token becomes available. - Accept() - // Stop stops the rate limiter, subsequent calls to CanAccept will return false - Stop() - // Saturation returns a percentage number which describes how saturated - // this rate limiter is. - // Usually we use token bucket rate limiter. In that case, - // 1.0 means no tokens are available; 0.0 means we have a full bucket of tokens to use. - Saturation() float64 - // QPS returns QPS of this rate limiter - QPS() float32 -} - -type tokenBucketRateLimiter struct { - limiter *ratelimit.Bucket - qps float32 -} - -// NewTokenBucketRateLimiter creates a rate limiter which implements a token bucket approach. -// The rate limiter allows bursts of up to 'burst' to exceed the QPS, while still maintaining a -// smoothed qps rate of 'qps'. -// The bucket is initially filled with 'burst' tokens, and refills at a rate of 'qps'. -// The maximum number of tokens in the bucket is capped at 'burst'. -func NewTokenBucketRateLimiter(qps float32, burst int) RateLimiter { - limiter := ratelimit.NewBucketWithRate(float64(qps), int64(burst)) - return &tokenBucketRateLimiter{ - limiter: limiter, - qps: qps, - } -} - -func (t *tokenBucketRateLimiter) TryAccept() bool { - return t.limiter.TakeAvailable(1) == 1 -} - -func (t *tokenBucketRateLimiter) Saturation() float64 { - capacity := t.limiter.Capacity() - avail := t.limiter.Available() - return float64(capacity-avail) / float64(capacity) -} - -// Accept will block until a token becomes available -func (t *tokenBucketRateLimiter) Accept() { - t.limiter.Wait(1) -} - -func (t *tokenBucketRateLimiter) Stop() { -} - -func (t *tokenBucketRateLimiter) QPS() float32 { - return t.qps -} - -type fakeAlwaysRateLimiter struct{} - -func NewFakeAlwaysRateLimiter() RateLimiter { - return &fakeAlwaysRateLimiter{} -} - -func (t *fakeAlwaysRateLimiter) TryAccept() bool { - return true -} - -func (t *fakeAlwaysRateLimiter) Saturation() float64 { - return 0 -} - -func (t *fakeAlwaysRateLimiter) Stop() {} - -func (t *fakeAlwaysRateLimiter) Accept() {} - -func (t *fakeAlwaysRateLimiter) QPS() float32 { - return 1 -} - -type fakeNeverRateLimiter struct { - wg sync.WaitGroup -} - -func NewFakeNeverRateLimiter() RateLimiter { - rl := fakeNeverRateLimiter{} - rl.wg.Add(1) - return &rl -} - -func (t *fakeNeverRateLimiter) TryAccept() bool { - return false -} - -func (t *fakeNeverRateLimiter) Saturation() float64 { - return 1 -} - -func (t *fakeNeverRateLimiter) Stop() { - t.wg.Done() -} - -func (t *fakeNeverRateLimiter) Accept() { - t.wg.Wait() -} - -func (t *fakeNeverRateLimiter) QPS() float32 { - return 1 -} diff --git a/pkg/util/flowcontrol/throttle_test.go b/pkg/util/flowcontrol/throttle_test.go deleted file mode 100644 index 642020fe4b..0000000000 --- a/pkg/util/flowcontrol/throttle_test.go +++ /dev/null @@ -1,177 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package flowcontrol - -import ( - "math" - "sync" - "testing" - "time" -) - -func TestMultithreadedThrottling(t *testing.T) { - // Bucket with 100QPS and no burst - r := NewTokenBucketRateLimiter(100, 1) - - // channel to collect 100 tokens - taken := make(chan bool, 100) - - // Set up goroutines to hammer the throttler - startCh := make(chan bool) - endCh := make(chan bool) - for i := 0; i < 10; i++ { - go func() { - // wait for the starting signal - <-startCh - for { - // get a token - r.Accept() - select { - // try to add it to the taken channel - case taken <- true: - continue - // if taken is full, notify and return - default: - endCh <- true - return - } - } - }() - } - - // record wall time - startTime := time.Now() - // take the initial capacity so all tokens are the result of refill - r.Accept() - // start the thundering herd - close(startCh) - // wait for the first signal that we collected 100 tokens - <-endCh - // record wall time - endTime := time.Now() - - // tolerate a 1% clock change because these things happen - if duration := endTime.Sub(startTime); duration < (time.Second * 99 / 100) { - // We shouldn't be able to get 100 tokens out of the bucket in less than 1 second of wall clock time, no matter what - t.Errorf("Expected it to take at least 1 second to get 100 tokens, took %v", duration) - } else { - t.Logf("Took %v to get 100 tokens", duration) - } -} - -func TestBasicThrottle(t *testing.T) { - r := NewTokenBucketRateLimiter(1, 3) - for i := 0; i < 3; i++ { - if !r.TryAccept() { - t.Error("unexpected false accept") - } - } - if r.TryAccept() { - t.Error("unexpected true accept") - } -} - -func TestIncrementThrottle(t *testing.T) { - r := NewTokenBucketRateLimiter(1, 1) - if !r.TryAccept() { - t.Error("unexpected false accept") - } - if r.TryAccept() { - t.Error("unexpected true accept") - } - - // Allow to refill - time.Sleep(2 * time.Second) - - if !r.TryAccept() { - t.Error("unexpected false accept") - } -} - -func TestThrottle(t *testing.T) { - r := NewTokenBucketRateLimiter(10, 5) - - // Should consume 5 tokens immediately, then - // the remaining 11 should take at least 1 second (0.1s each) - expectedFinish := time.Now().Add(time.Second * 1) - for i := 0; i < 16; i++ { - r.Accept() - } - if time.Now().Before(expectedFinish) { - t.Error("rate limit was not respected, finished too early") - } -} - -func TestRateLimiterSaturation(t *testing.T) { - const e = 0.000001 - tests := []struct { - capacity int - take int - - expectedSaturation float64 - }{ - {1, 1, 1}, - {10, 3, 0.3}, - } - for i, tt := range tests { - rl := NewTokenBucketRateLimiter(1, tt.capacity) - for i := 0; i < tt.take; i++ { - rl.Accept() - } - if math.Abs(rl.Saturation()-tt.expectedSaturation) > e { - t.Fatalf("#%d: Saturation rate difference isn't within tolerable range\n want=%f, get=%f", - i, tt.expectedSaturation, rl.Saturation()) - } - } -} - -func TestAlwaysFake(t *testing.T) { - rl := NewFakeAlwaysRateLimiter() - if !rl.TryAccept() { - t.Error("TryAccept in AlwaysFake should return true.") - } - // If this will block the test will timeout - rl.Accept() -} - -func TestNeverFake(t *testing.T) { - rl := NewFakeNeverRateLimiter() - if rl.TryAccept() { - t.Error("TryAccept in NeverFake should return false.") - } - - finished := false - wg := sync.WaitGroup{} - wg.Add(1) - go func() { - rl.Accept() - finished = true - wg.Done() - }() - - // Wait some time to make sure it never finished. - time.Sleep(time.Second) - if finished { - t.Error("Accept should block forever in NeverFake.") - } - - rl.Stop() - wg.Wait() - if !finished { - t.Error("Stop should make Accept unblock in NeverFake.") - } -} diff --git a/pkg/util/integer/BUILD b/pkg/util/integer/BUILD deleted file mode 100644 index 2d4453af3c..0000000000 --- a/pkg/util/integer/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) - -go_library( - name = "go_default_library", - srcs = ["integer.go"], - tags = ["automanaged"], -) - -go_test( - name = "go_default_test", - srcs = ["integer_test.go"], - library = ":go_default_library", - tags = ["automanaged"], -) - -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) diff --git a/pkg/util/integer/integer.go b/pkg/util/integer/integer.go deleted file mode 100644 index c6ea106f9b..0000000000 --- a/pkg/util/integer/integer.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package integer - -func IntMax(a, b int) int { - if b > a { - return b - } - return a -} - -func IntMin(a, b int) int { - if b < a { - return b - } - return a -} - -func Int32Max(a, b int32) int32 { - if b > a { - return b - } - return a -} - -func Int32Min(a, b int32) int32 { - if b < a { - return b - } - return a -} - -func Int64Max(a, b int64) int64 { - if b > a { - return b - } - return a -} - -func Int64Min(a, b int64) int64 { - if b < a { - return b - } - return a -} - -// RoundToInt32 rounds floats into integer numbers. -func RoundToInt32(a float64) int32 { - if a < 0 { - return int32(a - 0.5) - } - return int32(a + 0.5) -} diff --git a/pkg/util/integer/integer_test.go b/pkg/util/integer/integer_test.go deleted file mode 100644 index e9f586888c..0000000000 --- a/pkg/util/integer/integer_test.go +++ /dev/null @@ -1,244 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package integer - -import "testing" - -func TestIntMax(t *testing.T) { - tests := []struct { - nums []int - expectedMax int - }{ - { - nums: []int{-1, 0}, - expectedMax: 0, - }, - { - nums: []int{-1, -2}, - expectedMax: -1, - }, - { - nums: []int{0, 1}, - expectedMax: 1, - }, - { - nums: []int{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := IntMax(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestIntMin(t *testing.T) { - tests := []struct { - nums []int - expectedMin int - }{ - { - nums: []int{-1, 0}, - expectedMin: -1, - }, - { - nums: []int{-1, -2}, - expectedMin: -2, - }, - { - nums: []int{0, 1}, - expectedMin: 0, - }, - { - nums: []int{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := IntMin(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestInt32Max(t *testing.T) { - tests := []struct { - nums []int32 - expectedMax int32 - }{ - { - nums: []int32{-1, 0}, - expectedMax: 0, - }, - { - nums: []int32{-1, -2}, - expectedMax: -1, - }, - { - nums: []int32{0, 1}, - expectedMax: 1, - }, - { - nums: []int32{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := Int32Max(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestInt32Min(t *testing.T) { - tests := []struct { - nums []int32 - expectedMin int32 - }{ - { - nums: []int32{-1, 0}, - expectedMin: -1, - }, - { - nums: []int32{-1, -2}, - expectedMin: -2, - }, - { - nums: []int32{0, 1}, - expectedMin: 0, - }, - { - nums: []int32{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := Int32Min(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestInt64Max(t *testing.T) { - tests := []struct { - nums []int64 - expectedMax int64 - }{ - { - nums: []int64{-1, 0}, - expectedMax: 0, - }, - { - nums: []int64{-1, -2}, - expectedMax: -1, - }, - { - nums: []int64{0, 1}, - expectedMax: 1, - }, - { - nums: []int64{1, 2}, - expectedMax: 2, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if max := Int64Max(test.nums[0], test.nums[1]); max != test.expectedMax { - t.Errorf("expected %v, got %v", test.expectedMax, max) - } - } -} - -func TestInt64Min(t *testing.T) { - tests := []struct { - nums []int64 - expectedMin int64 - }{ - { - nums: []int64{-1, 0}, - expectedMin: -1, - }, - { - nums: []int64{-1, -2}, - expectedMin: -2, - }, - { - nums: []int64{0, 1}, - expectedMin: 0, - }, - { - nums: []int64{1, 2}, - expectedMin: 1, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if min := Int64Min(test.nums[0], test.nums[1]); min != test.expectedMin { - t.Errorf("expected %v, got %v", test.expectedMin, min) - } - } -} - -func TestRoundToInt32(t *testing.T) { - tests := []struct { - num float64 - exp int32 - }{ - { - num: 5.5, - exp: 6, - }, - { - num: -3.7, - exp: -4, - }, - { - num: 3.49, - exp: 3, - }, - { - num: -7.9, - exp: -8, - }, - { - num: -4.499999, - exp: -4, - }, - { - num: 0, - exp: 0, - }, - } - - for i, test := range tests { - t.Logf("executing scenario %d", i) - if got := RoundToInt32(test.num); got != test.exp { - t.Errorf("expected %d, got %d", test.exp, got) - } - } -} diff --git a/pkg/util/metrics/BUILD b/pkg/util/metrics/BUILD index a96ec81ed6..f6259fe1ac 100644 --- a/pkg/util/metrics/BUILD +++ b/pkg/util/metrics/BUILD @@ -12,10 +12,10 @@ go_library( srcs = ["util.go"], tags = ["automanaged"], deps = [ - "//pkg/util/flowcontrol:go_default_library", "//vendor:github.com/golang/glog", "//vendor:github.com/prometheus/client_golang/prometheus", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", ], ) diff --git a/pkg/util/metrics/util.go b/pkg/util/metrics/util.go index 8f5bd2eff1..5ec6740447 100644 --- a/pkg/util/metrics/util.go +++ b/pkg/util/metrics/util.go @@ -22,7 +22,7 @@ import ( "time" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/kubernetes/pkg/util/flowcontrol" + "k8s.io/client-go/pkg/util/flowcontrol" "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" diff --git a/pkg/util/workqueue/BUILD b/pkg/util/workqueue/BUILD index 79fecc408d..3ad45aa201 100644 --- a/pkg/util/workqueue/BUILD +++ b/pkg/util/workqueue/BUILD @@ -22,9 +22,9 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/clock:go_default_library", "//vendor:github.com/juju/ratelimit", "//vendor:k8s.io/apimachinery/pkg/util/runtime", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -40,8 +40,8 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/api/v1:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/util/wait", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/pkg/util/workqueue/delaying_queue.go b/pkg/util/workqueue/delaying_queue.go index 7b17da0959..9203a8f3c4 100644 --- a/pkg/util/workqueue/delaying_queue.go +++ b/pkg/util/workqueue/delaying_queue.go @@ -21,7 +21,7 @@ import ( "time" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) // DelayingInterface is an Interface that can Add an item at a later time. This makes it easier to diff --git a/pkg/util/workqueue/delaying_queue_test.go b/pkg/util/workqueue/delaying_queue_test.go index dc5846107d..727949c1b2 100644 --- a/pkg/util/workqueue/delaying_queue_test.go +++ b/pkg/util/workqueue/delaying_queue_test.go @@ -23,7 +23,7 @@ import ( "time" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) func TestSimpleQueue(t *testing.T) { diff --git a/pkg/util/workqueue/rate_limitting_queue_test.go b/pkg/util/workqueue/rate_limitting_queue_test.go index c02b3883f2..f09d2ec9e9 100644 --- a/pkg/util/workqueue/rate_limitting_queue_test.go +++ b/pkg/util/workqueue/rate_limitting_queue_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" ) func TestRateLimitingQueue(t *testing.T) { diff --git a/plugin/pkg/admission/namespace/lifecycle/BUILD b/plugin/pkg/admission/namespace/lifecycle/BUILD index cb1dd0c4e9..cc15a0fa23 100644 --- a/plugin/pkg/admission/namespace/lifecycle/BUILD +++ b/plugin/pkg/admission/namespace/lifecycle/BUILD @@ -18,13 +18,13 @@ go_library( "//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/controller/informers:go_default_library", "//pkg/kubeapiserver/admission:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/glog", "//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apiserver/pkg/admission", "//vendor:k8s.io/apiserver/pkg/util/cache", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -40,12 +40,12 @@ go_test( "//pkg/client/testing/core:go_default_library", "//pkg/controller/informers:go_default_library", "//pkg/kubeapiserver/admission:go_default_library", - "//pkg/util/clock:go_default_library", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apiserver/pkg/admission", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) diff --git a/plugin/pkg/admission/namespace/lifecycle/admission.go b/plugin/pkg/admission/namespace/lifecycle/admission.go index 651025d7c0..9981707aab 100644 --- a/plugin/pkg/admission/namespace/lifecycle/admission.go +++ b/plugin/pkg/admission/namespace/lifecycle/admission.go @@ -28,12 +28,12 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/admission" utilcache "k8s.io/apiserver/pkg/util/cache" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/controller/informers" kubeapiserveradmission "k8s.io/kubernetes/pkg/kubeapiserver/admission" - "k8s.io/kubernetes/pkg/util/clock" ) const ( diff --git a/plugin/pkg/admission/namespace/lifecycle/admission_test.go b/plugin/pkg/admission/namespace/lifecycle/admission_test.go index 0cdc41ee56..a02a8addba 100644 --- a/plugin/pkg/admission/namespace/lifecycle/admission_test.go +++ b/plugin/pkg/admission/namespace/lifecycle/admission_test.go @@ -26,13 +26,13 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/admission" + "k8s.io/client-go/pkg/util/clock" "k8s.io/kubernetes/pkg/api" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/testing/core" "k8s.io/kubernetes/pkg/controller/informers" kubeadmission "k8s.io/kubernetes/pkg/kubeapiserver/admission" - "k8s.io/kubernetes/pkg/util/clock" ) // newHandlerForTest returns a configured handler for testing. diff --git a/staging/copy.sh b/staging/copy.sh index 813b89081c..a06a91d5af 100755 --- a/staging/copy.sh +++ b/staging/copy.sh @@ -72,6 +72,9 @@ function save() { save "transport" save "tools/clientcmd/api" save "rest/watch" +save "pkg/util/clock" +save "pkg/util/integer" +save "pkg/util/flowcontrol" diff --git a/staging/src/k8s.io/apiserver/pkg/util/cache/lruexpirecache_test.go b/staging/src/k8s.io/apiserver/pkg/util/cache/lruexpirecache_test.go index 35c538d48b..90b394d6ff 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/cache/lruexpirecache_test.go +++ b/staging/src/k8s.io/apiserver/pkg/util/cache/lruexpirecache_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util/clock" + "k8s.io/client-go/pkg/util/clock" "github.com/golang/groupcache/lru" ) diff --git a/test/e2e/BUILD b/test/e2e/BUILD index dbc1005951..6705ffba50 100644 --- a/test/e2e/BUILD +++ b/test/e2e/BUILD @@ -143,7 +143,6 @@ go_library( "//pkg/security/apparmor:go_default_library", "//pkg/util:go_default_library", "//pkg/util/exec:go_default_library", - "//pkg/util/flowcontrol:go_default_library", "//pkg/util/intstr:go_default_library", "//pkg/util/logs:go_default_library", "//pkg/util/system:go_default_library", @@ -196,6 +195,7 @@ go_library( "//vendor:k8s.io/client-go/pkg/api/v1", "//vendor:k8s.io/client-go/pkg/apis/extensions/v1beta1", "//vendor:k8s.io/client-go/pkg/apis/policy/v1beta1", + "//vendor:k8s.io/client-go/pkg/util/flowcontrol", "//vendor:k8s.io/client-go/pkg/util/intstr", "//vendor:k8s.io/client-go/transport", ], diff --git a/test/e2e/service_latency.go b/test/e2e/service_latency.go index b1c9b86cb9..59a18d7931 100644 --- a/test/e2e/service_latency.go +++ b/test/e2e/service_latency.go @@ -26,10 +26,10 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/restclient" - "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/test/e2e/framework" testutils "k8s.io/kubernetes/test/utils" diff --git a/vendor/BUILD b/vendor/BUILD index b4ba2040f9..04de24ff76 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -9084,8 +9084,8 @@ go_test( library = ":k8s.io/apiserver/pkg/util/cache", tags = ["automanaged"], deps = [ - "//pkg/util/clock:go_default_library", "//vendor:github.com/golang/groupcache/lru", + "//vendor:k8s.io/client-go/pkg/util/clock", ], ) @@ -13638,82 +13638,3 @@ go_library( "//vendor:k8s.io/client-go/pkg/apis/rbac", ], ) - -go_library( - name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1", - srcs = [ - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/runtime/serializer", - "//vendor:k8s.io/apimachinery/pkg/types", - "//vendor:k8s.io/apimachinery/pkg/watch", - "//vendor:k8s.io/client-go/pkg/api", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", - "//vendor:k8s.io/client-go/rest", - ], -) - -go_library( - name = "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake", - srcs = [ - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/doc.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrole.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_clusterrolebinding.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rbac_client.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_role.go", - "k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake/fake_rolebinding.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/labels", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/types", - "//vendor:k8s.io/apimachinery/pkg/watch", - "//vendor:k8s.io/client-go/kubernetes/typed/rbac/v1beta1", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/apis/rbac/v1beta1", - "//vendor:k8s.io/client-go/rest", - "//vendor:k8s.io/client-go/testing", - ], -) - -go_library( - name = "k8s.io/client-go/pkg/apis/rbac/v1beta1", - srcs = [ - "k8s.io/client-go/pkg/apis/rbac/v1beta1/defaults.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/doc.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/generated.pb.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/helpers.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/register.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.generated.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/types.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/types_swagger_doc_generated.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.conversion.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.deepcopy.go", - "k8s.io/client-go/pkg/apis/rbac/v1beta1/zz_generated.defaults.go", - ], - tags = ["automanaged"], - deps = [ - "//vendor:github.com/gogo/protobuf/proto", - "//vendor:github.com/ugorji/go/codec", - "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", - "//vendor:k8s.io/apimachinery/pkg/conversion", - "//vendor:k8s.io/apimachinery/pkg/runtime", - "//vendor:k8s.io/apimachinery/pkg/runtime/schema", - "//vendor:k8s.io/apimachinery/pkg/types", - "//vendor:k8s.io/client-go/pkg/api/v1", - "//vendor:k8s.io/client-go/pkg/apis/rbac", - ], -)