update nnc printcols for kubectl output (#1908)

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
This commit is contained in:
Evan Baker 2023-04-19 22:24:03 -05:00 коммит произвёл GitHub
Родитель aa163aad3f
Коммит cc6aaf580d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 43 добавлений и 23 удалений

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

@ -15,13 +15,14 @@ import (
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:resource:shortName=nnc
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status`
// +kubebuilder:printcolumn:name="Requested IPs",type=string,JSONPath=`.spec.requestedIPCount`
// +kubebuilder:printcolumn:name="Assigned IPs",type=string,JSONPath=`.status.assignedIPCount`
// +kubebuilder:printcolumn:name="Subnet",type=string,JSONPath=`.status.networkContainers[*].subnetName`
// +kubebuilder:printcolumn:name="Subnet CIDR",type=string,JSONPath=`.status.networkContainers[*].subnetAddressSpace`
// +kubebuilder:printcolumn:name="NC ID",type=string,JSONPath=`.status.networkContainers[*].id`
// +kubebuilder:printcolumn:name="NC Version",type=string,JSONPath=`.status.networkContainers[*].version`
// +kubebuilder:printcolumn:name="Requested IPs",type=integer,priority=1,JSONPath=`.spec.requestedIPCount`
// +kubebuilder:printcolumn:name="Allocated IPs",type=integer,priority=0,JSONPath=`.status.assignedIPCount`
// +kubebuilder:printcolumn:name="Subnet",type=string,priority=1,JSONPath=`.status.networkContainers[*].subnetName`
// +kubebuilder:printcolumn:name="Subnet CIDR",type=string,priority=1,JSONPath=`.status.networkContainers[*].subnetAddressSpace`
// +kubebuilder:printcolumn:name="NC ID",type=string,priority=1,JSONPath=`.status.networkContainers[*].id`
// +kubebuilder:printcolumn:name="NC Mode",type=string,priority=0,JSONPath=`.status.networkContainers[*].assignmentMode`
// +kubebuilder:printcolumn:name="NC Type",type=string,priority=1,JSONPath=`.status.networkContainers[*].type`
// +kubebuilder:printcolumn:name="NC Version",type=integer,priority=0,JSONPath=`.status.networkContainers[*].version`
type NodeNetworkConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@ -41,7 +42,9 @@ type NodeNetworkConfigList struct {
// NodeNetworkConfigSpec defines the desired state of NetworkConfig
type NodeNetworkConfigSpec struct {
RequestedIPCount int64 `json:"requestedIPCount,omitempty"`
// +kubebuilder:default=0
// +kubebuilder:validation:Optional
RequestedIPCount int64 `json:"requestedIPCount"`
IPsNotInUse []string `json:"ipsNotInUse,omitempty"`
}
@ -57,7 +60,9 @@ const (
// NodeNetworkConfigStatus defines the observed state of NetworkConfig
type NodeNetworkConfigStatus struct {
AssignedIPCount int `json:"assignedIPCount,omitempty"`
// +kubebuilder:default=0
// +kubebuilder:validation:Optional
AssignedIPCount int `json:"assignedIPCount"`
Scaler Scaler `json:"scaler,omitempty"`
Status Status `json:"status,omitempty"`
NetworkContainers []NetworkContainer `json:"networkContainers,omitempty"`
@ -94,13 +99,16 @@ type NetworkContainer struct {
ID string `json:"id,omitempty"`
// +kubebuilder:default=dynamic
AssignmentMode AssignmentMode `json:"assignmentMode,omitempty"`
// +kubebuilder:default=vnet
Type NCType `json:"type,omitempty"`
PrimaryIP string `json:"primaryIP,omitempty"`
SubnetName string `json:"subnetName,omitempty"`
IPAssignments []IPAssignment `json:"ipAssignments,omitempty"`
DefaultGateway string `json:"defaultGateway,omitempty"`
SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"`
Version int64 `json:"version,omitempty"`
// +kubebuilder:default=0
// +kubebuilder:validation:Optional
Version int64 `json:"version"`
NodeIP string `json:"nodeIP,omitempty"`
SubscriptionID string `json:"subcriptionID,omitempty"`
ResourceGroupID string `json:"resourceGroupID,omitempty"`

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

@ -18,27 +18,35 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.status
name: Status
type: string
- jsonPath: .spec.requestedIPCount
name: Requested IPs
type: string
priority: 1
type: integer
- jsonPath: .status.assignedIPCount
name: Assigned IPs
type: string
name: Allocated IPs
type: integer
- jsonPath: .status.networkContainers[*].subnetName
name: Subnet
priority: 1
type: string
- jsonPath: .status.networkContainers[*].subnetAddressSpace
name: Subnet CIDR
priority: 1
type: string
- jsonPath: .status.networkContainers[*].id
name: NC ID
priority: 1
type: string
- jsonPath: .status.networkContainers[*].assignmentMode
name: NC Mode
type: string
- jsonPath: .status.networkContainers[*].type
name: NC Type
priority: 1
type: string
- jsonPath: .status.networkContainers[*].version
name: NC Version
type: string
type: integer
name: v1alpha
schema:
openAPIV3Schema:
@ -64,6 +72,7 @@ spec:
type: string
type: array
requestedIPCount:
default: 0
format: int64
type: integer
type: object
@ -71,6 +80,7 @@ spec:
description: NodeNetworkConfigStatus defines the observed state of NetworkConfig
properties:
assignedIPCount:
default: 0
type: integer
networkContainers:
items:
@ -115,10 +125,12 @@ spec:
subnetName:
type: string
type:
default: vnet
description: NCType is the specific type of network this NC
represents.
type: string
version:
default: 0
format: int64
type: integer
vnetID: