Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add an example to show how to use status subresources with custom resources. - Update the comment in the controller to mention that `UpdateStatus` can now be used. - Generate `UpdateStatus` for Foo. - Update the README to remove feature gate information for CRD validation since the current example requires a v1.9 cluster and it is enabled by default. - Update the README to add feature gate information for CustomResourceSubResources. Kubernetes-commit: 7c06d6fb17ee46f587c1facff93b9bb185522855
54 lines (41 sloc)
1.43 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2017 The Kubernetes Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
) | |
// +genclient | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// Foo is a specification for a Foo resource | |
type Foo struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
Spec FooSpec `json:"spec"` | |
Status FooStatus `json:"status"` | |
} | |
// FooSpec is the spec for a Foo resource | |
type FooSpec struct { | |
DeploymentName string `json:"deploymentName"` | |
Replicas *int32 `json:"replicas"` | |
} | |
// FooStatus is the status for a Foo resource | |
type FooStatus struct { | |
AvailableReplicas int32 `json:"availableReplicas"` | |
} | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// FooList is a list of Foo resources | |
type FooList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []Foo `json:"items"` | |
} |