mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	Merge pull request #31470 from caesarxuchao/regenerate-release-1-4
Automatic merge from submit-queue Fix missing expansion files in clientset release 1.4 <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: Fix missing expansion files in clientset release 1.4; Update the client-gen tool to automatically update generated_expansion.go; Update the readme to document the best practice of using client-gen. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # https://github.com/kubernetes/kubernetes/issues/29698#issuecomment-241315798 **Special notes for your reviewer**: **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note ``` cc @lavalamp @krousey @mbohlool
This commit is contained in:
		| @@ -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{ | ||||
| 				groupPath: filepath.Join(srcTreePath, outputPackagePath), | ||||
| 				DefaultGen: generator.DefaultGen{ | ||||
| 					OptionalName: expansionFileName, | ||||
| 				}, | ||||
| 				types: typeList, | ||||
| 			}) | ||||
| 			} | ||||
|  | ||||
| 			return generators | ||||
| 		}, | ||||
|   | ||||
| @@ -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,8 +42,10 @@ 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 { | ||||
| 		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() | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -16,8 +16,8 @@ limitations under the License. | ||||
|  | ||||
| package unversioned | ||||
|  | ||||
| type SecretExpansion interface{} | ||||
|  | ||||
| type EventExpansion interface{} | ||||
|  | ||||
| type SecretExpansion interface{} | ||||
|  | ||||
| type ServiceExpansion interface{} | ||||
|   | ||||
| @@ -16,6 +16,6 @@ limitations under the License. | ||||
|  | ||||
| package unversioned | ||||
|  | ||||
| type ReplicaSetExpansion interface{} | ||||
|  | ||||
| type IngressExpansion interface{} | ||||
|  | ||||
| type ReplicaSetExpansion interface{} | ||||
|   | ||||
| @@ -16,8 +16,8 @@ limitations under the License. | ||||
|  | ||||
| package v1 | ||||
|  | ||||
| type SecretExpansion interface{} | ||||
|  | ||||
| type EventExpansion interface{} | ||||
|  | ||||
| type SecretExpansion interface{} | ||||
|  | ||||
| type ServiceExpansion interface{} | ||||
|   | ||||
| @@ -16,6 +16,6 @@ limitations under the License. | ||||
|  | ||||
| package v1beta1 | ||||
|  | ||||
| type ReplicaSetExpansion interface{} | ||||
|  | ||||
| type IngressExpansion interface{} | ||||
|  | ||||
| type ReplicaSetExpansion interface{} | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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{} | ||||
|   | ||||
| @@ -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{} | ||||
|   | ||||
| @@ -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() | ||||
| } | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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) | ||||
| } | ||||
| @@ -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() | ||||
| } | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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{} | ||||
| } | ||||
| @@ -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)) | ||||
| } | ||||
| @@ -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{} | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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) | ||||
| } | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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() | ||||
| } | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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{} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user