Skip to content

Commit 662ae87

Browse files
authored
Add Status to NodeInfo CRD (#2827)
* Add Status to NodeInfo CRD * annotate subresource to NodeInfo status
1 parent 313ce0c commit 662ae87

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed

crd/multitenancy/api/v1alpha1/nodeinfo.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ import (
1212
// +kubebuilder:object:root=true
1313

1414
// NodeInfo is the Schema for the NodeInfo API
15+
// +kubebuilder:subresource:status
1516
// +kubebuilder:resource:shortName=ni,scope=Cluster,path=nodeinfo
1617
// +kubebuilder:printcolumn:name="VMUniqueID",type=string,priority=0,JSONPath=`.spec.vmUniqueID`
18+
// +kubebuilder:printcolumn:name="Status",type=string,priority=1,JSONPath=`.status.status`
1719
type NodeInfo struct {
1820
metav1.TypeMeta `json:",inline"`
1921
metav1.ObjectMeta `json:"metadata,omitempty"`
2022

21-
Spec NodeInfoSpec `json:"spec,omitempty"`
23+
Spec NodeInfoSpec `json:"spec,omitempty"`
24+
Status NodeInfoStatus `json:"status,omitempty"`
2225
}
2326

2427
// +kubebuilder:object:root=true
@@ -36,6 +39,17 @@ type NodeInfoSpec struct {
3639
VMUniqueID string `json:"vmUniqueID,omitempty"`
3740
}
3841

42+
// NodeInfoStatus defines the observed state of NodeInfo
43+
type NodeInfoStatus struct {
44+
// +kubebuilder:validation:Optional
45+
DeviceInfos []DeviceInfo `json:"deviceInfos,omitempty"`
46+
}
47+
48+
type DeviceInfo struct {
49+
DeviceType DeviceType `json:"deviceType,omitempty"`
50+
DeviceCount int `json:"deviceCount"`
51+
}
52+
3953
func init() {
4054
SchemeBuilder.Register(&NodeInfo{}, &NodeInfoList{})
4155
}

crd/multitenancy/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crd/multitenancy/manifests/multitenancy.acn.azure.com_nodeinfo.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ spec:
2020
- jsonPath: .spec.vmUniqueID
2121
name: VMUniqueID
2222
type: string
23+
- jsonPath: .status.status
24+
name: Status
25+
priority: 1
26+
type: string
2327
name: v1alpha1
2428
schema:
2529
openAPIV3Schema:
@@ -43,7 +47,26 @@ spec:
4347
vmUniqueID:
4448
type: string
4549
type: object
50+
status:
51+
description: NodeInfoStatus defines the observed state of NodeInfo
52+
properties:
53+
deviceInfos:
54+
items:
55+
properties:
56+
deviceCount:
57+
type: integer
58+
deviceType:
59+
enum:
60+
- acn.azure.com/vnet-nic
61+
- acn.azure.com/infiniband-nic
62+
type: string
63+
required:
64+
- deviceCount
65+
type: object
66+
type: array
67+
type: object
4668
type: object
4769
served: true
4870
storage: true
49-
subresources: {}
71+
subresources:
72+
status: {}

0 commit comments

Comments
 (0)