* Add Status to NodeInfo CRD

* annotate subresource to NodeInfo status
This commit is contained in:
aggarwal0009 2024-07-09 09:57:57 -07:00 коммит произвёл GitHub
Родитель 313ce0c4b0
Коммит 662ae8749b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 75 добавлений и 2 удалений

Просмотреть файл

@ -12,13 +12,16 @@ import (
// +kubebuilder:object:root=true
// NodeInfo is the Schema for the NodeInfo API
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=ni,scope=Cluster,path=nodeinfo
// +kubebuilder:printcolumn:name="VMUniqueID",type=string,priority=0,JSONPath=`.spec.vmUniqueID`
// +kubebuilder:printcolumn:name="Status",type=string,priority=1,JSONPath=`.status.status`
type NodeInfo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NodeInfoSpec `json:"spec,omitempty"`
Spec NodeInfoSpec `json:"spec,omitempty"`
Status NodeInfoStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
@ -36,6 +39,17 @@ type NodeInfoSpec struct {
VMUniqueID string `json:"vmUniqueID,omitempty"`
}
// NodeInfoStatus defines the observed state of NodeInfo
type NodeInfoStatus struct {
// +kubebuilder:validation:Optional
DeviceInfos []DeviceInfo `json:"deviceInfos,omitempty"`
}
type DeviceInfo struct {
DeviceType DeviceType `json:"deviceType,omitempty"`
DeviceCount int `json:"deviceCount"`
}
func init() {
SchemeBuilder.Register(&NodeInfo{}, &NodeInfoList{})
}

Просмотреть файл

@ -8,6 +8,21 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeviceInfo) DeepCopyInto(out *DeviceInfo) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceInfo.
func (in *DeviceInfo) DeepCopy() *DeviceInfo {
if in == nil {
return nil
}
out := new(DeviceInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InterfaceInfo) DeepCopyInto(out *InterfaceInfo) {
*out = *in
@ -123,6 +138,7 @@ func (in *NodeInfo) DeepCopyInto(out *NodeInfo) {
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeInfo.
@ -190,6 +206,26 @@ func (in *NodeInfoSpec) DeepCopy() *NodeInfoSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeInfoStatus) DeepCopyInto(out *NodeInfoStatus) {
*out = *in
if in.DeviceInfos != nil {
in, out := &in.DeviceInfos, &out.DeviceInfos
*out = make([]DeviceInfo, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeInfoStatus.
func (in *NodeInfoStatus) DeepCopy() *NodeInfoStatus {
if in == nil {
return nil
}
out := new(NodeInfoStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodNetwork) DeepCopyInto(out *PodNetwork) {
*out = *in

Просмотреть файл

@ -20,6 +20,10 @@ spec:
- jsonPath: .spec.vmUniqueID
name: VMUniqueID
type: string
- jsonPath: .status.status
name: Status
priority: 1
type: string
name: v1alpha1
schema:
openAPIV3Schema:
@ -43,7 +47,26 @@ spec:
vmUniqueID:
type: string
type: object
status:
description: NodeInfoStatus defines the observed state of NodeInfo
properties:
deviceInfos:
items:
properties:
deviceCount:
type: integer
deviceType:
enum:
- acn.azure.com/vnet-nic
- acn.azure.com/infiniband-nic
type: string
required:
- deviceCount
type: object
type: array
type: object
type: object
served: true
storage: true
subresources: {}
subresources:
status: {}