From bb6b087a06b92b8ab6d6084b79373b506ea40845 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Thu, 25 Aug 2016 15:06:27 -0700 Subject: [PATCH 1/4] some improvement to client-gen --- .../client-gen/generators/client_generator.go | 17 +++++++---------- .../generators/generator_for_expansion.go | 8 +++++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cmd/libs/go2idl/client-gen/generators/client_generator.go b/cmd/libs/go2idl/client-gen/generators/client_generator.go index ac55f9e7768..dc79dfb607d 100644 --- a/cmd/libs/go2idl/client-gen/generators/client_generator.go +++ b/cmd/libs/go2idl/client-gen/generators/client_generator.go @@ -19,7 +19,6 @@ package generators import ( "fmt" - "os" "path/filepath" "strings" @@ -107,15 +106,13 @@ func packageForGroup(gv unversioned.GroupVersion, typeList []*types.Type, packag }) expansionFileName := "generated_expansion" - // To avoid overriding user's manual modification, only generate the expansion file if it doesn't exist. - if _, err := os.Stat(filepath.Join(srcTreePath, outputPackagePath, expansionFileName+".go")); os.IsNotExist(err) { - generators = append(generators, &genExpansion{ - DefaultGen: generator.DefaultGen{ - OptionalName: expansionFileName, - }, - types: typeList, - }) - } + generators = append(generators, &genExpansion{ + groupPath: filepath.Join(srcTreePath, outputPackagePath), + DefaultGen: generator.DefaultGen{ + OptionalName: expansionFileName, + }, + types: typeList, + }) return generators }, diff --git a/cmd/libs/go2idl/client-gen/generators/generator_for_expansion.go b/cmd/libs/go2idl/client-gen/generators/generator_for_expansion.go index 20753b5bb8e..b255f4cc994 100644 --- a/cmd/libs/go2idl/client-gen/generators/generator_for_expansion.go +++ b/cmd/libs/go2idl/client-gen/generators/generator_for_expansion.go @@ -18,6 +18,9 @@ package generators import ( "io" + "os" + "path/filepath" + "strings" "k8s.io/kubernetes/cmd/libs/go2idl/generator" "k8s.io/kubernetes/cmd/libs/go2idl/types" @@ -26,6 +29,7 @@ import ( // genExpansion produces a file for a group client, e.g. ExtensionsClient for the extension group. type genExpansion struct { generator.DefaultGen + groupPath string // types in a group types []*types.Type } @@ -38,7 +42,9 @@ func (g *genExpansion) Filter(c *generator.Context, t *types.Type) bool { func (g *genExpansion) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { sw := generator.NewSnippetWriter(w, c, "$", "$") for _, t := range g.types { - sw.Do(expansionInterfaceTemplate, t) + if _, err := os.Stat(filepath.Join(g.groupPath, strings.ToLower(t.Name.Name+"_expansion.go"))); os.IsNotExist(err) { + sw.Do(expansionInterfaceTemplate, t) + } } return sw.Error() } From 74a424129fb717dcd2a443a80250f92a64e606c3 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Thu, 25 Aug 2016 15:22:16 -0700 Subject: [PATCH 2/4] make subjectaccessreview expansion follow the convention --- .../unversioned/generated_expansion.go | 18 ---------- .../unversioned/tokenreview_expansion.go | 35 ++++++++++++++++++ .../subjectaccessreview_expansion.go | 36 +++++++++++++++++++ ... => fake_subjectaccessreview_expansion.go} | 0 .../v1beta1/subjectaccessreview_expansion.go | 36 +++++++++++++++++++ 5 files changed, 107 insertions(+), 18 deletions(-) create mode 100644 pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/tokenreview_expansion.go create mode 100644 pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/subjectaccessreview_expansion.go rename pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/fake/{fake_generated_expansion.go => fake_subjectaccessreview_expansion.go} (100%) create mode 100644 pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/subjectaccessreview_expansion.go diff --git a/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/generated_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/generated_expansion.go index 1137e520467..6cdbfc5bcda 100644 --- a/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/generated_expansion.go +++ b/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/generated_expansion.go @@ -15,21 +15,3 @@ limitations under the License. */ package unversioned - -import ( - authenticationapi "k8s.io/kubernetes/pkg/apis/authentication" -) - -type TokenReviewExpansion interface { - Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) -} - -func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { - result = &authenticationapi.TokenReview{} - err = c.client.Post(). - Resource("tokenreviews"). - Body(tokenReview). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/tokenreview_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/tokenreview_expansion.go new file mode 100644 index 00000000000..1137e520467 --- /dev/null +++ b/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned/tokenreview_expansion.go @@ -0,0 +1,35 @@ +/* +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 unversioned + +import ( + authenticationapi "k8s.io/kubernetes/pkg/apis/authentication" +) + +type TokenReviewExpansion interface { + Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) +} + +func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { + result = &authenticationapi.TokenReview{} + err = c.client.Post(). + Resource("tokenreviews"). + Body(tokenReview). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/subjectaccessreview_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/subjectaccessreview_expansion.go new file mode 100644 index 00000000000..16a170ece21 --- /dev/null +++ b/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/subjectaccessreview_expansion.go @@ -0,0 +1,36 @@ +/* +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 unversioned + +import ( + authorizationapi "k8s.io/kubernetes/pkg/apis/authorization" +) + +// The PodExpansion interface allows manually adding extra methods to the PodInterface. +type SubjectAccessReviewExpansion interface { + Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) +} + +func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { + result = &authorizationapi.SubjectAccessReview{} + err = c.client.Post(). + Resource("subjectaccessreviews"). + Body(sar). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/fake/fake_generated_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/fake/fake_subjectaccessreview_expansion.go similarity index 100% rename from pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/fake/fake_generated_expansion.go rename to pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/fake/fake_subjectaccessreview_expansion.go diff --git a/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/subjectaccessreview_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/subjectaccessreview_expansion.go new file mode 100644 index 00000000000..bf57a7b07d8 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/subjectaccessreview_expansion.go @@ -0,0 +1,36 @@ +/* +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 + +import ( + authorizationapi "k8s.io/kubernetes/pkg/apis/authorization/v1beta1" +) + +// The SubjectAccessReviewExpansion interface allows manually adding extra methods to the AuthorizationInterface. +type SubjectAccessReviewExpansion interface { + Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) +} + +func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { + result = &authorizationapi.SubjectAccessReview{} + err = c.client.Post(). + Resource("subjectaccessreviews"). + Body(sar). + Do(). + Into(result) + return +} From bf578f1bc2e5dbbbb0c767fa83ef79f4155958c0 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Thu, 25 Aug 2016 15:25:48 -0700 Subject: [PATCH 3/4] run client-gen --- .../core/unversioned/generated_expansion.go | 4 +- .../unversioned/generated_expansion.go | 4 +- .../typed/core/v1/generated_expansion.go | 4 +- .../extensions/v1beta1/generated_expansion.go | 4 +- .../unversioned/generated_expansion.go | 19 -- .../core/unversioned/generated_expansion.go | 4 +- .../unversioned/generated_expansion.go | 8 +- .../typed/extensions/unversioned/job.go | 150 ---------------- .../v1beta1/generated_expansion.go | 19 -- .../typed/core/v1/event_expansion.go | 162 ++++++++++++++++++ .../core/v1/fake/fake_event_expansion.go | 89 ++++++++++ .../core/v1/fake/fake_namespace_expansion.go | 37 ++++ .../typed/core/v1/fake/fake_pod_expansion.go | 46 +++++ .../core/v1/fake/fake_service_expansion.go | 26 +++ .../typed/core/v1/generated_expansion.go | 8 - .../typed/core/v1/namespace_expansion.go | 31 ++++ .../typed/core/v1/pod_expansion.go | 39 +++++ .../typed/core/v1/service_expansion.go | 41 +++++ .../v1beta1/deployment_expansion.go | 29 ++++ .../v1beta1/fake/fake_deployment_expansion.go | 33 ++++ .../extensions/v1beta1/generated_expansion.go | 6 +- 21 files changed, 547 insertions(+), 216 deletions(-) delete mode 100644 pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/job.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/event_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_event_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_namespace_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_pod_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_service_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/namespace_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/core/v1/service_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/deployment_expansion.go create mode 100644 pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/fake/fake_deployment_expansion.go diff --git a/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned/generated_expansion.go b/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned/generated_expansion.go index 93dc6d30b7d..a4f969d06b9 100644 --- a/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned/generated_expansion.go +++ b/federation/client/clientset_generated/federation_internalclientset/typed/core/unversioned/generated_expansion.go @@ -16,8 +16,8 @@ limitations under the License. package unversioned -type SecretExpansion interface{} - type EventExpansion interface{} +type SecretExpansion interface{} + type ServiceExpansion interface{} diff --git a/federation/client/clientset_generated/federation_internalclientset/typed/extensions/unversioned/generated_expansion.go b/federation/client/clientset_generated/federation_internalclientset/typed/extensions/unversioned/generated_expansion.go index 6e5e319a809..65499890114 100644 --- a/federation/client/clientset_generated/federation_internalclientset/typed/extensions/unversioned/generated_expansion.go +++ b/federation/client/clientset_generated/federation_internalclientset/typed/extensions/unversioned/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. package unversioned -type ReplicaSetExpansion interface{} - type IngressExpansion interface{} + +type ReplicaSetExpansion interface{} diff --git a/federation/client/clientset_generated/federation_release_1_4/typed/core/v1/generated_expansion.go b/federation/client/clientset_generated/federation_release_1_4/typed/core/v1/generated_expansion.go index 4bb1f8915ba..da7904b2bbf 100644 --- a/federation/client/clientset_generated/federation_release_1_4/typed/core/v1/generated_expansion.go +++ b/federation/client/clientset_generated/federation_release_1_4/typed/core/v1/generated_expansion.go @@ -16,8 +16,8 @@ limitations under the License. package v1 -type SecretExpansion interface{} - type EventExpansion interface{} +type SecretExpansion interface{} + type ServiceExpansion interface{} diff --git a/federation/client/clientset_generated/federation_release_1_4/typed/extensions/v1beta1/generated_expansion.go b/federation/client/clientset_generated/federation_release_1_4/typed/extensions/v1beta1/generated_expansion.go index 4e9cf3bf024..333d2262ccb 100644 --- a/federation/client/clientset_generated/federation_release_1_4/typed/extensions/v1beta1/generated_expansion.go +++ b/federation/client/clientset_generated/federation_release_1_4/typed/extensions/v1beta1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. package v1beta1 -type ReplicaSetExpansion interface{} - type IngressExpansion interface{} + +type ReplicaSetExpansion interface{} diff --git a/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/generated_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/generated_expansion.go index 16a170ece21..6cdbfc5bcda 100644 --- a/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/generated_expansion.go +++ b/pkg/client/clientset_generated/internalclientset/typed/authorization/unversioned/generated_expansion.go @@ -15,22 +15,3 @@ limitations under the License. */ package unversioned - -import ( - authorizationapi "k8s.io/kubernetes/pkg/apis/authorization" -) - -// The PodExpansion interface allows manually adding extra methods to the PodInterface. -type SubjectAccessReviewExpansion interface { - Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) -} - -func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { - result = &authorizationapi.SubjectAccessReview{} - err = c.client.Post(). - Resource("subjectaccessreviews"). - Body(sar). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go index a61fba53a34..25241159766 100644 --- a/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go +++ b/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/generated_expansion.go @@ -18,6 +18,8 @@ package unversioned type ComponentStatusExpansion interface{} +type ConfigMapExpansion interface{} + type EndpointsExpansion interface{} type LimitRangeExpansion interface{} @@ -35,5 +37,3 @@ type ResourceQuotaExpansion interface{} type SecretExpansion interface{} type ServiceAccountExpansion interface{} - -type ConfigMapExpansion interface{} diff --git a/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/generated_expansion.go b/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/generated_expansion.go index b795deed192..34401f543b6 100644 --- a/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/generated_expansion.go +++ b/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/generated_expansion.go @@ -18,16 +18,12 @@ package unversioned type DaemonSetExpansion interface{} -type HorizontalPodAutoscalerExpansion interface{} - type IngressExpansion interface{} -type JobExpansion interface{} - type PodSecurityPolicyExpansion interface{} -type ThirdPartyResourceExpansion interface{} - type ReplicaSetExpansion interface{} type StorageClassExpansion interface{} + +type ThirdPartyResourceExpansion interface{} diff --git a/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/job.go b/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/job.go deleted file mode 100644 index f0411862bd4..00000000000 --- a/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/job.go +++ /dev/null @@ -1,150 +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 unversioned - -import ( - api "k8s.io/kubernetes/pkg/api" - batch "k8s.io/kubernetes/pkg/apis/batch" - watch "k8s.io/kubernetes/pkg/watch" -) - -// JobsGetter has a method to return a JobInterface. -// A group's client should implement this interface. -type JobsGetter interface { - Jobs(namespace string) JobInterface -} - -// JobInterface has methods to work with Job resources. -type JobInterface interface { - Create(*batch.Job) (*batch.Job, error) - Update(*batch.Job) (*batch.Job, error) - UpdateStatus(*batch.Job) (*batch.Job, error) - Delete(name string, options *api.DeleteOptions) error - DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error - Get(name string) (*batch.Job, error) - List(opts api.ListOptions) (*batch.JobList, error) - Watch(opts api.ListOptions) (watch.Interface, error) - JobExpansion -} - -// jobs implements JobInterface -type jobs struct { - client *ExtensionsClient - ns string -} - -// newJobs returns a Jobs -func newJobs(c *ExtensionsClient, namespace string) *jobs { - return &jobs{ - client: c, - ns: namespace, - } -} - -// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. -func (c *jobs) Create(job *batch.Job) (result *batch.Job, err error) { - result = &batch.Job{} - err = c.client.Post(). - Namespace(c.ns). - Resource("jobs"). - Body(job). - Do(). - Into(result) - return -} - -// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. -func (c *jobs) Update(job *batch.Job) (result *batch.Job, err error) { - result = &batch.Job{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jobs"). - Name(job.Name). - Body(job). - Do(). - Into(result) - return -} - -func (c *jobs) UpdateStatus(job *batch.Job) (result *batch.Job, err error) { - result = &batch.Job{} - err = c.client.Put(). - Namespace(c.ns). - Resource("jobs"). - Name(job.Name). - SubResource("status"). - Body(job). - Do(). - Into(result) - return -} - -// Delete takes name of the job and deletes it. Returns an error if one occurs. -func (c *jobs) Delete(name string, options *api.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("jobs"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *jobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("jobs"). - VersionedParams(&listOptions, api.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Get takes name of the job, and returns the corresponding job object, and an error if there is any. -func (c *jobs) Get(name string) (result *batch.Job, err error) { - result = &batch.Job{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jobs"). - Name(name). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Jobs that match those selectors. -func (c *jobs) List(opts api.ListOptions) (result *batch.JobList, err error) { - result = &batch.JobList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("jobs"). - VersionedParams(&opts, api.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested jobs. -func (c *jobs) Watch(opts api.ListOptions) (watch.Interface, error) { - return c.client.Get(). - Prefix("watch"). - Namespace(c.ns). - Resource("jobs"). - VersionedParams(&opts, api.ParameterCodec). - Watch() -} diff --git a/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/generated_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/generated_expansion.go index ce0a6a929f9..a397b30e92d 100644 --- a/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/generated_expansion.go +++ b/pkg/client/clientset_generated/release_1_4/typed/authorization/v1beta1/generated_expansion.go @@ -15,22 +15,3 @@ limitations under the License. */ package v1beta1 - -import ( - authorizationapi "k8s.io/kubernetes/pkg/apis/authorization/v1beta1" -) - -// The PodExpansion interface allows manually adding extra methods to the PodInterface. -type SubjectAccessReviewExpansion interface { - Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) -} - -func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { - result = &authorizationapi.SubjectAccessReview{} - err = c.client.Post(). - Resource("subjectaccessreviews"). - Body(sar). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/event_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/event_expansion.go new file mode 100644 index 00000000000..f9769defcf0 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/event_expansion.go @@ -0,0 +1,162 @@ +/* +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 v1 + +import ( + "fmt" + + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/runtime" +) + +// The EventExpansion interface allows manually adding extra methods to the EventInterface. +type EventExpansion interface { + // CreateWithEventNamespace is the same as a Create, except that it sends the request to the event.Namespace. + CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) + // UpdateWithEventNamespace is the same as a Update, except that it sends the request to the event.Namespace. + UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) + PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) + // Search finds events about the specified object + Search(objOrRef runtime.Object) (*v1.EventList, error) + // Returns the appropriate field selector based on the API version being used to communicate with the server. + // The returned field selector can be used with List and Watch to filter desired events. + GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector +} + +// CreateWithEventNamespace makes a new event. Returns the copy of the event the server returns, +// or an error. The namespace to create the event within is deduced from the +// event; it must either match this event client's namespace, or this event +// client must have been created with the "" namespace. +func (e *events) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) { + if e.ns != "" && event.Namespace != e.ns { + return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.ns) + } + result := &v1.Event{} + err := e.client.Post(). + NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Resource("events"). + Body(event). + Do(). + Into(result) + return result, err +} + +// UpdateWithEventNamespace modifies an existing event. It returns the copy of the event that the server returns, +// or an error. The namespace and key to update the event within is deduced from the event. The +// namespace must either match this event client's namespace, or this event client must have been +// created with the "" namespace. Update also requires the ResourceVersion to be set in the event +// object. +func (e *events) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) { + result := &v1.Event{} + err := e.client.Put(). + NamespaceIfScoped(event.Namespace, len(event.Namespace) > 0). + Resource("events"). + Name(event.Name). + Body(event). + Do(). + Into(result) + return result, err +} + +// PatchWithEventNamespace modifies an existing event. It returns the copy of +// the event that the server returns, or an error. The namespace and name of the +// target event is deduced from the incompleteEvent. The namespace must either +// match this event client's namespace, or this event client must have been +// created with the "" namespace. +func (e *events) PatchWithEventNamespace(incompleteEvent *v1.Event, data []byte) (*v1.Event, error) { + if e.ns != "" && incompleteEvent.Namespace != e.ns { + return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", incompleteEvent.Namespace, e.ns) + } + result := &v1.Event{} + err := e.client.Patch(api.StrategicMergePatchType). + NamespaceIfScoped(incompleteEvent.Namespace, len(incompleteEvent.Namespace) > 0). + Resource("events"). + Name(incompleteEvent.Name). + Body(data). + Do(). + Into(result) + return result, err +} + +// Search finds events about the specified object. The namespace of the +// object must match this event's client namespace unless the event client +// was made with the "" namespace. +func (e *events) Search(objOrRef runtime.Object) (*v1.EventList, error) { + ref, err := api.GetReference(objOrRef) + if err != nil { + return nil, err + } + if e.ns != "" && ref.Namespace != e.ns { + return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.ns) + } + stringRefKind := string(ref.Kind) + var refKind *string + if stringRefKind != "" { + refKind = &stringRefKind + } + stringRefUID := string(ref.UID) + var refUID *string + if stringRefUID != "" { + refUID = &stringRefUID + } + fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID) + return e.List(api.ListOptions{FieldSelector: fieldSelector}) +} + +// Returns the appropriate field selector based on the API version being used to communicate with the server. +// The returned field selector can be used with List and Watch to filter desired events. +func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector { + apiVersion := e.client.APIVersion().String() + field := fields.Set{} + if involvedObjectName != nil { + field[GetInvolvedObjectNameFieldLabel(apiVersion)] = *involvedObjectName + } + if involvedObjectNamespace != nil { + field["involvedObject.namespace"] = *involvedObjectNamespace + } + if involvedObjectKind != nil { + field["involvedObject.kind"] = *involvedObjectKind + } + if involvedObjectUID != nil { + field["involvedObject.uid"] = *involvedObjectUID + } + return field.AsSelector() +} + +// Returns the appropriate field label to use for name of the involved object as per the given API version. +func GetInvolvedObjectNameFieldLabel(version string) string { + return "involvedObject.name" +} + +// TODO: This is a temporary arrangement and will be removed once all clients are moved to use the clientset. +type EventSinkImpl struct { + Interface EventInterface +} + +func (e *EventSinkImpl) Create(event *v1.Event) (*v1.Event, error) { + return e.Interface.CreateWithEventNamespace(event) +} + +func (e *EventSinkImpl) Update(event *v1.Event) (*v1.Event, error) { + return e.Interface.UpdateWithEventNamespace(event) +} + +func (e *EventSinkImpl) Patch(event *v1.Event, data []byte) (*v1.Event, error) { + return e.Interface.PatchWithEventNamespace(event, data) +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_event_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_event_expansion.go new file mode 100644 index 00000000000..a004bed7f69 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_event_expansion.go @@ -0,0 +1,89 @@ +/* +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 fake + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/testing/core" + "k8s.io/kubernetes/pkg/fields" + "k8s.io/kubernetes/pkg/runtime" +) + +func (c *FakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) { + action := core.NewRootCreateAction(eventsResource, event) + if c.ns != "" { + action = core.NewCreateAction(eventsResource, c.ns, event) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*v1.Event), err +} + +// Update replaces an existing event. Returns the copy of the event the server returns, or an error. +func (c *FakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) { + action := core.NewRootUpdateAction(eventsResource, event) + if c.ns != "" { + action = core.NewUpdateAction(eventsResource, c.ns, event) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*v1.Event), err +} + +// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error. +func (c *FakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.Event, error) { + action := core.NewRootPatchAction(eventsResource, event.Name, data) + if c.ns != "" { + action = core.NewPatchAction(eventsResource, c.ns, event.Name, data) + } + obj, err := c.Fake.Invokes(action, event) + if obj == nil { + return nil, err + } + + return obj.(*v1.Event), err +} + +// Search returns a list of events matching the specified object. +func (c *FakeEvents) Search(objOrRef runtime.Object) (*v1.EventList, error) { + action := core.NewRootListAction(eventsResource, api.ListOptions{}) + if c.ns != "" { + action = core.NewListAction(eventsResource, c.ns, api.ListOptions{}) + } + obj, err := c.Fake.Invokes(action, &v1.EventList{}) + if obj == nil { + return nil, err + } + + return obj.(*v1.EventList), err +} + +func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector { + action := core.GenericActionImpl{} + action.Verb = "get-field-selector" + action.Resource = eventsResource + + c.Fake.Invokes(action, nil) + return fields.Everything() +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_namespace_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_namespace_expansion.go new file mode 100644 index 00000000000..c3ea410ad50 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_namespace_expansion.go @@ -0,0 +1,37 @@ +/* +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 fake + +import ( + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeNamespaces) Finalize(namespace *v1.Namespace) (*v1.Namespace, error) { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = namespacesResource + action.Subresource = "finalize" + action.Object = namespace + + obj, err := c.Fake.Invokes(action, namespace) + if obj == nil { + return nil, err + } + + return obj.(*v1.Namespace), err +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_pod_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_pod_expansion.go new file mode 100644 index 00000000000..a166f756cea --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_pod_expansion.go @@ -0,0 +1,46 @@ +/* +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 fake + +import ( + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/restclient" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakePods) Bind(binding *v1.Binding) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = podsResource + action.Subresource = "bindings" + action.Object = binding + + _, err := c.Fake.Invokes(action, binding) + return err +} + +func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request { + action := core.GenericActionImpl{} + action.Verb = "get" + action.Namespace = c.ns + action.Resource = podsResource + action.Subresource = "logs" + action.Value = opts + + _, _ = c.Fake.Invokes(action, &v1.Pod{}) + return &restclient.Request{} +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_service_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_service_expansion.go new file mode 100644 index 00000000000..978585f670b --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/fake/fake_service_expansion.go @@ -0,0 +1,26 @@ +/* +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 fake + +import ( + "k8s.io/kubernetes/pkg/client/restclient" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper { + return c.Fake.InvokesProxy(core.NewProxyGetAction(servicesResource, c.ns, scheme, name, port, path, params)) +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/generated_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/generated_expansion.go index 88037070442..ed8385aab71 100644 --- a/pkg/client/clientset_generated/release_1_4/typed/core/v1/generated_expansion.go +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/generated_expansion.go @@ -22,18 +22,12 @@ type ConfigMapExpansion interface{} type EndpointsExpansion interface{} -type EventExpansion interface{} - type LimitRangeExpansion interface{} -type NamespaceExpansion interface{} - type NodeExpansion interface{} type PersistentVolumeExpansion interface{} -type PodExpansion interface{} - type PodTemplateExpansion interface{} type ReplicationControllerExpansion interface{} @@ -42,6 +36,4 @@ type ResourceQuotaExpansion interface{} type SecretExpansion interface{} -type ServiceExpansion interface{} - type ServiceAccountExpansion interface{} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/namespace_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/namespace_expansion.go new file mode 100644 index 00000000000..36de2beeaa5 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/namespace_expansion.go @@ -0,0 +1,31 @@ +/* +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 v1 + +import "k8s.io/kubernetes/pkg/api/v1" + +// The NamespaceExpansion interface allows manually adding extra methods to the NamespaceInterface. +type NamespaceExpansion interface { + Finalize(item *v1.Namespace) (*v1.Namespace, error) +} + +// Finalize takes the representation of a namespace to update. Returns the server's representation of the namespace, and an error, if it occurs. +func (c *namespaces) Finalize(namespace *v1.Namespace) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Put().Resource("namespaces").Name(namespace.Name).SubResource("finalize").Body(namespace).Do().Into(result) + return +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go new file mode 100644 index 00000000000..fba1fd069cc --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go @@ -0,0 +1,39 @@ +/* +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 v1 + +import ( + "k8s.io/kubernetes/pkg/api" + "k8s.io/kubernetes/pkg/api/v1" + "k8s.io/kubernetes/pkg/client/restclient" +) + +// The PodExpansion interface allows manually adding extra methods to the PodInterface. +type PodExpansion interface { + Bind(binding *v1.Binding) error + GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request +} + +// Bind applies the provided binding to the named pod in the current namespace (binding.Namespace is ignored). +func (c *pods) Bind(binding *v1.Binding) error { + return c.client.Post().Namespace(c.ns).Resource("pods").Name(binding.Name).SubResource("binding").Body(binding).Do().Error() +} + +// Get constructs a request for getting the logs for a pod +func (c *pods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request { + return c.client.Get().Namespace(c.ns).Name(name).Resource("pods").SubResource("log").VersionedParams(opts, api.ParameterCodec) +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/core/v1/service_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/core/v1/service_expansion.go new file mode 100644 index 00000000000..ce53e419528 --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/core/v1/service_expansion.go @@ -0,0 +1,41 @@ +/* +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 v1 + +import ( + "k8s.io/kubernetes/pkg/client/restclient" + "k8s.io/kubernetes/pkg/util/net" +) + +// The ServiceExpansion interface allows manually adding extra methods to the ServiceInterface. +type ServiceExpansion interface { + ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper +} + +// ProxyGet returns a response of the service by calling it through the proxy. +func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper { + request := c.client.Get(). + Prefix("proxy"). + Namespace(c.ns). + Resource("services"). + Name(net.JoinSchemeNamePort(scheme, name, port)). + Suffix(path) + for k, v := range params { + request = request.Param(k, v) + } + return request +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/deployment_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/deployment_expansion.go new file mode 100644 index 00000000000..cd3cd1027ed --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/deployment_expansion.go @@ -0,0 +1,29 @@ +/* +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 + +import "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" + +// The DeploymentExpansion interface allows manually adding extra methods to the DeploymentInterface. +type DeploymentExpansion interface { + Rollback(*v1beta1.DeploymentRollback) error +} + +// Rollback applied the provided DeploymentRollback to the named deployment in the current namespace. +func (c *deployments) Rollback(deploymentRollback *v1beta1.DeploymentRollback) error { + return c.client.Post().Namespace(c.ns).Resource("deployments").Name(deploymentRollback.Name).SubResource("rollback").Body(deploymentRollback).Do().Error() +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/fake/fake_deployment_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/fake/fake_deployment_expansion.go new file mode 100644 index 00000000000..37836278aea --- /dev/null +++ b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/fake/fake_deployment_expansion.go @@ -0,0 +1,33 @@ +/* +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 fake + +import ( + "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" + "k8s.io/kubernetes/pkg/client/testing/core" +) + +func (c *FakeDeployments) Rollback(deploymentRollback *v1beta1.DeploymentRollback) error { + action := core.CreateActionImpl{} + action.Verb = "create" + action.Resource = deploymentsResource + action.Subresource = "rollback" + action.Object = deploymentRollback + + _, err := c.Fake.Invokes(action, deploymentRollback) + return err +} diff --git a/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/generated_expansion.go b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/generated_expansion.go index 9dc1322af16..ece8b6c7aec 100644 --- a/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/generated_expansion.go +++ b/pkg/client/clientset_generated/release_1_4/typed/extensions/v1beta1/generated_expansion.go @@ -18,8 +18,6 @@ package v1beta1 type DaemonSetExpansion interface{} -type DeploymentExpansion interface{} - type IngressExpansion interface{} type JobExpansion interface{} @@ -28,6 +26,6 @@ type PodSecurityPolicyExpansion interface{} type ReplicaSetExpansion interface{} -type ThirdPartyResourceExpansion interface{} - type StorageClassExpansion interface{} + +type ThirdPartyResourceExpansion interface{} From 889b100e63cb86b2963a8e8664b5f2911545fe92 Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Thu, 25 Aug 2016 15:40:03 -0700 Subject: [PATCH 4/4] update readme --- docs/devel/generating-clientset.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/devel/generating-clientset.md b/docs/devel/generating-clientset.md index 4fd3044c0e0..35d04d74abf 100644 --- a/docs/devel/generating-clientset.md +++ b/docs/devel/generating-clientset.md @@ -62,12 +62,16 @@ will generate a clientset named "my_release" which includes clients for api/v1 objects and extensions/v1beta1 objects. You can run `$ client-gen --help` to see other command line arguments. -- Adding expansion methods: client-gen only generates the common methods, such -as `Create()` and `Delete()`. You can manually add additional methods through -the expansion interface. For example, this -[file](../../pkg/client/clientset_generated/release_1_2/typed/core/v1/pod_expansion.go) -adds additional methods to Pod's client. As a convention, we put the expansion -interface and its methods in file ${TYPE}_expansion.go. +- ***Adding expansion methods***: client-gen only generates the common methods, + such as `Create()` and `Delete()`. You can manually add additional methods + through the expansion interface. For example, this + [file](../../pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go) + adds additional methods to Pod's client. As a convention, we put the expansion + interface and its methods in file ${TYPE}_expansion.go. In most cases, you + don't want to remove existing expansion files. So to make life easier, + instead of creating a new clientset from scratch, ***you can copy and rename an + existing clientset (so that all the expansion files are copied)***, and then run + client-gen. - Generating fake clients for testing purposes: client-gen will generate a fake clientset if the command line argument `--fake-clientset` is set. The fake