diff --git a/build/charts/antrea/templates/agent/clusterrole.yaml b/build/charts/antrea/templates/agent/clusterrole.yaml index 25bce70e3d5..ef1c43e40e8 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: + - nodelatencystats + verbs: + - create - apiGroups: - "" resources: diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index 9655b66b5da..614642ea2bb 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: diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index d60cc445413..48f9f6e25f3 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: diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index 8fb55a482f9..890815f6963 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: diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index c843452c63c..1e8c2e8ca34 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: diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 60e8df147d4..68f2d18cd52 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: 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..b622c1368d2 100644 --- a/pkg/agent/monitortool/latency_store.go +++ b/pkg/agent/monitortool/latency_store.go @@ -22,9 +22,11 @@ import ( "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" + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" "antrea.io/antrea/pkg/util/k8s" ) @@ -248,3 +250,43 @@ func (s *LatencyStore) DeleteStaleNodeIPs() { } } } + +// ConvertList converts the latency store to a list of 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. + // TargetIPLatencyStats will be a list of size 1 (single-stack case) or 2 (dual-stack case). + 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 { + continue + } + + targetIPLatencyStats := make([]statsv1alpha1.TargetIPLatencyStats, 0, len(nodeIPs)) + for _, nodeIP := range nodeIPs { + nodeIPStr := nodeIP.String() + latencyEntry, ok := l.nodeIPLatencyMap[nodeIPStr] + if !ok { + continue + } + entry := statsv1alpha1.TargetIPLatencyStats{ + TargetIP: nodeIPStr, + LastSendTime: metav1.NewTime(latencyEntry.LastSendTime), + LastRecvTime: metav1.NewTime(latencyEntry.LastRecvTime), + LastMeasuredRTTNanoseconds: latencyEntry.LastMeasuredRTT.Nanoseconds(), + } + targetIPLatencyStats = append(targetIPLatencyStats, entry) + } + + peerNodeLatencyStats := statsv1alpha1.PeerNodeLatencyStats{ + NodeName: nodeName, + TargetIPLatencyStats: targetIPLatencyStats, + } + peerNodeLatencyStatsList = append(peerNodeLatencyStatsList, peerNodeLatencyStats) + } + + return peerNodeLatencyStatsList +} diff --git a/pkg/agent/monitortool/monitor.go b/pkg/agent/monitortool/monitor.go index c840c571643..73ce81379ab 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" @@ -25,13 +26,16 @@ import ( "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" + statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1" crdinformers "antrea.io/antrea/pkg/client/informers/externalversions/crd/v1alpha1" ) @@ -66,6 +70,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 +94,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 +103,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, @@ -176,7 +184,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) } @@ -367,6 +375,28 @@ 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 { + return &statsv1alpha1.NodeLatencyStats{ + ObjectMeta: metav1.ObjectMeta{ + Name: m.nodeName, + }, + PeerNodeLatencyStats: m.latencyStore.ConvertList(m.nodeName), + } +} + +func (m *NodeLatencyMonitor) report() { + summary := m.getSummary() + antreaClient, err := m.antreaClientProvider.GetAntreaClient() + if err != nil { + klog.ErrorS(err, "Failed to get Antrea client") + return + } + if _, err := antreaClient.StatsV1alpha1().NodeLatencyStatses().Create(context.TODO(), summary, metav1.CreateOptions{}); err != nil { + klog.ErrorS(err, "Failed to create NodeIPLatencyStats") + } +} + // Run starts the NodeLatencyMonitor. func (m *NodeLatencyMonitor) Run(stopCh <-chan struct{}) { if !cache.WaitForNamedCacheSync("NodeLatencyMonitor", stopCh, m.nodeInformerSynced, m.nlmInformerSynced) { @@ -418,6 +448,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/agent/monitortool/monitor_test.go b/pkg/agent/monitortool/monitor_test.go index 30bfe148b47..6292834f59f 100644 --- a/pkg/agent/monitortool/monitor_test.go +++ b/pkg/agent/monitortool/monitor_test.go @@ -40,6 +40,7 @@ import ( 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" @@ -134,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 @@ -160,7 +169,8 @@ func newTestMonitor( crdClientset := fakeversioned.NewSimpleClientset(crdObjects...) crdInformerFactory := crdinformers.NewSharedInformerFactory(crdClientset, 0) nlmInformer := crdInformerFactory.Crd().V1alpha1().NodeLatencyMonitors() - m := NewNodeLatencyMonitor(nodeInformer, nlmInformer, nodeConfig, trafficEncapMode) + antreaClientProvider := &antreaClientGetter{fakeversioned.NewSimpleClientset(crdObjects...)} + m := NewNodeLatencyMonitor(antreaClientProvider, nodeInformer, nlmInformer, nodeConfig, trafficEncapMode) fakeClock := newFakeClock(clockT) m.clock = fakeClock mockListener := monitortesting.NewMockPacketListener(ctrl) diff --git a/pkg/apis/stats/v1alpha1/generated.pb.go b/pkg/apis/stats/v1alpha1/generated.pb.go index 97c8feb6c68..0296fae153e 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 *NodeLatencyStats) Reset() { *m = NodeLatencyStats{} } +func (*NodeLatencyStats) ProtoMessage() {} +func (*NodeLatencyStats) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{8} +} +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 *NodeLatencyStatsList) Reset() { *m = NodeLatencyStatsList{} } +func (*NodeLatencyStatsList) ProtoMessage() {} +func (*NodeLatencyStatsList) Descriptor() ([]byte, []int) { + return fileDescriptor_91b517c6fa558473, []int{9} +} +func (m *NodeLatencyStatsList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeLatencyStatsList) 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 *NodeLatencyStatsList) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLatencyStatsList.Merge(m, src) +} +func (m *NodeLatencyStatsList) XXX_Size() int { + return m.Size() +} +func (m *NodeLatencyStatsList) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLatencyStatsList.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeLatencyStatsList 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((*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") + 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,64 @@ 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, 0x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x4a, 0x1a, 0x9e, 0x65, - 0xe7, 0xbf, 0xb4, 0xca, 0x7c, 0x2b, 0x31, 0x93, 0x91, 0x5f, 0xbf, 0x30, 0xed, 0x7d, 0xc5, 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, + // 906 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, 0xac, 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, 0x2d, 0x13, 0xfb, 0xd5, 0x35, 0x89, 0x3d, 0x96, 0x67, 0x5c, 0xd4, 0xdb, 0xde, 0xb8, + 0x70, 0xd8, 0xbf, 0x82, 0xbf, 0xa5, 0xc7, 0xe5, 0x80, 0x58, 0x2e, 0x2b, 0x1a, 0x84, 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 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) { @@ -811,6 +940,142 @@ func (m *NetworkPolicyStatsList) MarshalToSizedBuffer(dAtA []byte) (int, error) 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 *NodeLatencyStatsList) 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 *NodeLatencyStatsList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeLatencyStatsList) 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 *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 +1147,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 +1379,112 @@ func (m *NetworkPolicyStatsList) Size() (n int) { return n } -func (m *PodReference) 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 = len(m.Namespace) + 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 *RuleTrafficStats) Size() (n int) { +func (m *NodeLatencyStatsList) 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.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 *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 +1616,54 @@ func (this *NetworkPolicyStatsList) String() string { }, "") 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 *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" + } + 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 +1686,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" @@ -1275,7 +1719,541 @@ func valueToStringGenerated(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { +func (m *AntreaClusterNetworkPolicyStats) 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: AntreaClusterNetworkPolicyStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaClusterNetworkPolicyStats: 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 *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 { @@ -1298,10 +2276,10 @@ func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AntreaClusterNetworkPolicyStats: wiretype end group for non-group") + return fmt.Errorf("proto: MulticastGroup: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AntreaClusterNetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MulticastGroup: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1339,9 +2317,9 @@ func (m *AntreaClusterNetworkPolicyStats) Unmarshal(dAtA []byte) error { 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 Group", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1351,28 +2329,27 @@ func (m *AntreaClusterNetworkPolicyStats) 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.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 +2376,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 +2402,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 +2425,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 +2493,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 +2519,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 +2542,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 +2614,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 +2635,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 +2658,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 +2726,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 +2752,7 @@ func (m *AntreaNetworkPolicyStatsList) Unmarshal(dAtA []byte) error { } return nil } -func (m *MulticastGroup) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStats) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1832,10 +2775,10 @@ 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: NodeLatencyStats: 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: NodeLatencyStats: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1873,39 +2816,7 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { 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 PeerNodeLatencyStats", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1932,8 +2843,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.PeerNodeLatencyStats = append(m.PeerNodeLatencyStats, PeerNodeLatencyStats{}) + if err := m.PeerNodeLatencyStats[len(m.PeerNodeLatencyStats)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1958,7 +2869,7 @@ func (m *MulticastGroup) Unmarshal(dAtA []byte) error { } return nil } -func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { +func (m *NodeLatencyStatsList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1981,10 +2892,10 @@ 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: NodeLatencyStatsList: 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: NodeLatencyStatsList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2049,7 +2960,7 @@ func (m *MulticastGroupList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, MulticastGroup{}) + m.Items = append(m.Items, NodeLatencyStats{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2075,7 +2986,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 +3009,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 +3029,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 +3076,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 +3102,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 +3125,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 +3145,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 +3177,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 +3216,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 +3239,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 +3279,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 +3291,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 +3331,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 +3354,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 +3390,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 +3421,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..6c6098a8569 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; } +// 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; + + // 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. + 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 sent packet. + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSendTime = 2; + + // The timestamp of the last received packet. + optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastRecvTime = 3; + + // The last measured RTT for this target IP, in nanoseconds. + 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..5dac9a121ec 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{}, + &NodeLatencyStatsList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/stats/v1alpha1/types.go b/pkg/apis/stats/v1alpha1/types.go index c36f63a8a26..ac9eb1e3314 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,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. +type NodeLatencyStats struct { + metav1.TypeMeta `json:",inline"` + 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"` +} + +// 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 sent packet. + LastSendTime metav1.Time `json:"lastSendTime,omitempty" protobuf:"bytes,2,opt,name=lastSendTime"` + // The timestamp of the last received packet. + LastRecvTime metav1.Time `json:"lastRecvTime,omitempty" protobuf:"bytes,3,opt,name=lastRecvTime"` + // 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 + +// 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 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 d1c3417a338..b239c505790 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 *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 *NodeLatencyStatsList) DeepCopyInto(out *NodeLatencyStatsList) { + *out = *in + out.TypeMeta = in.TypeMeta + 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]) + } + } + return +} + +// 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(NodeLatencyStatsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeLatencyStatsList) 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..c6a28165c82 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/nodelatencystats" "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["nodelatencystats"] = nodelatencystats.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..4ec7d6b2ab1 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.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), + "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_NodeLatencyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeLatencyStats contains all the latency measurements collected by the Agent from a specific 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_NodeLatencyStatsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeLatencyStatsList is a list of NodeLatencyStats 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: "", + }, + }, + "metadata": { + 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 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.NodeLatencyStats"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "antrea.io/antrea/pkg/apis/stats/v1alpha1.NodeLatencyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +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 sent packet.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastRecvTime": { + SchemaProps: spec.SchemaProps{ + 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 measured RTT for this target IP, in nanoseconds.", + 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/nodelatencystats/rest.go b/pkg/apiserver/registry/stats/nodelatencystats/rest.go new file mode 100644 index 00000000000..189979ce8b5 --- /dev/null +++ b/pkg/apiserver/registry/stats/nodelatencystats/rest.go @@ -0,0 +1,93 @@ +// 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 nodelatencystats + +import ( + "context" + + "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 { +} + +var ( + _ rest.Storage = &REST{} + _ rest.Scoper = &REST{} + _ rest.Getter = &REST{} + _ rest.Lister = &REST{} + _ rest.GracefulDeleter = &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.NodeLatencyStats{} +} + +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.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.NodeLatencyStats{}, nil +} + +func (r *REST) NewList() runtime.Object { + 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.NodeLatencyStatsList{}, 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: "NodeLatencyStatsList", Type: "array", Format: "string", Description: "Node IP latency list."}, + }, + } + + 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 +} + +func (r *REST) GetSingularName() string { + return "nodelatencystats" +} diff --git a/pkg/apiserver/registry/stats/nodelatencystats/rest_test.go b/pkg/apiserver/registry/stats/nodelatencystats/rest_test.go new file mode 100644 index 00000000000..d610d014187 --- /dev/null +++ b/pkg/apiserver/registry/stats/nodelatencystats/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 nodelatencystats 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..9ce2c4d2541 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/fake/fake_nodelatencystats.go @@ -0,0 +1,83 @@ +// 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" + labels "k8s.io/apimachinery/pkg/labels" + 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") + +// 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 +} + +// 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 +} + +// 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/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..6cc3b3eb6e6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/stats/v1alpha1/nodelatencystats.go @@ -0,0 +1,104 @@ +// 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" + "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" + 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) + 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) + NodeLatencyStatsExpansion +} + +// nodeLatencyStatses implements NodeLatencyStatsInterface +type nodeLatencyStatses struct { + client rest.Interface +} + +// newNodeLatencyStatses returns a NodeLatencyStatses +func newNodeLatencyStatses(c *StatsV1alpha1Client) *nodeLatencyStatses { + return &nodeLatencyStatses{ + client: c.RESTClient(), + } +} + +// 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 +} + +// 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 +} + +// 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() +} 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).