Adding typed client for CRD
[multicloud/k8s.git] / src / monitor / pkg / apis / k8splugin / v1alpha1 / types.go
1 package v1alpha1
2
3 import (
4         corev1 "k8s.io/api/core/v1"
5         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6 )
7
8 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
9
10 // ResourceBundleState is the Schema for the ResourceBundleStatees API
11 // +k8s:openapi-gen=true
12 // +kubebuilder:subresource:status
13 // +genclient
14 type ResourceBundleState struct {
15         metav1.TypeMeta   `json:",inline"`
16         metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
17
18         Spec   ResourceBundleStateSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
19         Status ResourceBundleStatus    `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
20 }
21
22 // ResourceBundleStateSpec defines the desired state of ResourceBundleState
23 // +k8s:openapi-gen=true
24 type ResourceBundleStateSpec struct {
25         Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"`
26 }
27
28 // ResourceBundleStatus defines the observed state of ResourceBundleState
29 // +k8s:openapi-gen=true
30 type ResourceBundleStatus struct {
31         Ready           bool             `json:"ready" protobuf:"varint,1,opt,name=ready"`
32         ResourceCount   int32            `json:"resourceCount" protobuf:"varint,2,opt,name=resourceCount"`
33         PodStatuses     []PodStatus      `json:"podStatuses" protobuf:"varint,3,opt,name=podStatuses"`
34         ServiceStatuses []corev1.Service `json:"serviceStatuses" protobuf:"varint,4,opt,name=serviceStatuses"`
35 }
36
37 // PodStatus defines the observed state of ResourceBundleState
38 // +k8s:openapi-gen=true
39 type PodStatus struct {
40         metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
41         Ready             bool             `json:"ready" protobuf:"varint,2,opt,name=ready"`
42         Status            corev1.PodStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
43 }
44
45 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
46
47 // ResourceBundleStateList contains a list of ResourceBundleState
48 type ResourceBundleStateList struct {
49         metav1.TypeMeta `json:",inline"`
50         metav1.ListMeta `json:"metadata,omitempty"`
51         Items           []ResourceBundleState `json:"items"`
52 }
53
54 func init() {
55         SchemeBuilder.Register(&ResourceBundleState{}, &ResourceBundleStateList{})
56 }