From 13441ac8ff935c6844d18352eab3828a2cb7f5f6 Mon Sep 17 00:00:00 2001 From: hhyasdf <552483776@qq.com> Date: Fri, 1 Jul 2022 17:04:43 +0800 Subject: [PATCH] print network cr statistics --- .../crds/networking.alibaba.com_networks.yaml | 24 +++++++++++++++++++ pkg/apis/networking/v1/network_types.go | 8 +++++++ 2 files changed, 32 insertions(+) diff --git a/charts/hybridnet/crds/networking.alibaba.com_networks.yaml b/charts/hybridnet/crds/networking.alibaba.com_networks.yaml index 785938d5..e92cc302 100644 --- a/charts/hybridnet/crds/networking.alibaba.com_networks.yaml +++ b/charts/hybridnet/crds/networking.alibaba.com_networks.yaml @@ -26,6 +26,30 @@ spec: - jsonPath: .spec.mode name: Mode type: string + - jsonPath: .status.statistics.total + name: V4Total + type: integer + - jsonPath: .status.statistics.used + name: V4Used + type: integer + - jsonPath: .status.statistics.available + name: V4Available + type: integer + - jsonPath: .status.lastAllocatedSubnet + name: LastAllocatedV4Subnet + type: string + - jsonPath: .status.ipv6Statistics.total + name: V6Total + type: integer + - jsonPath: .status.ipv6Statistics.used + name: V6Used + type: integer + - jsonPath: .status.ipv6Statistics.available + name: V6Available + type: integer + - jsonPath: .status.lastAllocatedIPv6Subnet + name: LastAllocatedV6Subnet + type: string name: v1 schema: openAPIV3Schema: diff --git a/pkg/apis/networking/v1/network_types.go b/pkg/apis/networking/v1/network_types.go index c8b8a5e8..e639186d 100644 --- a/pkg/apis/networking/v1/network_types.go +++ b/pkg/apis/networking/v1/network_types.go @@ -62,6 +62,14 @@ type NetworkStatus struct { // +kubebuilder:printcolumn:name="NetID",type=integer,JSONPath=`.spec.netID` // +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type` // +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode` +// +kubebuilder:printcolumn:name="V4Total",type=integer,JSONPath=`.status.statistics.total` +// +kubebuilder:printcolumn:name="V4Used",type=integer,JSONPath=`.status.statistics.used` +// +kubebuilder:printcolumn:name="V4Available",type=integer,JSONPath=`.status.statistics.available` +// +kubebuilder:printcolumn:name="LastAllocatedV4Subnet",type=string,JSONPath=`.status.lastAllocatedSubnet` +// +kubebuilder:printcolumn:name="V6Total",type=integer,JSONPath=`.status.ipv6Statistics.total` +// +kubebuilder:printcolumn:name="V6Used",type=integer,JSONPath=`.status.ipv6Statistics.used` +// +kubebuilder:printcolumn:name="V6Available",type=integer,JSONPath=`.status.ipv6Statistics.available` +// +kubebuilder:printcolumn:name="LastAllocatedV6Subnet",type=string,JSONPath=`.status.lastAllocatedIPv6Subnet` // Network is the Schema for the networks API type Network struct {