From b19aafdce3b5edc471007974ca09f1f06e79b889 Mon Sep 17 00:00:00 2001 From: Asklv Date: Thu, 6 Jun 2024 02:01:13 +0800 Subject: [PATCH 1/7] feat: support api query. Signed-off-by: Asklv --- .../antrea/templates/agent/clusterrole.yaml | 6 + build/yamls/antrea-aks.yml | 9 + build/yamls/antrea-eks.yml | 9 + build/yamls/antrea-gke.yml | 9 + build/yamls/antrea-ipsec.yml | 9 + build/yamls/antrea.yml | 9 + cmd/antrea-agent/agent.go | 1 + pkg/agent/monitortool/latency_store.go | 21 + pkg/agent/monitortool/monitor.go | 55 +- pkg/apis/stats/v1alpha1/generated.pb.go | 1394 ++++++++++++++--- pkg/apis/stats/v1alpha1/generated.proto | 42 +- pkg/apis/stats/v1alpha1/register.go | 2 + pkg/apis/stats/v1alpha1/types.go | 46 + .../stats/v1alpha1/zz_generated.deepcopy.go | 109 +- pkg/apiserver/apiserver.go | 2 + pkg/apiserver/openapi/zz_generated.openapi.go | 180 +++ .../registry/stats/nodelatencystat/rest.go | 87 + .../stats/nodelatencystat/rest_test.go | 15 + .../v1alpha1/fake/fake_nodelatencystats.go | 44 + .../stats/v1alpha1/fake/fake_stats_client.go | 6 +- .../stats/v1alpha1/generated_expansion.go | 4 +- .../typed/stats/v1alpha1/nodelatencystats.go | 62 + .../typed/stats/v1alpha1/stats_client.go | 7 +- 23 files changed, 1901 insertions(+), 227 deletions(-) create mode 100644 pkg/apiserver/registry/stats/nodelatencystat/rest.go create mode 100644 pkg/apiserver/registry/stats/nodelatencystat/rest_test.go create mode 100644 pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go create mode 100644 pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go diff --git a/build/charts/antrea/templates/agent/clusterrole.yaml b/build/charts/antrea/templates/agent/clusterrole.yaml index 25bce70e3d5..42e62a52f24 100644 --- a/build/charts/antrea/templates/agent/clusterrole.yaml +++ b/build/charts/antrea/templates/agent/clusterrole.yaml @@ -5,6 +5,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodeiplatencystats + verbs: + - create - apiGroups: - "" resources: diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index 9655b66b5da..aeb9e269179 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -4144,6 +4144,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: @@ -4397,9 +4403,12 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats + - nodeiplatencystats verbs: - get - list + - create + - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index d60cc445413..d7e89a8b663 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -4144,6 +4144,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: @@ -4397,9 +4403,12 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats + - nodeiplatencystats verbs: - get - list + - create + - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index 8fb55a482f9..a8eb26b62d8 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -4144,6 +4144,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: @@ -4397,9 +4403,12 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats + - nodeiplatencystats verbs: - get - list + - create + - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index c843452c63c..6a1f305148a 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -4157,6 +4157,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: @@ -4410,9 +4416,12 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats + - nodeiplatencystats verbs: - get - list + - create + - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 60e8df147d4..f12fc2fda54 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -4144,6 +4144,12 @@ metadata: labels: app: antrea rules: + - apiGroups: + - stats.antrea.io + resources: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: @@ -4397,9 +4403,12 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats + - nodeiplatencystats verbs: - get - list + - create + - update - apiGroups: - system.antrea.io resources: diff --git a/cmd/antrea-agent/agent.go b/cmd/antrea-agent/agent.go index 86664e28a48..83a2d05286c 100644 --- a/cmd/antrea-agent/agent.go +++ b/cmd/antrea-agent/agent.go @@ -953,6 +953,7 @@ func run(o *Options) error { // Start the node latency monitor. if features.DefaultFeatureGate.Enabled(features.NodeLatencyMonitor) && o.nodeType == config.K8sNode { nodeLatencyMonitor := monitortool.NewNodeLatencyMonitor( + antreaClientProvider, nodeInformer, nodeLatencyMonitorInformer, nodeConfig, diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index 35cef35eb60..6f9230ee225 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -20,8 +20,10 @@ import ( "sync" "time" + stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "github.com/containernetworking/plugins/pkg/ip" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" @@ -248,3 +250,22 @@ func (s *LatencyStore) DeleteStaleNodeIPs() { } } } + +// ConvertList converts the latency store to a list of TargetIPLatencyStats. +func (l *LatencyStore) ConvertList() []stv1aplpha1.TargetIPLatencyStats { + l.mutex.RLock() + defer l.mutex.RUnlock() + + entries := make([]stv1aplpha1.TargetIPLatencyStats, 0, len(l.nodeIPLatencyMap)) + for nodeIP, entry := range l.nodeIPLatencyMap { + tempEntry := stv1aplpha1.TargetIPLatencyStats{ + TargetIP: nodeIP, + LastSendTime: metav1.NewTime(entry.LastSendTime), + LastRecvTime: metav1.NewTime(entry.LastRecvTime), + LastMeasuredRTTNanoseconds: entry.LastMeasuredRTT.Nanoseconds(), + } + entries = append(entries, tempEntry) + } + + return entries +} diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index c840c571643..1d7e9e485af 100644 --- a/pkg/agent/monitortool/monitor.go +++ b/pkg/agent/monitortool/monitor.go @@ -15,21 +15,26 @@ package monitortool import ( + "context" "math/rand" "net" "sync" "sync/atomic" "time" + stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + "antrea.io/antrea/pkg/util/env" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" coreinformers "k8s.io/client-go/informers/core/v1" "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" "k8s.io/utils/clock" + "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" "antrea.io/antrea/pkg/apis/crd/v1alpha1" crdinformers "antrea.io/antrea/pkg/client/informers/externalversions/crd/v1alpha1" @@ -66,6 +71,8 @@ type NodeLatencyMonitor struct { // isIPv6Enabled is the flag to indicate whether the IPv6 is enabled. isIPv6Enabled bool + // antreaClientProvider provides interfaces to get antreaClient, which will be used to report the statistics + antreaClientProvider client.AntreaClientProvider // nodeName is the name of the current Node, used to filter out the current Node from the latency monitor. nodeName string @@ -88,6 +95,7 @@ type latencyConfig struct { // NewNodeLatencyMonitor creates a new NodeLatencyMonitor. func NewNodeLatencyMonitor( + antreaClientProvider client.AntreaClientProvider, nodeInformer coreinformers.NodeInformer, nlmInformer crdinformers.NodeLatencyMonitorInformer, nodeConfig *config.NodeConfig, @@ -96,6 +104,7 @@ func NewNodeLatencyMonitor( m := &NodeLatencyMonitor{ latencyStore: NewLatencyStore(trafficEncapMode.IsNetworkPolicyOnly()), latencyConfigChanged: make(chan latencyConfig), + antreaClientProvider: antreaClientProvider, nodeInformerSynced: nodeInformer.Informer().HasSynced, nlmInformerSynced: nlmInformer.Informer().HasSynced, nodeName: nodeConfig.Name, @@ -135,7 +144,7 @@ func (m *NodeLatencyMonitor) onNodeAdd(obj interface{}) { m.latencyStore.addNode(node) - klog.V(4).InfoS("Node added", "Node", klog.KObj(node)) + klog.InfoS("Node added", "Node", klog.KObj(node)) } // onNodeUpdate is the event handler for updating Node. @@ -147,7 +156,7 @@ func (m *NodeLatencyMonitor) onNodeUpdate(oldObj, newObj interface{}) { m.latencyStore.updateNode(node) - klog.V(4).InfoS("Node updated", "Node", klog.KObj(node)) + klog.InfoS("Node updated", "Node", klog.KObj(node)) } // onNodeDelete is the event handler for deleting Node. @@ -185,7 +194,7 @@ func (m *NodeLatencyMonitor) onNodeLatencyMonitorAdd(obj interface{}) { func (m *NodeLatencyMonitor) onNodeLatencyMonitorUpdate(oldObj, newObj interface{}) { oldNLM := oldObj.(*v1alpha1.NodeLatencyMonitor) newNLM := newObj.(*v1alpha1.NodeLatencyMonitor) - klog.V(4).InfoS("NodeLatencyMonitor updated", "NodeLatencyMonitor", klog.KObj(newNLM)) + klog.InfoS("NodeLatencyMonitor updated", "NodeLatencyMonitor", klog.KObj(newNLM)) if oldNLM.GetGeneration() == newNLM.GetGeneration() { return @@ -238,7 +247,7 @@ func (m *NodeLatencyMonitor) sendPing(socket net.PacketConn, addr net.IP) error Code: 0, Body: body, } - klog.V(4).InfoS("Sending ICMP message", "IP", ip, "SeqID", seqID, "body", body) + klog.InfoS("Sending ICMP message", "IP", ip, "SeqID", seqID, "body", body) // Serialize the ICMP message msgBytes, err := msg.Marshal(nil) @@ -349,7 +358,7 @@ func (m *NodeLatencyMonitor) recvPings(socket net.PacketConn, isIPv4 bool) { // pingAll sends ICMP messages to all the Nodes. func (m *NodeLatencyMonitor) pingAll(ipv4Socket, ipv6Socket net.PacketConn) { - klog.V(4).InfoS("Pinging all Nodes") + klog.InfoS("Pinging all Nodes") nodeIPs := m.latencyStore.ListNodeIPs() for _, toIP := range nodeIPs { if toIP.To4() != nil && ipv4Socket != nil { @@ -364,7 +373,40 @@ func (m *NodeLatencyMonitor) pingAll(ipv4Socket, ipv6Socket net.PacketConn) { klog.V(3).InfoS("Cannot send ICMP message to Node IP because socket is not initialized for IP family", "IP", toIP) } } - klog.V(4).InfoS("Done pinging all Nodes") + klog.InfoS("Done pinging all Nodes") +} + +// GetSummary returns the latency summary of the given Node IP. +func (m *NodeLatencyMonitor) GetSummary() *stv1aplpha1.NodeLatencyStats { + nodeName, _ := env.GetNodeName() + return &stv1aplpha1.NodeLatencyStats{ + ObjectMeta: metav1.ObjectMeta{ + Name: nodeName, + }, + PeerNodeLatencyStats: []stv1aplpha1.PeerNodeLatencyStats{ + stv1aplpha1.PeerNodeLatencyStats{ + NodeName: nodeName, + TargetIPLatencyStats: m.latencyStore.ConvertList(), + }, + }, + } + +} + +func (m *NodeLatencyMonitor) report() { + summary := m.GetSummary() + if summary == nil { + klog.InfoS("Latency summary is nil") + return + } + antreaClient, err := m.antreaClientProvider.GetAntreaClient() + if err != nil { + klog.ErrorS(err, "Failed to get Antrea client") + return + } + if _, err := antreaClient.StatsV1alpha1().NodeLatencyStats().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { + klog.ErrorS(err, "Failed to update NodeIPLatencyStats") + } } // Run starts the NodeLatencyMonitor. @@ -418,6 +460,7 @@ func (m *NodeLatencyMonitor) monitorLoop(stopCh <-chan struct{}) { // to avoid consistency issues and because it would not be sufficient to avoid stale entries completely. // This means that we have to periodically invoke DeleteStaleNodeIPs to avoid stale entries in the map. m.latencyStore.DeleteStaleNodeIPs() + m.report() case <-stopCh: return case latencyConfig := <-m.latencyConfigChanged: diff --git a/pkg/apis/stats/v1alpha1/generated.pb.go b/pkg/apis/stats/v1alpha1/generated.pb.go index 97c8feb6c68..68d8b1901b2 100644 --- a/pkg/apis/stats/v1alpha1/generated.pb.go +++ b/pkg/apis/stats/v1alpha1/generated.pb.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -264,10 +264,94 @@ func (m *NetworkPolicyStatsList) XXX_DiscardUnknown() { var xxx_messageInfo_NetworkPolicyStatsList proto.InternalMessageInfo +func (m *NodeLatencyStatList) Reset() { *m = NodeLatencyStatList{} } +func (*NodeLatencyStatList) ProtoMessage() {} +func (*NodeLatencyStatList) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{8} +} +func (m *NodeLatencyStatList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeLatencyStatList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NodeLatencyStatList) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLatencyStatList.Merge(m, src) +} +func (m *NodeLatencyStatList) XXX_Size() int { + return m.Size() +} +func (m *NodeLatencyStatList) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLatencyStatList.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeLatencyStatList proto.InternalMessageInfo + +func (m *NodeLatencyStats) Reset() { *m = NodeLatencyStats{} } +func (*NodeLatencyStats) ProtoMessage() {} +func (*NodeLatencyStats) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{9} +} +func (m *NodeLatencyStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *NodeLatencyStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLatencyStats.Merge(m, src) +} +func (m *NodeLatencyStats) XXX_Size() int { + return m.Size() +} +func (m *NodeLatencyStats) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLatencyStats.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeLatencyStats proto.InternalMessageInfo + +func (m *PeerNodeLatencyStats) Reset() { *m = PeerNodeLatencyStats{} } +func (*PeerNodeLatencyStats) ProtoMessage() {} +func (*PeerNodeLatencyStats) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{10} +} +func (m *PeerNodeLatencyStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PeerNodeLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PeerNodeLatencyStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_PeerNodeLatencyStats.Merge(m, src) +} +func (m *PeerNodeLatencyStats) XXX_Size() int { + return m.Size() +} +func (m *PeerNodeLatencyStats) XXX_DiscardUnknown() { + xxx_messageInfo_PeerNodeLatencyStats.DiscardUnknown(m) +} + +var xxx_messageInfo_PeerNodeLatencyStats proto.InternalMessageInfo + func (m *PodReference) Reset() { *m = PodReference{} } func (*PodReference) ProtoMessage() {} func (*PodReference) Descriptor() ([]byte, []int) { - return fileDescriptor_91b517c6fa558473, []int{8} + return fileDescriptor_91b517c6fa558473, []int{11} } func (m *PodReference) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -295,7 +379,7 @@ var xxx_messageInfo_PodReference proto.InternalMessageInfo func (m *RuleTrafficStats) Reset() { *m = RuleTrafficStats{} } func (*RuleTrafficStats) ProtoMessage() {} func (*RuleTrafficStats) Descriptor() ([]byte, []int) { - return fileDescriptor_91b517c6fa558473, []int{9} + return fileDescriptor_91b517c6fa558473, []int{12} } func (m *RuleTrafficStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -320,10 +404,38 @@ func (m *RuleTrafficStats) XXX_DiscardUnknown() { var xxx_messageInfo_RuleTrafficStats proto.InternalMessageInfo +func (m *TargetIPLatencyStats) Reset() { *m = TargetIPLatencyStats{} } +func (*TargetIPLatencyStats) ProtoMessage() {} +func (*TargetIPLatencyStats) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{13} +} +func (m *TargetIPLatencyStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TargetIPLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TargetIPLatencyStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_TargetIPLatencyStats.Merge(m, src) +} +func (m *TargetIPLatencyStats) XXX_Size() int { + return m.Size() +} +func (m *TargetIPLatencyStats) XXX_DiscardUnknown() { + xxx_messageInfo_TargetIPLatencyStats.DiscardUnknown(m) +} + +var xxx_messageInfo_TargetIPLatencyStats proto.InternalMessageInfo + func (m *TrafficStats) Reset() { *m = TrafficStats{} } func (*TrafficStats) ProtoMessage() {} func (*TrafficStats) Descriptor() ([]byte, []int) { - return fileDescriptor_91b517c6fa558473, []int{10} + return fileDescriptor_91b517c6fa558473, []int{14} } func (m *TrafficStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -357,8 +469,12 @@ func init() { proto.RegisterType((*MulticastGroupList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.MulticastGroupList") proto.RegisterType((*NetworkPolicyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NetworkPolicyStats") proto.RegisterType((*NetworkPolicyStatsList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NetworkPolicyStatsList") + proto.RegisterType((*NodeLatencyStatList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NodeLatencyStatList") + proto.RegisterType((*NodeLatencyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NodeLatencyStats") + proto.RegisterType((*PeerNodeLatencyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.PeerNodeLatencyStats") proto.RegisterType((*PodReference)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.PodReference") proto.RegisterType((*RuleTrafficStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.RuleTrafficStats") + proto.RegisterType((*TargetIPLatencyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.TargetIPLatencyStats") proto.RegisterType((*TrafficStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.TrafficStats") } @@ -367,51 +483,65 @@ func init() { } var fileDescriptor_91b517c6fa558473 = []byte{ - // 704 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x4f, 0x6b, 0x13, 0x4d, - 0x18, 0xcf, 0x34, 0x2d, 0x6d, 0xa6, 0x79, 0xdf, 0xb7, 0xef, 0x20, 0x12, 0x8a, 0x6c, 0x4b, 0x7a, - 0x89, 0xa0, 0xb3, 0xb6, 0x48, 0x29, 0xe2, 0xc5, 0xf5, 0x20, 0x05, 0x1b, 0xc3, 0xd4, 0x83, 0x88, - 0xa2, 0x93, 0xcd, 0x64, 0x33, 0x26, 0xbb, 0xb3, 0xec, 0xcc, 0x56, 0x7a, 0xeb, 0x07, 0xf0, 0xe0, - 0xa7, 0xf0, 0xb3, 0xf4, 0x58, 0x6f, 0xf5, 0x52, 0x6c, 0x44, 0xf0, 0x2a, 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xc5, 0x12, - 0x9a, 0xe5, 0x6c, 0xd8, 0x8e, 0x36, 0x92, 0xc4, 0x87, 0x6e, 0xc1, 0x05, 0xc9, 0xa4, 0xe4, 0x22, - 0xd0, 0xaf, 0x8c, 0x8e, 0x3b, 0xdb, 0xfe, 0x6e, 0x6a, 0x27, 0x67, 0x11, 0x4e, 0xf3, 0xf0, 0xd4, - 0x2a, 0x1d, 0x9d, 0x5a, 0xa5, 0xe3, 0x53, 0xab, 0x74, 0x30, 0xb4, 0xc0, 0xe1, 0xd0, 0x02, 0x47, - 0x43, 0x0b, 0x1c, 0x0f, 0x2d, 0xf0, 0x79, 0x68, 0x81, 0xf7, 0x5f, 0xac, 0xd2, 0xf3, 0x46, 0xd1, - 0xbf, 0xd3, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x73, 0x1f, 0x1a, 0xcb, 0x79, 0x0b, 0x00, 0x00, + // 917 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xce, 0x24, 0xad, 0xb6, 0x9d, 0x0d, 0x50, 0x86, 0x0a, 0x45, 0xd1, 0xca, 0xad, 0xbc, 0x97, + 0x80, 0xc0, 0xa6, 0x2b, 0xb4, 0xaa, 0x10, 0x42, 0xc2, 0x1c, 0x50, 0xa5, 0x36, 0x44, 0xd3, 0x1c, + 0x10, 0x02, 0xc1, 0xc4, 0x7e, 0x75, 0x4d, 0x12, 0x8f, 0xe5, 0x99, 0x04, 0xf5, 0xb6, 0x77, 0x38, + 0xec, 0x5f, 0xc1, 0xdf, 0xd2, 0xe3, 0x72, 0xa2, 0x5c, 0x56, 0x34, 0x08, 0x89, 0x2b, 0x82, 0x03, + 0x47, 0x34, 0x63, 0x3b, 0x8e, 0xf3, 0x83, 0xba, 0xda, 0x2a, 0x1c, 0xe0, 0x54, 0xfb, 0xfd, 0xf8, + 0x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 0x57, 0x52, 0x86, 0x7b, 0x9d, 0xc4, 0x4c, 0x33, 0xbf, 0xfa, + 0xdf, 0xa4, 0x77, 0x21, 0x21, 0xd9, 0x8e, 0x5a, 0x7e, 0x97, 0x39, 0xca, 0x48, 0x13, 0x9f, 0x1a, + 0x9f, 0x00, 0x21, 0x02, 0x1e, 0x0a, 0xdd, 0xa6, 0x5a, 0x3e, 0xbe, 0xd3, 0xd4, 0x4e, 0xa7, 0x11, + 0x4e, 0xfb, 0xf2, 0xda, 0xa8, 0x3c, 0xbb, 0x36, 0x2a, 0x57, 0xd7, 0x46, 0xe5, 0xc9, 0xc4, 0x40, + 0x97, 0x13, 0x03, 0x3d, 0x9b, 0x18, 0xe8, 0x6a, 0x62, 0xa0, 0x9f, 0x27, 0x06, 0x7a, 0xfa, 0x8b, + 0x51, 0xf9, 0xac, 0x55, 0xf6, 0x87, 0xf8, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xad, 0x77, 0xf1, + 0x12, 0xb3, 0x0f, 0x00, 0x00, } func (m *AntreaClusterNetworkPolicyStats) Marshal() (dAtA []byte, err error) { @@ -811,6 +941,142 @@ func (m *NetworkPolicyStatsList) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *NodeLatencyStatList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeLatencyStatList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeLatencyStatList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *NodeLatencyStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeLatencyStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PeerNodeLatencyStats) > 0 { + for iNdEx := len(m.PeerNodeLatencyStats) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PeerNodeLatencyStats[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PeerNodeLatencyStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PeerNodeLatencyStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PeerNodeLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TargetIPLatencyStats) > 0 { + for iNdEx := len(m.TargetIPLatencyStats) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TargetIPLatencyStats[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.NodeName) + copy(dAtA[i:], m.NodeName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *PodReference) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -882,6 +1148,57 @@ func (m *RuleTrafficStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TargetIPLatencyStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TargetIPLatencyStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TargetIPLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.LastMeasuredRTTNanoseconds)) + i-- + dAtA[i] = 0x20 + { + size, err := m.LastRecvTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.LastSendTime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.TargetIP) + copy(dAtA[i:], m.TargetIP) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.TargetIP))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *TrafficStats) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1063,45 +1380,112 @@ func (m *NetworkPolicyStatsList) Size() (n int) { return n } -func (m *PodReference) Size() (n int) { +func (m *NodeLatencyStatList) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) + l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } -func (m *RuleTrafficStats) Size() (n int) { +func (m *NodeLatencyStats) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.TrafficStats.Size() + l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) + if len(m.PeerNodeLatencyStats) > 0 { + for _, e := range m.PeerNodeLatencyStats { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } -func (m *TrafficStats) Size() (n int) { +func (m *PeerNodeLatencyStats) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 1 + sovGenerated(uint64(m.Packets)) - n += 1 + sovGenerated(uint64(m.Bytes)) - n += 1 + sovGenerated(uint64(m.Sessions)) - return n -} - -func sovGenerated(x uint64) (n int) { + l = len(m.NodeName) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.TargetIPLatencyStats) > 0 { + for _, e := range m.TargetIPLatencyStats { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *RuleTrafficStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.TrafficStats.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TargetIPLatencyStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TargetIP) + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastSendTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.LastRecvTime.Size() + n += 1 + l + sovGenerated(uint64(l)) + n += 1 + sovGenerated(uint64(m.LastMeasuredRTTNanoseconds)) + return n +} + +func (m *TrafficStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.Packets)) + n += 1 + sovGenerated(uint64(m.Bytes)) + n += 1 + sovGenerated(uint64(m.Sessions)) + return n +} + +func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { @@ -1233,6 +1617,54 @@ func (this *NetworkPolicyStatsList) String() string { }, "") return s } +func (this *NodeLatencyStatList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PeerNodeLatencyStats{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PeerNodeLatencyStats", "PeerNodeLatencyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&NodeLatencyStatList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *NodeLatencyStats) String() string { + if this == nil { + return "nil" + } + repeatedStringForPeerNodeLatencyStats := "[]PeerNodeLatencyStats{" + for _, f := range this.PeerNodeLatencyStats { + repeatedStringForPeerNodeLatencyStats += strings.Replace(strings.Replace(f.String(), "PeerNodeLatencyStats", "PeerNodeLatencyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForPeerNodeLatencyStats += "}" + s := strings.Join([]string{`&NodeLatencyStats{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `PeerNodeLatencyStats:` + repeatedStringForPeerNodeLatencyStats + `,`, + `}`, + }, "") + return s +} +func (this *PeerNodeLatencyStats) String() string { + if this == nil { + return "nil" + } + repeatedStringForTargetIPLatencyStats := "[]TargetIPLatencyStats{" + for _, f := range this.TargetIPLatencyStats { + repeatedStringForTargetIPLatencyStats += strings.Replace(strings.Replace(f.String(), "TargetIPLatencyStats", "TargetIPLatencyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForTargetIPLatencyStats += "}" + s := strings.Join([]string{`&PeerNodeLatencyStats{`, + `NodeName:` + fmt.Sprintf("%v", this.NodeName) + `,`, + `TargetIPLatencyStats:` + repeatedStringForTargetIPLatencyStats + `,`, + `}`, + }, "") + return s +} func (this *PodReference) String() string { if this == nil { return "nil" @@ -1255,6 +1687,19 @@ func (this *RuleTrafficStats) String() string { }, "") return s } +func (this *TargetIPLatencyStats) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TargetIPLatencyStats{`, + `TargetIP:` + fmt.Sprintf("%v", this.TargetIP) + `,`, + `LastSendTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastSendTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `LastRecvTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastRecvTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, + `LastMeasuredRTTNanoseconds:` + fmt.Sprintf("%v", this.LastMeasuredRTTNanoseconds) + `,`, + `}`, + }, "") + return s +} func (this *TrafficStats) String() string { if this == nil { return "nil" @@ -1356,23 +1801,556 @@ func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { break } } - if msglen < 0 { + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuleTrafficStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuleTrafficStats = append(m.RuleTrafficStats, RuleTrafficStats{}) + if err := m.RuleTrafficStats[len(m.RuleTrafficStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaClusterNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AntreaClusterNetworkPolicyStatsList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaClusterNetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, AntreaClusterNetworkPolicyStats{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaNetworkPolicyStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AntreaNetworkPolicyStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaNetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrafficStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuleTrafficStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RuleTrafficStats = append(m.RuleTrafficStats, RuleTrafficStats{}) + if err := m.RuleTrafficStats[len(m.RuleTrafficStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AntreaNetworkPolicyStatsList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaNetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, AntreaNetworkPolicyStats{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MulticastGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MulticastGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MulticastGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Group = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RuleTrafficStats", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1399,8 +2377,8 @@ func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RuleTrafficStats = append(m.RuleTrafficStats, RuleTrafficStats{}) - if err := m.RuleTrafficStats[len(m.RuleTrafficStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Pods = append(m.Pods, PodReference{}) + if err := m.Pods[len(m.Pods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1425,7 +2403,7 @@ func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { } return nil } -func (m *AntreaClusterNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { +func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1448,10 +2426,10 @@ func (m *AntreaClusterNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AntreaClusterNetworkPolicyStatsList: wiretype end group for non-group") + return fmt.Errorf("proto: MulticastGroupList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AntreaClusterNetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MulticastGroupList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1516,7 +2494,7 @@ func (m *AntreaClusterNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, AntreaClusterNetworkPolicyStats{}) + m.Items = append(m.Items, MulticastGroup{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1542,7 +2520,7 @@ func (m *AntreaClusterNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } return nil } -func (m *AntreaNetworkPolicyStats) Unmarshal(dAtA []byte) error { +func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1565,10 +2543,10 @@ func (m *AntreaNetworkPolicyStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AntreaNetworkPolicyStats: wiretype end group for non-group") + return fmt.Errorf("proto: NetworkPolicyStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AntreaNetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1637,40 +2615,6 @@ func (m *AntreaNetworkPolicyStats) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RuleTrafficStats", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RuleTrafficStats = append(m.RuleTrafficStats, RuleTrafficStats{}) - if err := m.RuleTrafficStats[len(m.RuleTrafficStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -1692,7 +2636,7 @@ func (m *AntreaNetworkPolicyStats) Unmarshal(dAtA []byte) error { } return nil } -func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { +func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1715,10 +2659,10 @@ func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AntreaNetworkPolicyStatsList: wiretype end group for non-group") + return fmt.Errorf("proto: NetworkPolicyStatsList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AntreaNetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1783,7 +2727,7 @@ func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, AntreaNetworkPolicyStats{}) + m.Items = append(m.Items, NetworkPolicyStats{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1809,7 +2753,7 @@ func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } return nil } -func (m *MulticastGroup) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1832,15 +2776,15 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MulticastGroup: wiretype end group for non-group") + return fmt.Errorf("proto: NodeLatencyStatList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MulticastGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeLatencyStatList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1867,45 +2811,13 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Group = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1932,8 +2844,8 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Pods = append(m.Pods, PodReference{}) - if err := m.Pods[len(m.Pods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, PeerNodeLatencyStats{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1958,7 +2870,7 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1981,15 +2893,15 @@ func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MulticastGroupList: wiretype end group for non-group") + return fmt.Errorf("proto: NodeLatencyStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MulticastGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2016,13 +2928,13 @@ func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PeerNodeLatencyStats", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2049,8 +2961,8 @@ func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, MulticastGroup{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PeerNodeLatencyStats = append(m.PeerNodeLatencyStats, PeerNodeLatencyStats{}) + if err := m.PeerNodeLatencyStats[len(m.PeerNodeLatencyStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2075,7 +2987,7 @@ func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { } return nil } -func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { +func (m *PeerNodeLatencyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2098,17 +3010,17 @@ func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyStats: wiretype end group for non-group") + return fmt.Errorf("proto: PeerNodeLatencyStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PeerNodeLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2118,28 +3030,27 @@ func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.NodeName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrafficStats", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TargetIPLatencyStats", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2166,7 +3077,8 @@ func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.TargetIPLatencyStats = append(m.TargetIPLatencyStats, TargetIPLatencyStats{}) + if err := m.TargetIPLatencyStats[len(m.TargetIPLatencyStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2191,7 +3103,7 @@ func (m *NetworkPolicyStats) Unmarshal(dAtA []byte) error { } return nil } -func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { +func (m *PodReference) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2214,17 +3126,17 @@ func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NetworkPolicyStatsList: wiretype end group for non-group") + return fmt.Errorf("proto: PodReference: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NetworkPolicyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodReference: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2234,30 +3146,29 @@ func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2267,25 +3178,23 @@ func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, NetworkPolicyStats{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Namespace = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2308,7 +3217,7 @@ func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodReference) Unmarshal(dAtA []byte) error { +func (m *RuleTrafficStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2331,10 +3240,10 @@ func (m *PodReference) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodReference: wiretype end group for non-group") + return fmt.Errorf("proto: RuleTrafficStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodReference: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RuleTrafficStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2371,9 +3280,9 @@ func (m *PodReference) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TrafficStats", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2383,23 +3292,24 @@ func (m *PodReference) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Namespace = string(dAtA[iNdEx:postIndex]) + if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2422,7 +3332,7 @@ func (m *PodReference) Unmarshal(dAtA []byte) error { } return nil } -func (m *RuleTrafficStats) Unmarshal(dAtA []byte) error { +func (m *TargetIPLatencyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2445,15 +3355,15 @@ func (m *RuleTrafficStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RuleTrafficStats: wiretype end group for non-group") + return fmt.Errorf("proto: TargetIPLatencyStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RuleTrafficStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TargetIPLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TargetIP", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2481,11 +3391,11 @@ func (m *RuleTrafficStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.TargetIP = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrafficStats", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastSendTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2512,10 +3422,62 @@ func (m *RuleTrafficStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.TrafficStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LastSendTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastRecvTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastRecvTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastMeasuredRTTNanoseconds", wireType) + } + m.LastMeasuredRTTNanoseconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastMeasuredRTTNanoseconds |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/pkg/apis/stats/v1alpha1/generated.proto b/pkg/apis/stats/v1alpha1/generated.proto index dd18b35deae..c206ab2d254 100644 --- a/pkg/apis/stats/v1alpha1/generated.proto +++ b/pkg/apis/stats/v1alpha1/generated.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -98,6 +98,31 @@ message NetworkPolicyStatsList { repeated NetworkPolicyStats items = 2; } +// NodeLatencyStatList is a list of PeerNodeLatencyStats objects. +message NodeLatencyStatList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta listMeta = 1; + + // The list of PeerNodeLatencyStats. + repeated PeerNodeLatencyStats items = 2; +} + +// NodeLatencyStats contains the latency stat of a Node. +message NodeLatencyStats { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta objectMeta = 1; + + // The list of PeerNodeLatencyStats. + repeated PeerNodeLatencyStats peerNodeLatencyStats = 2; +} + +// PeerNodeLatencyStats contains the latency stats of a Peer Node. +message PeerNodeLatencyStats { + // The Node's name. + optional string nodeName = 1; + + // The list of target IP latency stats. + repeated TargetIPLatencyStats targetIPLatencyStats = 2; +} + // PodReference represents a Pod Reference. message PodReference { // The name of this Pod. @@ -114,6 +139,21 @@ message RuleTrafficStats { optional TrafficStats trafficStats = 2; } +// TargetIPLatencyStats contains the latency stats of a target IP. +message TargetIPLatencyStats { + // The target IP address. + optional string targetIP = 1; + + // The timestamp of the last send packet. + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSendTime = 2; + + // The timestamp of the last receive packet. + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastRecvTime = 3; + + // The last valid rtt of the Node. + optional int64 lastMeasuredRTTNanoseconds = 4; +} + // TrafficStats contains the traffic stats of a NetworkPolicy. message TrafficStats { // Packets is the packets count hit by the NetworkPolicy. diff --git a/pkg/apis/stats/v1alpha1/register.go b/pkg/apis/stats/v1alpha1/register.go index fcdb9032339..e5bda941dc6 100644 --- a/pkg/apis/stats/v1alpha1/register.go +++ b/pkg/apis/stats/v1alpha1/register.go @@ -49,6 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &NetworkPolicyStatsList{}, &MulticastGroup{}, &MulticastGroupList{}, + &NodeLatencyStats{}, + &NodeLatencyStatList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index c36f63a8a26..f2e7c7a6663 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -146,3 +146,49 @@ type RuleTrafficStats struct { Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` TrafficStats TrafficStats `json:"trafficStats,omitempty" protobuf:"bytes,2,opt,name=trafficStats"` } + +// +genclient +// +genclient:nonNamespaced +// +resourceName=nodelatencystats +// +genclient:onlyVerbs=create +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NodeLatencyStats contains the latency stat of a Node. +type NodeLatencyStats struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=objectMeta"` + + // The list of PeerNodeLatencyStats. + PeerNodeLatencyStats []PeerNodeLatencyStats `json:"peerNodeLatencyStats,omitempty" protobuf:"bytes,2,rep,name=peerNodeLatencyStats"` +} + +// PeerNodeLatencyStats contains the latency stats of a Peer Node. +type PeerNodeLatencyStats struct { + // The Node's name. + NodeName string `json:"nodeName,omitempty" protobuf:"bytes,1,opt,name=nodeName"` + // The list of target IP latency stats. + TargetIPLatencyStats []TargetIPLatencyStats `json:"targetIPLatencyStats,omitempty" protobuf:"bytes,2,rep,name=targetIPLatencyStats"` +} + +// TargetIPLatencyStats contains the latency stats of a target IP. +type TargetIPLatencyStats struct { + // The target IP address. + TargetIP string `json:"targetIP,omitempty" protobuf:"bytes,1,opt,name=targetIP"` + // The timestamp of the last send packet. + LastSendTime metav1.Time `json:"lastSendTime,omitempty" protobuf:"bytes,2,opt,name=lastSendTime"` + // The timestamp of the last receive packet. + LastRecvTime metav1.Time `json:"lastRecvTime,omitempty" protobuf:"bytes,3,opt,name=lastRecvTime"` + // The last valid rtt of the Node. + LastMeasuredRTTNanoseconds int64 `json:"lastMeasuredRTTNanoseconds,omitempty" protobuf:"varint,4,opt,name=lastMeasuredRTTNanoseconds"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NodeLatencyStatList is a list of PeerNodeLatencyStats objects. +type NodeLatencyStatList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `protobuf:"bytes,1,opt,name=listMeta"` + + // The list of PeerNodeLatencyStats. + Items []PeerNodeLatencyStats `protobuf:"bytes,2,rep,name=items"` +} diff --git a/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go index d1c3417a338..706c333b16e 100644 --- a/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated // +build !ignore_autogenerated -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -277,6 +277,95 @@ func (in *NetworkPolicyStatsList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeLatencyStatList) DeepCopyInto(out *NodeLatencyStatList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PeerNodeLatencyStats, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStatList. +func (in *NodeLatencyStatList) DeepCopy() *NodeLatencyStatList { + if in == nil { + return nil + } + out := new(NodeLatencyStatList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeLatencyStatList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeLatencyStats) DeepCopyInto(out *NodeLatencyStats) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.PeerNodeLatencyStats != nil { + in, out := &in.PeerNodeLatencyStats, &out.PeerNodeLatencyStats + *out = make([]PeerNodeLatencyStats, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStats. +func (in *NodeLatencyStats) DeepCopy() *NodeLatencyStats { + if in == nil { + return nil + } + out := new(NodeLatencyStats) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeLatencyStats) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PeerNodeLatencyStats) DeepCopyInto(out *PeerNodeLatencyStats) { + *out = *in + if in.TargetIPLatencyStats != nil { + in, out := &in.TargetIPLatencyStats, &out.TargetIPLatencyStats + *out = make([]TargetIPLatencyStats, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerNodeLatencyStats. +func (in *PeerNodeLatencyStats) DeepCopy() *PeerNodeLatencyStats { + if in == nil { + return nil + } + out := new(PeerNodeLatencyStats) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodReference) DeepCopyInto(out *PodReference) { *out = *in @@ -310,6 +399,24 @@ func (in *RuleTrafficStats) DeepCopy() *RuleTrafficStats { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetIPLatencyStats) DeepCopyInto(out *TargetIPLatencyStats) { + *out = *in + in.LastSendTime.DeepCopyInto(&out.LastSendTime) + in.LastRecvTime.DeepCopyInto(&out.LastRecvTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetIPLatencyStats. +func (in *TargetIPLatencyStats) DeepCopy() *TargetIPLatencyStats { + if in == nil { + return nil + } + out := new(TargetIPLatencyStats) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrafficStats) DeepCopyInto(out *TrafficStats) { *out = *in diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 1dba25bbdd5..f435d704992 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -58,6 +58,7 @@ import ( "antrea.io/antrea/pkg/apiserver/registry/stats/antreanetworkpolicystats" "antrea.io/antrea/pkg/apiserver/registry/stats/multicastgroup" "antrea.io/antrea/pkg/apiserver/registry/stats/networkpolicystats" + "antrea.io/antrea/pkg/apiserver/registry/stats/nodelatencystat" "antrea.io/antrea/pkg/apiserver/registry/system/controllerinfo" "antrea.io/antrea/pkg/apiserver/registry/system/supportbundle" "antrea.io/antrea/pkg/apiserver/storage" @@ -240,6 +241,7 @@ func installAPIGroup(s *APIServer, c completedConfig) error { statsStorage["antreaclusternetworkpolicystats"] = antreaclusternetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["antreanetworkpolicystats"] = antreanetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["multicastgroups"] = multicastgroup.NewREST(c.extraConfig.statsAggregator) + statsStorage["nodeiplatencystats"] = nodelatencystat.NewREST() statsGroup.VersionedResourcesStorageMap["v1alpha1"] = statsStorage groups := []*genericapiserver.APIGroupInfo{&cpGroup, &systemGroup, &statsGroup} diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 2350ef80363..985cf30b6f5 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -163,8 +163,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "antrea.io/antrea/pkg/apis/stats/v1alpha1.MulticastGroupList": schema_pkg_apis_stats_v1alpha1_MulticastGroupList(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.NetworkPolicyStats": schema_pkg_apis_stats_v1alpha1_NetworkPolicyStats(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.NetworkPolicyStatsList": schema_pkg_apis_stats_v1alpha1_NetworkPolicyStatsList(ref), + "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStatList": schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref), + "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStats": schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref), + "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats": schema_pkg_apis_stats_v1alpha1_PeerNodeLatencyStats(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.PodReference": schema_pkg_apis_stats_v1alpha1_PodReference(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.RuleTrafficStats": schema_pkg_apis_stats_v1alpha1_RuleTrafficStats(ref), + "antrea.io/antrea/pkg/apis/stats/v1alpha1.TargetIPLatencyStats": schema_pkg_apis_stats_v1alpha1_TargetIPLatencyStats(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.TrafficStats": schema_pkg_apis_stats_v1alpha1_TrafficStats(ref), "antrea.io/antrea/pkg/apis/system/v1beta1.SupportBundle": schema_pkg_apis_system_v1beta1_SupportBundle(ref), "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref), @@ -6673,6 +6677,141 @@ func schema_pkg_apis_stats_v1alpha1_NetworkPolicyStatsList(ref common.ReferenceC } } +func schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeLatencyStatList is a list of PeerNodeLatencyStats objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "ListMeta": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "Items": { + SchemaProps: spec.SchemaProps{ + Description: "The list of PeerNodeLatencyStats.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats"), + }, + }, + }, + }, + }, + }, + Required: []string{"ListMeta", "Items"}, + }, + }, + Dependencies: []string{ + "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeLatencyStats contains the latency stat of a Node.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "peerNodeLatencyStats": { + SchemaProps: spec.SchemaProps{ + Description: "The list of PeerNodeLatencyStats.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_stats_v1alpha1_PeerNodeLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PeerNodeLatencyStats contains the latency stats of a Peer Node.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeName": { + SchemaProps: spec.SchemaProps{ + Description: "The Node's name.", + Type: []string{"string"}, + Format: "", + }, + }, + "targetIPLatencyStats": { + SchemaProps: spec.SchemaProps{ + Description: "The list of target IP latency stats.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("antrea.io/antrea/pkg/apis/stats/v1alpha1.TargetIPLatencyStats"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "antrea.io/antrea/pkg/apis/stats/v1alpha1.TargetIPLatencyStats"}, + } +} + func schema_pkg_apis_stats_v1alpha1_PodReference(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -6727,6 +6866,47 @@ func schema_pkg_apis_stats_v1alpha1_RuleTrafficStats(ref common.ReferenceCallbac } } +func schema_pkg_apis_stats_v1alpha1_TargetIPLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TargetIPLatencyStats contains the latency stats of a target IP.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetIP": { + SchemaProps: spec.SchemaProps{ + Description: "The target IP address.", + Type: []string{"string"}, + Format: "", + }, + }, + "lastSendTime": { + SchemaProps: spec.SchemaProps{ + Description: "The timestamp of the last send packet.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastRecvTime": { + SchemaProps: spec.SchemaProps{ + Description: "The timestamp of the last receive packet.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastMeasuredRTTNanoseconds": { + SchemaProps: spec.SchemaProps{ + Description: "The last valid rtt of the Node.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + func schema_pkg_apis_stats_v1alpha1_TrafficStats(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/apiserver/registry/stats/nodelatencystat/rest.go b/pkg/apiserver/registry/stats/nodelatencystat/rest.go new file mode 100644 index 00000000000..90e5729ae36 --- /dev/null +++ b/pkg/apiserver/registry/stats/nodelatencystat/rest.go @@ -0,0 +1,87 @@ +// Copyright 2024 Antrea Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nodelatencystat + +import ( + "context" + + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +type REST struct { +} + +var ( + _ rest.Storage = &REST{} + _ rest.Scoper = &REST{} + _ rest.Getter = &REST{} + _ rest.Lister = &REST{} + _ rest.SingularNameProvider = &REST{} +) + +// NewREST returns a REST object that will work against API services. +func NewREST() *REST { + return &REST{} +} + +func (r *REST) New() runtime.Object { + return &statsv1alpha1.NodeIPLatencyStat{} +} + +func (r *REST) Destroy() { +} + +func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) { + // TODO: fill this function in next PR + return &statsv1alpha1.NodeIPLatencyStat{}, nil +} + +func (r *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { + // TODO: fill this function in next PR + return &statsv1alpha1.NodeIPLatencyStat{}, nil +} + +func (r *REST) NewList() runtime.Object { + return &statsv1alpha1.NodeIPLatencyStatList{} +} + +func (r *REST) List(ctx context.Context, options *internalversion.ListOptions) (runtime.Object, error) { + // TODO: fill this function in next PR + return &statsv1alpha1.NodeIPLatencyStatList{}, nil +} + +func (r *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { + // TODO: fill this function in next PR + table := &metav1.Table{ + ColumnDefinitions: []metav1.TableColumnDefinition{ + {Name: "SourceNodeName", Type: "string", Format: "name", Description: "Source node name."}, + {Name: "NodeIPLatencyList", Type: "array", Format: "string", Description: "Node IP latency list."}, + }, + } + + return table, nil +} + +func (r *REST) NamespaceScoped() bool { + return false +} + +func (r *REST) GetSingularName() string { + return "nodeiplatencystat" +} diff --git a/pkg/apiserver/registry/stats/nodelatencystat/rest_test.go b/pkg/apiserver/registry/stats/nodelatencystat/rest_test.go new file mode 100644 index 00000000000..a67bc6590ba --- /dev/null +++ b/pkg/apiserver/registry/stats/nodelatencystat/rest_test.go @@ -0,0 +1,15 @@ +// Copyright 2024 Antrea Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nodelatencystat diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go new file mode 100644 index 00000000000..388e21c8d18 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go @@ -0,0 +1,44 @@ +// Copyright 2024 Antrea Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeNodeLatencyStatses implements NodeLatencyStatsInterface +type FakeNodeLatencyStatses struct { + Fake *FakeStatsV1alpha1 +} + +var nodelatencystatsesResource = v1alpha1.SchemeGroupVersion.WithResource("nodelatencystats") + +var nodelatencystatsesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeLatencyStats") + +// Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. +func (c *FakeNodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(nodelatencystatsesResource, nodeLatencyStats), &v1alpha1.NodeLatencyStats{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NodeLatencyStats), err +} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_stats_client.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_stats_client.go index 1d4a10166fd..9758bc7d792 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_stats_client.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_stats_client.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -42,6 +42,10 @@ func (c *FakeStatsV1alpha1) NetworkPolicyStats(namespace string) v1alpha1.Networ return &FakeNetworkPolicyStats{c, namespace} } +func (c *FakeStatsV1alpha1) NodeLatencyStatses() v1alpha1.NodeLatencyStatsInterface { + return &FakeNodeLatencyStatses{c} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeStatsV1alpha1) RESTClient() rest.Interface { diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/generated_expansion.go index 152ec4a23fa..6ca2d9d477b 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/generated_expansion.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,3 +23,5 @@ type AntreaNetworkPolicyStatsExpansion interface{} type MulticastGroupExpansion interface{} type NetworkPolicyStatsExpansion interface{} + +type NodeLatencyStatsExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go new file mode 100644 index 00000000000..21c1d216643 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go @@ -0,0 +1,62 @@ +// Copyright 2024 Antrea Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + + v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// NodeLatencyStatsesGetter has a method to return a NodeLatencyStatsInterface. +// A group's client should implement this interface. +type NodeLatencyStatsesGetter interface { + NodeLatencyStatses() NodeLatencyStatsInterface +} + +// NodeLatencyStatsInterface has methods to work with NodeLatencyStats resources. +type NodeLatencyStatsInterface interface { + Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (*v1alpha1.NodeLatencyStats, error) + NodeLatencyStatsExpansion +} + +// nodeLatencyStatses implements NodeLatencyStatsInterface +type nodeLatencyStatses struct { + client rest.Interface +} + +// newNodeLatencyStatses returns a NodeLatencyStatses +func newNodeLatencyStatses(c *StatsV1alpha1Client) *nodeLatencyStatses { + return &nodeLatencyStatses{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. +func (c *nodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { + result = &v1alpha1.NodeLatencyStats{} + err = c.client.Post(). + Resource("nodelatencystats"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(nodeLatencyStats). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/stats_client.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/stats_client.go index 88d009e10a9..287da4aff63 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/stats_client.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/stats_client.go @@ -1,4 +1,4 @@ -// Copyright 2022 Antrea Authors +// Copyright 2024 Antrea Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ type StatsV1alpha1Interface interface { AntreaNetworkPolicyStatsGetter MulticastGroupsGetter NetworkPolicyStatsGetter + NodeLatencyStatsesGetter } // StatsV1alpha1Client is used to interact with features provided by the stats.antrea.io group. @@ -53,6 +54,10 @@ func (c *StatsV1alpha1Client) NetworkPolicyStats(namespace string) NetworkPolicy return newNetworkPolicyStats(c, namespace) } +func (c *StatsV1alpha1Client) NodeLatencyStatses() NodeLatencyStatsInterface { + return newNodeLatencyStatses(c) +} + // NewForConfig creates a new StatsV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). From 495183bd14b41e3334acf8a04b69bdcbfcabd0bf Mon Sep 17 00:00:00 2001 From: Asklv Date: Fri, 7 Jun 2024 16:29:19 +0800 Subject: [PATCH 2/7] fix: fix resource define. Signed-off-by: Asklv --- build/yamls/antrea-aks.yml | 5 +---- build/yamls/antrea-eks.yml | 5 +---- build/yamls/antrea-gke.yml | 5 +---- build/yamls/antrea-ipsec.yml | 5 +---- build/yamls/antrea.yml | 5 +---- pkg/agent/monitortool/latency_store.go | 3 ++- pkg/agent/monitortool/monitor.go | 15 ++++++++------- pkg/apis/stats/v1alpha1/types.go | 4 ++-- pkg/apiserver/apiserver.go | 2 +- .../registry/stats/nodelatencystat/rest.go | 15 ++++++++------- 10 files changed, 26 insertions(+), 38 deletions(-) diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index aeb9e269179..b91909ba674 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodelatencystats + - nodeiplatencystats verbs: - create - apiGroups: @@ -4403,12 +4403,9 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats - - nodeiplatencystats verbs: - get - list - - create - - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index d7e89a8b663..f2977640df7 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodelatencystats + - nodeiplatencystats verbs: - create - apiGroups: @@ -4403,12 +4403,9 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats - - nodeiplatencystats verbs: - get - list - - create - - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index a8eb26b62d8..ed648a3928b 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodelatencystats + - nodeiplatencystats verbs: - create - apiGroups: @@ -4403,12 +4403,9 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats - - nodeiplatencystats verbs: - get - list - - create - - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index 6a1f305148a..fa9ae4bee28 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -4160,7 +4160,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodelatencystats + - nodeiplatencystats verbs: - create - apiGroups: @@ -4416,12 +4416,9 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats - - nodeiplatencystats verbs: - get - list - - create - - update - apiGroups: - system.antrea.io resources: diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index f12fc2fda54..96f258aa0cd 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodelatencystats + - nodeiplatencystats verbs: - create - apiGroups: @@ -4403,12 +4403,9 @@ rules: - networkpolicystats - antreaclusternetworkpolicystats - antreanetworkpolicystats - - nodeiplatencystats verbs: - get - list - - create - - update - apiGroups: - system.antrea.io resources: diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index 6f9230ee225..05ebffa73f0 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -20,13 +20,14 @@ import ( "sync" "time" - stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "github.com/containernetworking/plugins/pkg/ip" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" + stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + "antrea.io/antrea/pkg/util/k8s" ) diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index 1d7e9e485af..9ed5d9157c9 100644 --- a/pkg/agent/monitortool/monitor.go +++ b/pkg/agent/monitortool/monitor.go @@ -15,15 +15,12 @@ package monitortool import ( - "context" "math/rand" "net" "sync" "sync/atomic" "time" - stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" - "antrea.io/antrea/pkg/util/env" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" @@ -34,6 +31,9 @@ import ( "k8s.io/klog/v2" "k8s.io/utils/clock" + stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + "antrea.io/antrea/pkg/util/env" + "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" "antrea.io/antrea/pkg/apis/crd/v1alpha1" @@ -384,7 +384,7 @@ func (m *NodeLatencyMonitor) GetSummary() *stv1aplpha1.NodeLatencyStats { Name: nodeName, }, PeerNodeLatencyStats: []stv1aplpha1.PeerNodeLatencyStats{ - stv1aplpha1.PeerNodeLatencyStats{ + { NodeName: nodeName, TargetIPLatencyStats: m.latencyStore.ConvertList(), }, @@ -404,9 +404,10 @@ func (m *NodeLatencyMonitor) report() { klog.ErrorS(err, "Failed to get Antrea client") return } - if _, err := antreaClient.StatsV1alpha1().NodeLatencyStats().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { - klog.ErrorS(err, "Failed to update NodeIPLatencyStats") - } + _ = antreaClient + // if _, err := antreaClient.StatsV1alpha1().NodeLatencyStats().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { + // klog.ErrorS(err, "Failed to update NodeIPLatencyStats") + // } } // Run starts the NodeLatencyMonitor. diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index f2e7c7a6663..717249b6ba1 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -187,8 +187,8 @@ type TargetIPLatencyStats struct { // NodeLatencyStatList is a list of PeerNodeLatencyStats objects. type NodeLatencyStatList struct { metav1.TypeMeta `json:",inline"` - metav1.ListMeta `protobuf:"bytes,1,opt,name=listMeta"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The list of PeerNodeLatencyStats. - Items []PeerNodeLatencyStats `protobuf:"bytes,2,rep,name=items"` + Items []PeerNodeLatencyStats `json:"items" protobuf:"bytes,2,rep,name=items"` } diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index f435d704992..9190616e1ea 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -241,7 +241,7 @@ func installAPIGroup(s *APIServer, c completedConfig) error { statsStorage["antreaclusternetworkpolicystats"] = antreaclusternetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["antreanetworkpolicystats"] = antreanetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["multicastgroups"] = multicastgroup.NewREST(c.extraConfig.statsAggregator) - statsStorage["nodeiplatencystats"] = nodelatencystat.NewREST() + statsStorage["nodelatencystats"] = nodelatencystat.NewREST() statsGroup.VersionedResourcesStorageMap["v1alpha1"] = statsStorage groups := []*genericapiserver.APIGroupInfo{&cpGroup, &systemGroup, &statsGroup} diff --git a/pkg/apiserver/registry/stats/nodelatencystat/rest.go b/pkg/apiserver/registry/stats/nodelatencystat/rest.go index 90e5729ae36..b3854914edf 100644 --- a/pkg/apiserver/registry/stats/nodelatencystat/rest.go +++ b/pkg/apiserver/registry/stats/nodelatencystat/rest.go @@ -17,11 +17,12 @@ package nodelatencystat import ( "context" - statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/rest" + + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" ) type REST struct { @@ -41,7 +42,7 @@ func NewREST() *REST { } func (r *REST) New() runtime.Object { - return &statsv1alpha1.NodeIPLatencyStat{} + return &statsv1alpha1.NodeLatencyStats{} } func (r *REST) Destroy() { @@ -49,21 +50,21 @@ func (r *REST) Destroy() { func (r *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) { // TODO: fill this function in next PR - return &statsv1alpha1.NodeIPLatencyStat{}, nil + return &statsv1alpha1.NodeLatencyStats{}, nil } func (r *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { // TODO: fill this function in next PR - return &statsv1alpha1.NodeIPLatencyStat{}, nil + return &statsv1alpha1.NodeLatencyStats{}, nil } func (r *REST) NewList() runtime.Object { - return &statsv1alpha1.NodeIPLatencyStatList{} + return &statsv1alpha1.NodeLatencyStats{} } func (r *REST) List(ctx context.Context, options *internalversion.ListOptions) (runtime.Object, error) { // TODO: fill this function in next PR - return &statsv1alpha1.NodeIPLatencyStatList{}, nil + return &statsv1alpha1.NodeLatencyStatList{}, nil } func (r *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { @@ -83,5 +84,5 @@ func (r *REST) NamespaceScoped() bool { } func (r *REST) GetSingularName() string { - return "nodeiplatencystat" + return "nodelatencystat" } From 431097b0c90fb34e3e32ff6c237f58674640ee19 Mon Sep 17 00:00:00 2001 From: Asklv Date: Sun, 9 Jun 2024 02:31:58 +0800 Subject: [PATCH 3/7] fix: fix generated issues and api types. Signed-off-by: Asklv --- .../antrea/templates/agent/clusterrole.yaml | 2 +- build/yamls/antrea-aks.yml | 2 +- build/yamls/antrea-eks.yml | 2 +- build/yamls/antrea-gke.yml | 2 +- build/yamls/antrea-ipsec.yml | 2 +- build/yamls/antrea.yml | 2 +- pkg/agent/monitortool/latency_store.go | 41 ++- pkg/agent/monitortool/monitor.go | 39 ++- pkg/apis/stats/v1alpha1/generated.pb.go | 267 +++++++++--------- pkg/apis/stats/v1alpha1/generated.proto | 24 +- pkg/apis/stats/v1alpha1/register.go | 2 +- pkg/apis/stats/v1alpha1/types.go | 16 +- .../stats/v1alpha1/zz_generated.deepcopy.go | 34 +-- pkg/apiserver/apiserver.go | 2 +- pkg/apiserver/openapi/zz_generated.openapi.go | 36 +-- .../rest.go | 8 +- .../rest_test.go | 2 +- 17 files changed, 246 insertions(+), 237 deletions(-) rename pkg/apiserver/registry/stats/{nodelatencystat => nodelatencystats}/rest.go (92%) rename pkg/apiserver/registry/stats/{nodelatencystat => nodelatencystats}/rest_test.go (95%) diff --git a/build/charts/antrea/templates/agent/clusterrole.yaml b/build/charts/antrea/templates/agent/clusterrole.yaml index 42e62a52f24..ef1c43e40e8 100644 --- a/build/charts/antrea/templates/agent/clusterrole.yaml +++ b/build/charts/antrea/templates/agent/clusterrole.yaml @@ -8,7 +8,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index b91909ba674..614642ea2bb 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index f2977640df7..48f9f6e25f3 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index ed648a3928b..890815f6963 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index fa9ae4bee28..1e8c2e8ca34 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -4160,7 +4160,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 96f258aa0cd..68f2d18cd52 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -4147,7 +4147,7 @@ rules: - apiGroups: - stats.antrea.io resources: - - nodeiplatencystats + - nodelatencystats verbs: - create - apiGroups: diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index 05ebffa73f0..3862627afde 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" - stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "antrea.io/antrea/pkg/util/k8s" ) @@ -252,21 +252,38 @@ func (s *LatencyStore) DeleteStaleNodeIPs() { } } -// ConvertList converts the latency store to a list of TargetIPLatencyStats. -func (l *LatencyStore) ConvertList() []stv1aplpha1.TargetIPLatencyStats { +// ConvertList converts the latency store to a list of PeerNodeLatencyStats. +func (l *LatencyStore) ConvertList(excludedNodeName string) []statsv1alpha1.PeerNodeLatencyStats { l.mutex.RLock() defer l.mutex.RUnlock() - entries := make([]stv1aplpha1.TargetIPLatencyStats, 0, len(l.nodeIPLatencyMap)) - for nodeIP, entry := range l.nodeIPLatencyMap { - tempEntry := stv1aplpha1.TargetIPLatencyStats{ - TargetIP: nodeIP, - LastSendTime: metav1.NewTime(entry.LastSendTime), - LastRecvTime: metav1.NewTime(entry.LastRecvTime), - LastMeasuredRTTNanoseconds: entry.LastMeasuredRTT.Nanoseconds(), + // PeerNodeLatencyStats should be a list of size N-1, where N is the number of Nodes in the cluster. + // We will have N-1 entries for each Node, each entry containing the latency stats for the connection, + // TargetIPLatencyStats will be a list of size 1 (single-stack case) or 2 (dual-stack case). + peerNodeLatencyStatsList := make([]statsv1alpha1.PeerNodeLatencyStats, 0, len(l.nodeIPLatencyMap)-1) + for nodeName, nodeIPs := range l.nodeTargetIPsMap { + if nodeName == excludedNodeName { + continue } - entries = append(entries, tempEntry) + + targetIPLatencyStats := make([]statsv1alpha1.TargetIPLatencyStats, 0, len(nodeIPs)) + for _, nodeIP := range nodeIPs { + nodeIPStr := nodeIP.String() + tempEntry := statsv1alpha1.TargetIPLatencyStats{ + TargetIP: nodeIPStr, + LastSendTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastSendTime), + LastRecvTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastRecvTime), + LastMeasuredRTTNanoseconds: l.nodeIPLatencyMap[nodeIPStr].LastMeasuredRTT.Nanoseconds(), + } + targetIPLatencyStats = append(targetIPLatencyStats, tempEntry) + } + + peerNodeLatencyStats := statsv1alpha1.PeerNodeLatencyStats{ + NodeName: nodeName, + TargetIPLatencyStats: targetIPLatencyStats, + } + peerNodeLatencyStatsList = append(peerNodeLatencyStatsList, peerNodeLatencyStats) } - return entries + return peerNodeLatencyStatsList } diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index 9ed5d9157c9..ba5eb012da5 100644 --- a/pkg/agent/monitortool/monitor.go +++ b/pkg/agent/monitortool/monitor.go @@ -15,6 +15,7 @@ package monitortool import ( + "context" "math/rand" "net" "sync" @@ -31,8 +32,7 @@ import ( "k8s.io/klog/v2" "k8s.io/utils/clock" - stv1aplpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" - "antrea.io/antrea/pkg/util/env" + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" @@ -144,7 +144,7 @@ func (m *NodeLatencyMonitor) onNodeAdd(obj interface{}) { m.latencyStore.addNode(node) - klog.InfoS("Node added", "Node", klog.KObj(node)) + klog.V(4).InfoS("Node added", "Node", klog.KObj(node)) } // onNodeUpdate is the event handler for updating Node. @@ -156,7 +156,7 @@ func (m *NodeLatencyMonitor) onNodeUpdate(oldObj, newObj interface{}) { m.latencyStore.updateNode(node) - klog.InfoS("Node updated", "Node", klog.KObj(node)) + klog.V(4).InfoS("Node updated", "Node", klog.KObj(node)) } // onNodeDelete is the event handler for deleting Node. @@ -185,7 +185,7 @@ func (m *NodeLatencyMonitor) onNodeDelete(obj interface{}) { // onNodeLatencyMonitorAdd is the event handler for adding NodeLatencyMonitor. func (m *NodeLatencyMonitor) onNodeLatencyMonitorAdd(obj interface{}) { nlm := obj.(*v1alpha1.NodeLatencyMonitor) - klog.InfoS("NodeLatencyMonitor added", "NodeLatencyMonitor", klog.KObj(nlm)) + klog.V(4).InfoS("NodeLatencyMonitor added", "NodeLatencyMonitor", klog.KObj(nlm)) m.updateLatencyConfig(nlm) } @@ -194,7 +194,7 @@ func (m *NodeLatencyMonitor) onNodeLatencyMonitorAdd(obj interface{}) { func (m *NodeLatencyMonitor) onNodeLatencyMonitorUpdate(oldObj, newObj interface{}) { oldNLM := oldObj.(*v1alpha1.NodeLatencyMonitor) newNLM := newObj.(*v1alpha1.NodeLatencyMonitor) - klog.InfoS("NodeLatencyMonitor updated", "NodeLatencyMonitor", klog.KObj(newNLM)) + klog.V(4).InfoS("NodeLatencyMonitor updated", "NodeLatencyMonitor", klog.KObj(newNLM)) if oldNLM.GetGeneration() == newNLM.GetGeneration() { return @@ -247,7 +247,7 @@ func (m *NodeLatencyMonitor) sendPing(socket net.PacketConn, addr net.IP) error Code: 0, Body: body, } - klog.InfoS("Sending ICMP message", "IP", ip, "SeqID", seqID, "body", body) + klog.V(4).InfoS("Sending ICMP message", "IP", ip, "SeqID", seqID, "body", body) // Serialize the ICMP message msgBytes, err := msg.Marshal(nil) @@ -358,7 +358,7 @@ func (m *NodeLatencyMonitor) recvPings(socket net.PacketConn, isIPv4 bool) { // pingAll sends ICMP messages to all the Nodes. func (m *NodeLatencyMonitor) pingAll(ipv4Socket, ipv6Socket net.PacketConn) { - klog.InfoS("Pinging all Nodes") + klog.V(4).InfoS("Pinging all Nodes") nodeIPs := m.latencyStore.ListNodeIPs() for _, toIP := range nodeIPs { if toIP.To4() != nil && ipv4Socket != nil { @@ -373,24 +373,17 @@ func (m *NodeLatencyMonitor) pingAll(ipv4Socket, ipv6Socket net.PacketConn) { klog.V(3).InfoS("Cannot send ICMP message to Node IP because socket is not initialized for IP family", "IP", toIP) } } - klog.InfoS("Done pinging all Nodes") + klog.V(4).InfoS("Done pinging all Nodes") } // GetSummary returns the latency summary of the given Node IP. -func (m *NodeLatencyMonitor) GetSummary() *stv1aplpha1.NodeLatencyStats { - nodeName, _ := env.GetNodeName() - return &stv1aplpha1.NodeLatencyStats{ +func (m *NodeLatencyMonitor) GetSummary() *statsv1alpha1.NodeLatencyStats { + return &statsv1alpha1.NodeLatencyStats{ ObjectMeta: metav1.ObjectMeta{ - Name: nodeName, - }, - PeerNodeLatencyStats: []stv1aplpha1.PeerNodeLatencyStats{ - { - NodeName: nodeName, - TargetIPLatencyStats: m.latencyStore.ConvertList(), - }, + Name: m.nodeName, }, + PeerNodeLatencyStats: m.latencyStore.ConvertList(m.nodeName), } - } func (m *NodeLatencyMonitor) report() { @@ -405,9 +398,9 @@ func (m *NodeLatencyMonitor) report() { return } _ = antreaClient - // if _, err := antreaClient.StatsV1alpha1().NodeLatencyStats().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { - // klog.ErrorS(err, "Failed to update NodeIPLatencyStats") - // } + if _, err := antreaClient.StatsV1alpha1().NodeLatencyStatses().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { + klog.ErrorS(err, "Failed to update NodeIPLatencyStats") + } } // Run starts the NodeLatencyMonitor. diff --git a/pkg/apis/stats/v1alpha1/generated.pb.go b/pkg/apis/stats/v1alpha1/generated.pb.go index 68d8b1901b2..0296fae153e 100644 --- a/pkg/apis/stats/v1alpha1/generated.pb.go +++ b/pkg/apis/stats/v1alpha1/generated.pb.go @@ -264,15 +264,15 @@ func (m *NetworkPolicyStatsList) XXX_DiscardUnknown() { var xxx_messageInfo_NetworkPolicyStatsList proto.InternalMessageInfo -func (m *NodeLatencyStatList) Reset() { *m = NodeLatencyStatList{} } -func (*NodeLatencyStatList) ProtoMessage() {} -func (*NodeLatencyStatList) Descriptor() ([]byte, []int) { +func (m *NodeLatencyStats) Reset() { *m = NodeLatencyStats{} } +func (*NodeLatencyStats) ProtoMessage() {} +func (*NodeLatencyStats) Descriptor() ([]byte, []int) { return fileDescriptor_91b517c6fa558473, []int{8} } -func (m *NodeLatencyStatList) XXX_Unmarshal(b []byte) error { +func (m *NodeLatencyStats) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NodeLatencyStatList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *NodeLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -280,27 +280,27 @@ func (m *NodeLatencyStatList) XXX_Marshal(b []byte, deterministic bool) ([]byte, } return b[:n], nil } -func (m *NodeLatencyStatList) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeLatencyStatList.Merge(m, src) +func (m *NodeLatencyStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLatencyStats.Merge(m, src) } -func (m *NodeLatencyStatList) XXX_Size() int { +func (m *NodeLatencyStats) XXX_Size() int { return m.Size() } -func (m *NodeLatencyStatList) XXX_DiscardUnknown() { - xxx_messageInfo_NodeLatencyStatList.DiscardUnknown(m) +func (m *NodeLatencyStats) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLatencyStats.DiscardUnknown(m) } -var xxx_messageInfo_NodeLatencyStatList proto.InternalMessageInfo +var xxx_messageInfo_NodeLatencyStats proto.InternalMessageInfo -func (m *NodeLatencyStats) Reset() { *m = NodeLatencyStats{} } -func (*NodeLatencyStats) ProtoMessage() {} -func (*NodeLatencyStats) Descriptor() ([]byte, []int) { +func (m *NodeLatencyStatsList) Reset() { *m = NodeLatencyStatsList{} } +func (*NodeLatencyStatsList) ProtoMessage() {} +func (*NodeLatencyStatsList) Descriptor() ([]byte, []int) { return fileDescriptor_91b517c6fa558473, []int{9} } -func (m *NodeLatencyStats) XXX_Unmarshal(b []byte) error { +func (m *NodeLatencyStatsList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *NodeLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *NodeLatencyStatsList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { @@ -308,17 +308,17 @@ func (m *NodeLatencyStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, er } return b[:n], nil } -func (m *NodeLatencyStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeLatencyStats.Merge(m, src) +func (m *NodeLatencyStatsList) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLatencyStatsList.Merge(m, src) } -func (m *NodeLatencyStats) XXX_Size() int { +func (m *NodeLatencyStatsList) XXX_Size() int { return m.Size() } -func (m *NodeLatencyStats) XXX_DiscardUnknown() { - xxx_messageInfo_NodeLatencyStats.DiscardUnknown(m) +func (m *NodeLatencyStatsList) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLatencyStatsList.DiscardUnknown(m) } -var xxx_messageInfo_NodeLatencyStats proto.InternalMessageInfo +var xxx_messageInfo_NodeLatencyStatsList proto.InternalMessageInfo func (m *PeerNodeLatencyStats) Reset() { *m = PeerNodeLatencyStats{} } func (*PeerNodeLatencyStats) ProtoMessage() {} @@ -469,8 +469,8 @@ func init() { proto.RegisterType((*MulticastGroupList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.MulticastGroupList") proto.RegisterType((*NetworkPolicyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NetworkPolicyStats") proto.RegisterType((*NetworkPolicyStatsList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NetworkPolicyStatsList") - proto.RegisterType((*NodeLatencyStatList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NodeLatencyStatList") proto.RegisterType((*NodeLatencyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NodeLatencyStats") + proto.RegisterType((*NodeLatencyStatsList)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.NodeLatencyStatsList") proto.RegisterType((*PeerNodeLatencyStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.PeerNodeLatencyStats") proto.RegisterType((*PodReference)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.PodReference") proto.RegisterType((*RuleTrafficStats)(nil), "antrea_io.antrea.pkg.apis.stats.v1alpha1.RuleTrafficStats") @@ -483,65 +483,64 @@ func init() { } var fileDescriptor_91b517c6fa558473 = []byte{ - // 917 bytes of a gzipped FileDescriptorProto + // 906 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcf, 0x6f, 0xe3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, 0xc1, + 0x25, 0xc3, 0x61, 0x9f, 0x86, 0x8c, 0x83, 0xc3, 0x42, 0x97, 0x77, 0x36, 0xf6, 0x51, 0xaf, 0x65, + 0x1b, 0x19, 0x4e, 0xf7, 0xf8, 0xc6, 0x48, 0xf2, 0x2f, 0x28, 0xc6, 0x77, 0x08, 0x97, 0x54, 0xd1, + 0xde, 0xc4, 0x77, 0x22, 0xea, 0x8c, 0x41, 0x70, 0x35, 0xed, 0x96, 0xfd, 0x5a, 0xc6, 0x70, 0x67, + 0x90, 0x9a, 0x49, 0xee, 0x97, 0xff, 0x94, 0x8c, 0x2e, 0x05, 0xa4, 0xdb, 0xd1, 0x2a, 0x4e, 0xaf, + 0x2d, 0x8d, 0x24, 0xf5, 0x49, 0xf9, 0x38, 0x70, 0xee, 0xb3, 0x90, 0xab, 0x31, 0xb5, 0x0a, 0xf9, + 0x4e, 0x33, 0x3b, 0x99, 0x45, 0xd8, 0xfd, 0xab, 0x6b, 0xbd, 0xf1, 0xf4, 0x5a, 0x6f, 0x3c, 0xbb, + 0xd6, 0x1b, 0x8f, 0xa7, 0x3a, 0xba, 0x9a, 0xea, 0xe8, 0xe9, 0x54, 0x47, 0xcf, 0xa6, 0x3a, 0xfa, + 0x65, 0xaa, 0xa3, 0x27, 0xbf, 0xea, 0x8d, 0xcf, 0x7b, 0x75, 0x7f, 0x81, 0xff, 0x13, 0x00, 0x00, + 0xff, 0xff, 0x1b, 0x44, 0xff, 0x68, 0xac, 0x0f, 0x00, 0x00, } func (m *AntreaClusterNetworkPolicyStats) Marshal() (dAtA []byte, err error) { @@ -941,7 +940,7 @@ func (m *NetworkPolicyStatsList) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *NodeLatencyStatList) Marshal() (dAtA []byte, err error) { +func (m *NodeLatencyStats) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -951,20 +950,20 @@ func (m *NodeLatencyStatList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NodeLatencyStatList) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeLatencyStats) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NodeLatencyStatList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + if len(m.PeerNodeLatencyStats) > 0 { + for iNdEx := len(m.PeerNodeLatencyStats) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.PeerNodeLatencyStats[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -976,7 +975,7 @@ func (m *NodeLatencyStatList) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -988,7 +987,7 @@ func (m *NodeLatencyStatList) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *NodeLatencyStats) Marshal() (dAtA []byte, err error) { +func (m *NodeLatencyStatsList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -998,20 +997,20 @@ func (m *NodeLatencyStats) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NodeLatencyStats) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeLatencyStatsList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NodeLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeLatencyStatsList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.PeerNodeLatencyStats) > 0 { - for iNdEx := len(m.PeerNodeLatencyStats) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.PeerNodeLatencyStats[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1023,7 +1022,7 @@ func (m *NodeLatencyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1380,16 +1379,16 @@ func (m *NetworkPolicyStatsList) Size() (n int) { return n } -func (m *NodeLatencyStatList) Size() (n int) { +func (m *NodeLatencyStats) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.ListMeta.Size() + l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { + if len(m.PeerNodeLatencyStats) > 0 { + for _, e := range m.PeerNodeLatencyStats { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } @@ -1397,16 +1396,16 @@ func (m *NodeLatencyStatList) Size() (n int) { return n } -func (m *NodeLatencyStats) Size() (n int) { +func (m *NodeLatencyStatsList) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.ObjectMeta.Size() + l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) - if len(m.PeerNodeLatencyStats) > 0 { - for _, e := range m.PeerNodeLatencyStats { + if len(m.Items) > 0 { + for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } @@ -1617,22 +1616,6 @@ func (this *NetworkPolicyStatsList) String() string { }, "") return s } -func (this *NodeLatencyStatList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]PeerNodeLatencyStats{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PeerNodeLatencyStats", "PeerNodeLatencyStats", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&NodeLatencyStatList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} func (this *NodeLatencyStats) String() string { if this == nil { return "nil" @@ -1649,6 +1632,22 @@ func (this *NodeLatencyStats) String() string { }, "") return s } +func (this *NodeLatencyStatsList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]NodeLatencyStats{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NodeLatencyStats", "NodeLatencyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&NodeLatencyStatsList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} func (this *PeerNodeLatencyStats) String() string { if this == nil { return "nil" @@ -2753,7 +2752,7 @@ func (m *NetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2776,15 +2775,15 @@ func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeLatencyStatList: wiretype end group for non-group") + return fmt.Errorf("proto: NodeLatencyStats: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeLatencyStatList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2811,13 +2810,13 @@ func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PeerNodeLatencyStats", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2844,8 +2843,8 @@ func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, PeerNodeLatencyStats{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.PeerNodeLatencyStats = append(m.PeerNodeLatencyStats, PeerNodeLatencyStats{}) + if err := m.PeerNodeLatencyStats[len(m.PeerNodeLatencyStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2870,7 +2869,7 @@ func (m *NodeLatencyStatList) Unmarshal(dAtA []byte) error { } return nil } -func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStatsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2893,15 +2892,15 @@ func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NodeLatencyStats: wiretype end group for non-group") + return fmt.Errorf("proto: NodeLatencyStatsList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NodeLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: NodeLatencyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2928,13 +2927,13 @@ func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerNodeLatencyStats", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2961,8 +2960,8 @@ func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PeerNodeLatencyStats = append(m.PeerNodeLatencyStats, PeerNodeLatencyStats{}) - if err := m.PeerNodeLatencyStats[len(m.PeerNodeLatencyStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Items = append(m.Items, NodeLatencyStats{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/pkg/apis/stats/v1alpha1/generated.proto b/pkg/apis/stats/v1alpha1/generated.proto index c206ab2d254..2b87ca0567c 100644 --- a/pkg/apis/stats/v1alpha1/generated.proto +++ b/pkg/apis/stats/v1alpha1/generated.proto @@ -98,22 +98,22 @@ message NetworkPolicyStatsList { repeated NetworkPolicyStats items = 2; } -// NodeLatencyStatList is a list of PeerNodeLatencyStats objects. -message NodeLatencyStatList { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta listMeta = 1; - - // The list of PeerNodeLatencyStats. - repeated PeerNodeLatencyStats items = 2; -} - // NodeLatencyStats contains the latency stat of a Node. message NodeLatencyStats { - optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta objectMeta = 1; + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The list of PeerNodeLatencyStats. repeated PeerNodeLatencyStats peerNodeLatencyStats = 2; } +// NodeLatencyStatsList is a list of NodeLatencyStats objects. +message NodeLatencyStatsList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // The list of NodeLatencyStats. + repeated NodeLatencyStats items = 2; +} + // PeerNodeLatencyStats contains the latency stats of a Peer Node. message PeerNodeLatencyStats { // The Node's name. @@ -144,13 +144,13 @@ message TargetIPLatencyStats { // The target IP address. optional string targetIP = 1; - // The timestamp of the last send packet. + // The timestamp of the last sent packet. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSendTime = 2; - // The timestamp of the last receive packet. + // The timestamp of the last received packet. optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastRecvTime = 3; - // The last valid rtt of the Node. + // The last measured RTT for this target IP, in nanoseconds. optional int64 lastMeasuredRTTNanoseconds = 4; } diff --git a/pkg/apis/stats/v1alpha1/register.go b/pkg/apis/stats/v1alpha1/register.go index e5bda941dc6..5dac9a121ec 100644 --- a/pkg/apis/stats/v1alpha1/register.go +++ b/pkg/apis/stats/v1alpha1/register.go @@ -50,7 +50,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { &MulticastGroup{}, &MulticastGroupList{}, &NodeLatencyStats{}, - &NodeLatencyStatList{}, + &NodeLatencyStatsList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index 717249b6ba1..de5c6361d4d 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -156,7 +156,7 @@ type RuleTrafficStats struct { // NodeLatencyStats contains the latency stat of a Node. type NodeLatencyStats struct { metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=objectMeta"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // The list of PeerNodeLatencyStats. PeerNodeLatencyStats []PeerNodeLatencyStats `json:"peerNodeLatencyStats,omitempty" protobuf:"bytes,2,rep,name=peerNodeLatencyStats"` @@ -174,21 +174,21 @@ type PeerNodeLatencyStats struct { type TargetIPLatencyStats struct { // The target IP address. TargetIP string `json:"targetIP,omitempty" protobuf:"bytes,1,opt,name=targetIP"` - // The timestamp of the last send packet. + // The timestamp of the last sent packet. LastSendTime metav1.Time `json:"lastSendTime,omitempty" protobuf:"bytes,2,opt,name=lastSendTime"` - // The timestamp of the last receive packet. + // The timestamp of the last received packet. LastRecvTime metav1.Time `json:"lastRecvTime,omitempty" protobuf:"bytes,3,opt,name=lastRecvTime"` - // The last valid rtt of the Node. + // The last measured RTT for this target IP, in nanoseconds. LastMeasuredRTTNanoseconds int64 `json:"lastMeasuredRTTNanoseconds,omitempty" protobuf:"varint,4,opt,name=lastMeasuredRTTNanoseconds"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// NodeLatencyStatList is a list of PeerNodeLatencyStats objects. -type NodeLatencyStatList struct { +// NodeLatencyStatsList is a list of NodeLatencyStats objects. +type NodeLatencyStatsList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // The list of PeerNodeLatencyStats. - Items []PeerNodeLatencyStats `json:"items" protobuf:"bytes,2,rep,name=items"` + // The list of NodeLatencyStats. + Items []NodeLatencyStats `json:"items" protobuf:"bytes,2,rep,name=items"` } diff --git a/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go index 706c333b16e..b239c505790 100644 --- a/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/stats/v1alpha1/zz_generated.deepcopy.go @@ -278,12 +278,12 @@ func (in *NetworkPolicyStatsList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeLatencyStatList) DeepCopyInto(out *NodeLatencyStatList) { +func (in *NodeLatencyStats) DeepCopyInto(out *NodeLatencyStats) { *out = *in out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.PeerNodeLatencyStats != nil { + in, out := &in.PeerNodeLatencyStats, &out.PeerNodeLatencyStats *out = make([]PeerNodeLatencyStats, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) @@ -292,18 +292,18 @@ func (in *NodeLatencyStatList) DeepCopyInto(out *NodeLatencyStatList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStatList. -func (in *NodeLatencyStatList) DeepCopy() *NodeLatencyStatList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStats. +func (in *NodeLatencyStats) DeepCopy() *NodeLatencyStats { if in == nil { return nil } - out := new(NodeLatencyStatList) + out := new(NodeLatencyStats) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeLatencyStatList) DeepCopyObject() runtime.Object { +func (in *NodeLatencyStats) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -311,13 +311,13 @@ func (in *NodeLatencyStatList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeLatencyStats) DeepCopyInto(out *NodeLatencyStats) { +func (in *NodeLatencyStatsList) DeepCopyInto(out *NodeLatencyStatsList) { *out = *in out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.PeerNodeLatencyStats != nil { - in, out := &in.PeerNodeLatencyStats, &out.PeerNodeLatencyStats - *out = make([]PeerNodeLatencyStats, len(*in)) + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodeLatencyStats, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -325,18 +325,18 @@ func (in *NodeLatencyStats) DeepCopyInto(out *NodeLatencyStats) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStats. -func (in *NodeLatencyStats) DeepCopy() *NodeLatencyStats { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLatencyStatsList. +func (in *NodeLatencyStatsList) DeepCopy() *NodeLatencyStatsList { if in == nil { return nil } - out := new(NodeLatencyStats) + out := new(NodeLatencyStatsList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *NodeLatencyStats) DeepCopyObject() runtime.Object { +func (in *NodeLatencyStatsList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 9190616e1ea..3d49c4c7806 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -58,7 +58,7 @@ import ( "antrea.io/antrea/pkg/apiserver/registry/stats/antreanetworkpolicystats" "antrea.io/antrea/pkg/apiserver/registry/stats/multicastgroup" "antrea.io/antrea/pkg/apiserver/registry/stats/networkpolicystats" - "antrea.io/antrea/pkg/apiserver/registry/stats/nodelatencystat" + nodelatencystat "antrea.io/antrea/pkg/apiserver/registry/stats/nodelatencystats" "antrea.io/antrea/pkg/apiserver/registry/system/controllerinfo" "antrea.io/antrea/pkg/apiserver/registry/system/supportbundle" "antrea.io/antrea/pkg/apiserver/storage" diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 985cf30b6f5..20e7e346d5c 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -163,8 +163,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "antrea.io/antrea/pkg/apis/stats/v1alpha1.MulticastGroupList": schema_pkg_apis_stats_v1alpha1_MulticastGroupList(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.NetworkPolicyStats": schema_pkg_apis_stats_v1alpha1_NetworkPolicyStats(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.NetworkPolicyStatsList": schema_pkg_apis_stats_v1alpha1_NetworkPolicyStatsList(ref), - "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStatList": schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStats": schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref), + "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStatsList": schema_pkg_apis_stats_v1alpha1_NodeLatencyStatsList(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats": schema_pkg_apis_stats_v1alpha1_PeerNodeLatencyStats(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.PodReference": schema_pkg_apis_stats_v1alpha1_PodReference(ref), "antrea.io/antrea/pkg/apis/stats/v1alpha1.RuleTrafficStats": schema_pkg_apis_stats_v1alpha1_RuleTrafficStats(ref), @@ -6677,11 +6677,11 @@ func schema_pkg_apis_stats_v1alpha1_NetworkPolicyStatsList(ref common.ReferenceC } } -func schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "NodeLatencyStatList is a list of PeerNodeLatencyStats objects.", + Description: "NodeLatencyStats contains the latency stat of a Node.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -6698,13 +6698,13 @@ func schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref common.ReferenceCall Format: "", }, }, - "ListMeta": { + "metadata": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), }, }, - "Items": { + "peerNodeLatencyStats": { SchemaProps: spec.SchemaProps{ Description: "The list of PeerNodeLatencyStats.", Type: []string{"array"}, @@ -6719,19 +6719,18 @@ func schema_pkg_apis_stats_v1alpha1_NodeLatencyStatList(ref common.ReferenceCall }, }, }, - Required: []string{"ListMeta", "Items"}, }, }, Dependencies: []string{ - "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } -func schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_stats_v1alpha1_NodeLatencyStatsList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "NodeLatencyStats contains the latency stat of a Node.", + Description: "NodeLatencyStatsList is a list of NodeLatencyStats objects.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -6751,28 +6750,29 @@ func schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref common.ReferenceCallbac "metadata": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), }, }, - "peerNodeLatencyStats": { + "items": { SchemaProps: spec.SchemaProps{ - Description: "The list of PeerNodeLatencyStats.", + Description: "The list of NodeLatencyStats.", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats"), + Ref: ref("antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStats"), }, }, }, }, }, }, + Required: []string{"items"}, }, }, Dependencies: []string{ - "antrea.io/antrea/pkg/apis/stats/v1alpha1.PeerNodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } @@ -6882,19 +6882,19 @@ func schema_pkg_apis_stats_v1alpha1_TargetIPLatencyStats(ref common.ReferenceCal }, "lastSendTime": { SchemaProps: spec.SchemaProps{ - Description: "The timestamp of the last send packet.", + Description: "The timestamp of the last sent packet.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "lastRecvTime": { SchemaProps: spec.SchemaProps{ - Description: "The timestamp of the last receive packet.", + Description: "The timestamp of the last received packet.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, "lastMeasuredRTTNanoseconds": { SchemaProps: spec.SchemaProps{ - Description: "The last valid rtt of the Node.", + Description: "The last measured RTT for this target IP, in nanoseconds.", Type: []string{"integer"}, Format: "int64", }, diff --git a/pkg/apiserver/registry/stats/nodelatencystat/rest.go b/pkg/apiserver/registry/stats/nodelatencystats/rest.go similarity index 92% rename from pkg/apiserver/registry/stats/nodelatencystat/rest.go rename to pkg/apiserver/registry/stats/nodelatencystats/rest.go index b3854914edf..81404febb64 100644 --- a/pkg/apiserver/registry/stats/nodelatencystat/rest.go +++ b/pkg/apiserver/registry/stats/nodelatencystats/rest.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package nodelatencystat +package nodelatencystats import ( "context" @@ -64,7 +64,7 @@ func (r *REST) NewList() runtime.Object { func (r *REST) List(ctx context.Context, options *internalversion.ListOptions) (runtime.Object, error) { // TODO: fill this function in next PR - return &statsv1alpha1.NodeLatencyStatList{}, nil + return &statsv1alpha1.NodeLatencyStatsList{}, nil } func (r *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { @@ -72,7 +72,7 @@ func (r *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOpti table := &metav1.Table{ ColumnDefinitions: []metav1.TableColumnDefinition{ {Name: "SourceNodeName", Type: "string", Format: "name", Description: "Source node name."}, - {Name: "NodeIPLatencyList", Type: "array", Format: "string", Description: "Node IP latency list."}, + {Name: "NodeLatencyStatsList", Type: "array", Format: "string", Description: "Node IP latency list."}, }, } @@ -84,5 +84,5 @@ func (r *REST) NamespaceScoped() bool { } func (r *REST) GetSingularName() string { - return "nodelatencystat" + return "nodelatencystats" } diff --git a/pkg/apiserver/registry/stats/nodelatencystat/rest_test.go b/pkg/apiserver/registry/stats/nodelatencystats/rest_test.go similarity index 95% rename from pkg/apiserver/registry/stats/nodelatencystat/rest_test.go rename to pkg/apiserver/registry/stats/nodelatencystats/rest_test.go index a67bc6590ba..d610d014187 100644 --- a/pkg/apiserver/registry/stats/nodelatencystat/rest_test.go +++ b/pkg/apiserver/registry/stats/nodelatencystats/rest_test.go @@ -12,4 +12,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -package nodelatencystat +package nodelatencystats From 1421db3842aae142d3db96c0d5b699b798dcbc07 Mon Sep 17 00:00:00 2001 From: Asklv Date: Wed, 12 Jun 2024 00:46:38 +0800 Subject: [PATCH 4/7] fix: update api issues. Signed-off-by: Asklv --- pkg/agent/monitortool/latency_store.go | 10 ++-- pkg/agent/monitortool/monitor.go | 7 +-- pkg/apis/stats/v1alpha1/types.go | 2 +- .../v1alpha1/fake/fake_nodelatencystats.go | 46 +++++++++++++++ .../typed/stats/v1alpha1/nodelatencystats.go | 58 +++++++++++++++++++ 5 files changed, 111 insertions(+), 12 deletions(-) diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index 3862627afde..84265bf35e8 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -253,29 +253,29 @@ func (s *LatencyStore) DeleteStaleNodeIPs() { } // ConvertList converts the latency store to a list of PeerNodeLatencyStats. -func (l *LatencyStore) ConvertList(excludedNodeName string) []statsv1alpha1.PeerNodeLatencyStats { +func (l *LatencyStore) ConvertList(currentNodeName string) []statsv1alpha1.PeerNodeLatencyStats { l.mutex.RLock() defer l.mutex.RUnlock() // PeerNodeLatencyStats should be a list of size N-1, where N is the number of Nodes in the cluster. - // We will have N-1 entries for each Node, each entry containing the latency stats for the connection, // TargetIPLatencyStats will be a list of size 1 (single-stack case) or 2 (dual-stack case). peerNodeLatencyStatsList := make([]statsv1alpha1.PeerNodeLatencyStats, 0, len(l.nodeIPLatencyMap)-1) for nodeName, nodeIPs := range l.nodeTargetIPsMap { - if nodeName == excludedNodeName { + // Even though the current Node should already be excluded from the map, we add an extra check as an additional guarantee. + if nodeName == currentNodeName { continue } targetIPLatencyStats := make([]statsv1alpha1.TargetIPLatencyStats, 0, len(nodeIPs)) for _, nodeIP := range nodeIPs { nodeIPStr := nodeIP.String() - tempEntry := statsv1alpha1.TargetIPLatencyStats{ + entry := statsv1alpha1.TargetIPLatencyStats{ TargetIP: nodeIPStr, LastSendTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastSendTime), LastRecvTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastRecvTime), LastMeasuredRTTNanoseconds: l.nodeIPLatencyMap[nodeIPStr].LastMeasuredRTT.Nanoseconds(), } - targetIPLatencyStats = append(targetIPLatencyStats, tempEntry) + targetIPLatencyStats = append(targetIPLatencyStats, entry) } peerNodeLatencyStats := statsv1alpha1.PeerNodeLatencyStats{ diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index ba5eb012da5..7fde5d3898b 100644 --- a/pkg/agent/monitortool/monitor.go +++ b/pkg/agent/monitortool/monitor.go @@ -388,18 +388,13 @@ func (m *NodeLatencyMonitor) GetSummary() *statsv1alpha1.NodeLatencyStats { func (m *NodeLatencyMonitor) report() { summary := m.GetSummary() - if summary == nil { - klog.InfoS("Latency summary is nil") - return - } antreaClient, err := m.antreaClientProvider.GetAntreaClient() if err != nil { klog.ErrorS(err, "Failed to get Antrea client") return } - _ = antreaClient if _, err := antreaClient.StatsV1alpha1().NodeLatencyStatses().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { - klog.ErrorS(err, "Failed to update NodeIPLatencyStats") + klog.ErrorS(err, "Failed to create NodeIPLatencyStats") } } diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index de5c6361d4d..b152d14474b 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -150,7 +150,7 @@ type RuleTrafficStats struct { // +genclient // +genclient:nonNamespaced // +resourceName=nodelatencystats -// +genclient:onlyVerbs=create +// +genclient:onlyVerbs=create,delete,get,list,watch // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeLatencyStats contains the latency stat of a Node. diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go index 388e21c8d18..0aa6bb2983c 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go @@ -21,6 +21,8 @@ import ( v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) @@ -33,6 +35,43 @@ var nodelatencystatsesResource = v1alpha1.SchemeGroupVersion.WithResource("nodel var nodelatencystatsesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeLatencyStats") +// Get takes name of the nodeLatencyStats, and returns the corresponding nodeLatencyStats object, and an error if there is any. +func (c *FakeNodeLatencyStatses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyStats, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(nodelatencystatsesResource, name), &v1alpha1.NodeLatencyStats{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NodeLatencyStats), err +} + +// List takes label and field selectors, and returns the list of NodeLatencyStatses that match those selectors. +func (c *FakeNodeLatencyStatses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyStatsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(nodelatencystatsesResource, nodelatencystatsesKind, opts), &v1alpha1.NodeLatencyStatsList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.NodeLatencyStatsList{ListMeta: obj.(*v1alpha1.NodeLatencyStatsList).ListMeta} + for _, item := range obj.(*v1alpha1.NodeLatencyStatsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested nodeLatencyStatses. +func (c *FakeNodeLatencyStatses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(nodelatencystatsesResource, opts)) +} + // Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. func (c *FakeNodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { obj, err := c.Fake. @@ -42,3 +81,10 @@ func (c *FakeNodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v } return obj.(*v1alpha1.NodeLatencyStats), err } + +// Delete takes name of the nodeLatencyStats and deletes it. Returns an error if one occurs. +func (c *FakeNodeLatencyStatses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(nodelatencystatsesResource, name, opts), &v1alpha1.NodeLatencyStats{}) + return err +} diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go index 21c1d216643..eb8659666a4 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go @@ -18,10 +18,12 @@ package v1alpha1 import ( "context" + "time" v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" ) @@ -34,6 +36,10 @@ type NodeLatencyStatsesGetter interface { // NodeLatencyStatsInterface has methods to work with NodeLatencyStats resources. type NodeLatencyStatsInterface interface { Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (*v1alpha1.NodeLatencyStats, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeLatencyStats, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeLatencyStatsList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) NodeLatencyStatsExpansion } @@ -49,6 +55,48 @@ func newNodeLatencyStatses(c *StatsV1alpha1Client) *nodeLatencyStatses { } } +// Get takes name of the nodeLatencyStats, and returns the corresponding nodeLatencyStats object, and an error if there is any. +func (c *nodeLatencyStatses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeLatencyStats, err error) { + result = &v1alpha1.NodeLatencyStats{} + err = c.client.Get(). + Resource("nodelatencystats"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NodeLatencyStatses that match those selectors. +func (c *nodeLatencyStatses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodeLatencyStatsList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.NodeLatencyStatsList{} + err = c.client.Get(). + Resource("nodelatencystats"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested nodeLatencyStatses. +func (c *nodeLatencyStatses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("nodelatencystats"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + // Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. func (c *nodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { result = &v1alpha1.NodeLatencyStats{} @@ -60,3 +108,13 @@ func (c *nodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alp Into(result) return } + +// Delete takes name of the nodeLatencyStats and deletes it. Returns an error if one occurs. +func (c *nodeLatencyStatses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("nodelatencystats"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} From 25bdcbcffb646a4bf14a07c7700cb984428cacbe Mon Sep 17 00:00:00 2001 From: Asklv Date: Wed, 12 Jun 2024 10:57:47 +0800 Subject: [PATCH 5/7] fix: fix unexcepted lookup. Signed-off-by: Asklv --- pkg/agent/monitortool/latency_store.go | 9 +++++---- pkg/apis/stats/v1alpha1/generated.proto | 2 +- pkg/apis/stats/v1alpha1/types.go | 2 +- pkg/apiserver/openapi/zz_generated.openapi.go | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index 84265bf35e8..b166b22d063 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -259,7 +259,7 @@ func (l *LatencyStore) ConvertList(currentNodeName string) []statsv1alpha1.PeerN // PeerNodeLatencyStats should be a list of size N-1, where N is the number of Nodes in the cluster. // TargetIPLatencyStats will be a list of size 1 (single-stack case) or 2 (dual-stack case). - peerNodeLatencyStatsList := make([]statsv1alpha1.PeerNodeLatencyStats, 0, len(l.nodeIPLatencyMap)-1) + peerNodeLatencyStatsList := make([]statsv1alpha1.PeerNodeLatencyStats, 0, len(l.nodeIPLatencyMap)) for nodeName, nodeIPs := range l.nodeTargetIPsMap { // Even though the current Node should already be excluded from the map, we add an extra check as an additional guarantee. if nodeName == currentNodeName { @@ -269,11 +269,12 @@ func (l *LatencyStore) ConvertList(currentNodeName string) []statsv1alpha1.PeerN targetIPLatencyStats := make([]statsv1alpha1.TargetIPLatencyStats, 0, len(nodeIPs)) for _, nodeIP := range nodeIPs { nodeIPStr := nodeIP.String() + latencyEntry := l.nodeIPLatencyMap[nodeIPStr] entry := statsv1alpha1.TargetIPLatencyStats{ TargetIP: nodeIPStr, - LastSendTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastSendTime), - LastRecvTime: metav1.NewTime(l.nodeIPLatencyMap[nodeIPStr].LastRecvTime), - LastMeasuredRTTNanoseconds: l.nodeIPLatencyMap[nodeIPStr].LastMeasuredRTT.Nanoseconds(), + LastSendTime: metav1.NewTime(latencyEntry.LastSendTime), + LastRecvTime: metav1.NewTime(latencyEntry.LastRecvTime), + LastMeasuredRTTNanoseconds: latencyEntry.LastMeasuredRTT.Nanoseconds(), } targetIPLatencyStats = append(targetIPLatencyStats, entry) } diff --git a/pkg/apis/stats/v1alpha1/generated.proto b/pkg/apis/stats/v1alpha1/generated.proto index 2b87ca0567c..6c6098a8569 100644 --- a/pkg/apis/stats/v1alpha1/generated.proto +++ b/pkg/apis/stats/v1alpha1/generated.proto @@ -98,7 +98,7 @@ message NetworkPolicyStatsList { repeated NetworkPolicyStats items = 2; } -// NodeLatencyStats contains the latency stat of a Node. +// NodeLatencyStats contains all the latency measurements collected by the Agent from a specific Node. message NodeLatencyStats { optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index b152d14474b..416f6070ba2 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -153,7 +153,7 @@ type RuleTrafficStats struct { // +genclient:onlyVerbs=create,delete,get,list,watch // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// NodeLatencyStats contains the latency stat of a Node. +// NodeLatencyStats contains all the latency measurements collected by the Agent from a specific Node. type NodeLatencyStats struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 20e7e346d5c..4ec7d6b2ab1 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -6681,7 +6681,7 @@ func schema_pkg_apis_stats_v1alpha1_NodeLatencyStats(ref common.ReferenceCallbac return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "NodeLatencyStats contains the latency stat of a Node.", + Description: "NodeLatencyStats contains all the latency measurements collected by the Agent from a specific Node.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { From 4eae08c381c2467af70bbb2e02f375c282db813e Mon Sep 17 00:00:00 2001 From: Asklv Date: Sat, 15 Jun 2024 11:21:44 +0800 Subject: [PATCH 6/7] fix: add delete api define and remove watch api. Signed-off-by: Asklv --- pkg/agent/monitortool/latency_store.go | 1 - pkg/agent/monitortool/monitor.go | 9 ++++----- pkg/agent/monitortool/monitor_test.go | 5 ++++- pkg/apis/stats/v1alpha1/types.go | 2 +- pkg/apiserver/apiserver.go | 4 ++-- .../registry/stats/nodelatencystats/rest.go | 5 +++++ .../stats/v1alpha1/fake/fake_nodelatencystats.go | 7 ------- .../typed/stats/v1alpha1/nodelatencystats.go | 16 ---------------- 8 files changed, 16 insertions(+), 33 deletions(-) diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index b166b22d063..eadc997d84e 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -27,7 +27,6 @@ import ( "k8s.io/klog/v2" statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" - "antrea.io/antrea/pkg/util/k8s" ) diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index 7fde5d3898b..73ce81379ab 100644 --- a/pkg/agent/monitortool/monitor.go +++ b/pkg/agent/monitortool/monitor.go @@ -32,11 +32,10 @@ import ( "k8s.io/klog/v2" "k8s.io/utils/clock" - statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" - "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" "antrea.io/antrea/pkg/apis/crd/v1alpha1" + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" crdinformers "antrea.io/antrea/pkg/client/informers/externalversions/crd/v1alpha1" ) @@ -376,8 +375,8 @@ func (m *NodeLatencyMonitor) pingAll(ipv4Socket, ipv6Socket net.PacketConn) { klog.V(4).InfoS("Done pinging all Nodes") } -// GetSummary returns the latency summary of the given Node IP. -func (m *NodeLatencyMonitor) GetSummary() *statsv1alpha1.NodeLatencyStats { +// getSummary returns the latency summary of the given Node IP. +func (m *NodeLatencyMonitor) getSummary() *statsv1alpha1.NodeLatencyStats { return &statsv1alpha1.NodeLatencyStats{ ObjectMeta: metav1.ObjectMeta{ Name: m.nodeName, @@ -387,7 +386,7 @@ func (m *NodeLatencyMonitor) GetSummary() *statsv1alpha1.NodeLatencyStats { } func (m *NodeLatencyMonitor) report() { - summary := m.GetSummary() + summary := m.getSummary() antreaClient, err := m.antreaClientProvider.GetAntreaClient() if err != nil { klog.ErrorS(err, "Failed to get Antrea client") diff --git a/pkg/agent/monitortool/monitor_test.go b/pkg/agent/monitortool/monitor_test.go index 30bfe148b47..a0276f05c34 100644 --- a/pkg/agent/monitortool/monitor_test.go +++ b/pkg/agent/monitortool/monitor_test.go @@ -33,9 +33,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" + componentbaseconfig "k8s.io/component-base/config" "k8s.io/utils/clock" clocktesting "k8s.io/utils/clock/testing" + "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" monitortesting "antrea.io/antrea/pkg/agent/monitortool/testing" "antrea.io/antrea/pkg/agent/util/nettest" @@ -160,7 +162,8 @@ func newTestMonitor( crdClientset := fakeversioned.NewSimpleClientset(crdObjects...) crdInformerFactory := crdinformers.NewSharedInformerFactory(crdClientset, 0) nlmInformer := crdInformerFactory.Crd().V1alpha1().NodeLatencyMonitors() - m := NewNodeLatencyMonitor(nodeInformer, nlmInformer, nodeConfig, trafficEncapMode) + antreaClientProvider, _ := client.NewAntreaClientProvider(componentbaseconfig.ClientConnectionConfiguration{}, clientset) + m := NewNodeLatencyMonitor(antreaClientProvider, nodeInformer, nlmInformer, nodeConfig, trafficEncapMode) fakeClock := newFakeClock(clockT) m.clock = fakeClock mockListener := monitortesting.NewMockPacketListener(ctrl) diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index 416f6070ba2..ac9eb1e3314 100644 --- a/pkg/apis/stats/v1alpha1/types.go +++ b/pkg/apis/stats/v1alpha1/types.go @@ -150,7 +150,7 @@ type RuleTrafficStats struct { // +genclient // +genclient:nonNamespaced // +resourceName=nodelatencystats -// +genclient:onlyVerbs=create,delete,get,list,watch +// +genclient:onlyVerbs=create,delete,get,list // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // NodeLatencyStats contains all the latency measurements collected by the Agent from a specific Node. diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 3d49c4c7806..c6a28165c82 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -58,7 +58,7 @@ import ( "antrea.io/antrea/pkg/apiserver/registry/stats/antreanetworkpolicystats" "antrea.io/antrea/pkg/apiserver/registry/stats/multicastgroup" "antrea.io/antrea/pkg/apiserver/registry/stats/networkpolicystats" - nodelatencystat "antrea.io/antrea/pkg/apiserver/registry/stats/nodelatencystats" + "antrea.io/antrea/pkg/apiserver/registry/stats/nodelatencystats" "antrea.io/antrea/pkg/apiserver/registry/system/controllerinfo" "antrea.io/antrea/pkg/apiserver/registry/system/supportbundle" "antrea.io/antrea/pkg/apiserver/storage" @@ -241,7 +241,7 @@ func installAPIGroup(s *APIServer, c completedConfig) error { statsStorage["antreaclusternetworkpolicystats"] = antreaclusternetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["antreanetworkpolicystats"] = antreanetworkpolicystats.NewREST(c.extraConfig.statsAggregator) statsStorage["multicastgroups"] = multicastgroup.NewREST(c.extraConfig.statsAggregator) - statsStorage["nodelatencystats"] = nodelatencystat.NewREST() + statsStorage["nodelatencystats"] = nodelatencystats.NewREST() statsGroup.VersionedResourcesStorageMap["v1alpha1"] = statsStorage groups := []*genericapiserver.APIGroupInfo{&cpGroup, &systemGroup, &statsGroup} diff --git a/pkg/apiserver/registry/stats/nodelatencystats/rest.go b/pkg/apiserver/registry/stats/nodelatencystats/rest.go index 81404febb64..189979ce8b5 100644 --- a/pkg/apiserver/registry/stats/nodelatencystats/rest.go +++ b/pkg/apiserver/registry/stats/nodelatencystats/rest.go @@ -33,6 +33,7 @@ var ( _ rest.Scoper = &REST{} _ rest.Getter = &REST{} _ rest.Lister = &REST{} + _ rest.GracefulDeleter = &REST{} _ rest.SingularNameProvider = &REST{} ) @@ -79,6 +80,10 @@ func (r *REST) ConvertToTable(ctx context.Context, obj runtime.Object, tableOpti return table, nil } +func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error) { + return &statsv1alpha1.NodeLatencyStats{}, true, nil +} + func (r *REST) NamespaceScoped() bool { return false } diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go index 0aa6bb2983c..9ce2c4d2541 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go @@ -22,7 +22,6 @@ import ( v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) @@ -66,12 +65,6 @@ func (c *FakeNodeLatencyStatses) List(ctx context.Context, opts v1.ListOptions) return list, err } -// Watch returns a watch.Interface that watches the requested nodeLatencyStatses. -func (c *FakeNodeLatencyStatses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(nodelatencystatsesResource, opts)) -} - // Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. func (c *FakeNodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { obj, err := c.Fake. diff --git a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go index eb8659666a4..6cc3b3eb6e6 100644 --- a/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go @@ -23,7 +23,6 @@ import ( v1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - watch "k8s.io/apimachinery/pkg/watch" rest "k8s.io/client-go/rest" ) @@ -39,7 +38,6 @@ type NodeLatencyStatsInterface interface { Delete(ctx context.Context, name string, opts v1.DeleteOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodeLatencyStats, error) List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodeLatencyStatsList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) NodeLatencyStatsExpansion } @@ -83,20 +81,6 @@ func (c *nodeLatencyStatses) List(ctx context.Context, opts v1.ListOptions) (res return } -// Watch returns a watch.Interface that watches the requested nodeLatencyStatses. -func (c *nodeLatencyStatses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("nodelatencystats"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - // Create takes the representation of a nodeLatencyStats and creates it. Returns the server's representation of the nodeLatencyStats, and an error, if there is any. func (c *nodeLatencyStatses) Create(ctx context.Context, nodeLatencyStats *v1alpha1.NodeLatencyStats, opts v1.CreateOptions) (result *v1alpha1.NodeLatencyStats, err error) { result = &v1alpha1.NodeLatencyStats{} From 101d7bbf58e40b7940cfe1575d55d9bfdc76358c Mon Sep 17 00:00:00 2001 From: Asklv Date: Sun, 16 Jun 2024 00:59:19 +0800 Subject: [PATCH 7/7] chore: add fake antrea client. Signed-off-by: Asklv --- pkg/agent/monitortool/latency_store.go | 5 ++++- pkg/agent/monitortool/monitor_test.go | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/agent/monitortool/latency_store.go b/pkg/agent/monitortool/latency_store.go index eadc997d84e..b622c1368d2 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -268,7 +268,10 @@ func (l *LatencyStore) ConvertList(currentNodeName string) []statsv1alpha1.PeerN targetIPLatencyStats := make([]statsv1alpha1.TargetIPLatencyStats, 0, len(nodeIPs)) for _, nodeIP := range nodeIPs { nodeIPStr := nodeIP.String() - latencyEntry := l.nodeIPLatencyMap[nodeIPStr] + latencyEntry, ok := l.nodeIPLatencyMap[nodeIPStr] + if !ok { + continue + } entry := statsv1alpha1.TargetIPLatencyStats{ TargetIP: nodeIPStr, LastSendTime: metav1.NewTime(latencyEntry.LastSendTime), diff --git a/pkg/agent/monitortool/monitor_test.go b/pkg/agent/monitortool/monitor_test.go index a0276f05c34..6292834f59f 100644 --- a/pkg/agent/monitortool/monitor_test.go +++ b/pkg/agent/monitortool/monitor_test.go @@ -33,15 +33,14 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" - componentbaseconfig "k8s.io/component-base/config" "k8s.io/utils/clock" clocktesting "k8s.io/utils/clock/testing" - "antrea.io/antrea/pkg/agent/client" "antrea.io/antrea/pkg/agent/config" monitortesting "antrea.io/antrea/pkg/agent/monitortool/testing" "antrea.io/antrea/pkg/agent/util/nettest" crdv1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1" + "antrea.io/antrea/pkg/client/clientset/versioned" fakeversioned "antrea.io/antrea/pkg/client/clientset/versioned/fake" crdinformers "antrea.io/antrea/pkg/client/informers/externalversions" "antrea.io/antrea/pkg/util/ip" @@ -136,6 +135,14 @@ func (c *fakeClock) NewTicker(d time.Duration) clock.Ticker { return c.FakeClock.NewTicker(d) } +type antreaClientGetter struct { + clientset versioned.Interface +} + +func (g *antreaClientGetter) GetAntreaClient() (versioned.Interface, error) { + return g.clientset, nil +} + type testMonitor struct { *NodeLatencyMonitor clientset *fake.Clientset @@ -162,7 +169,7 @@ func newTestMonitor( crdClientset := fakeversioned.NewSimpleClientset(crdObjects...) crdInformerFactory := crdinformers.NewSharedInformerFactory(crdClientset, 0) nlmInformer := crdInformerFactory.Crd().V1alpha1().NodeLatencyMonitors() - antreaClientProvider, _ := client.NewAntreaClientProvider(componentbaseconfig.ClientConnectionConfiguration{}, clientset) + antreaClientProvider := &antreaClientGetter{fakeversioned.NewSimpleClientset(crdObjects...)} m := NewNodeLatencyMonitor(antreaClientProvider, nodeInformer, nlmInformer, nodeConfig, trafficEncapMode) fakeClock := newFakeClock(clockT) m.clock = fakeClock