From 6853a94b867af4a56a09733d67b98fc86a8d28b6 Mon Sep 17 00:00:00 2001 From: Quan Tian Date: Wed, 9 Sep 2020 15:57:48 +0800 Subject: [PATCH] Add NetworkPolicy metrics API and controlplane stats API This PR introduces a control-plane API NodeStatsSummary for stats collection and a public metrics API group including the following APIs: - NetworkPolicyMetrics - AntreaClusterNetworkPolicyMetrics - AntreaNetworkPolicyMetrics --- hack/update-codegen-dockerized.sh | 12 +- pkg/apis/controlplane/install/install.go | 2 + pkg/apis/controlplane/types.go | 23 + pkg/apis/controlplane/v1alpha1/doc.go | 23 + .../controlplane/v1alpha1/generated.pb.go | 1050 ++++++++++ .../controlplane/v1alpha1/generated.proto | 65 + pkg/apis/controlplane/v1alpha1/register.go | 50 + pkg/apis/controlplane/v1alpha1/types.go | 67 + .../v1alpha1/zz_generated.conversion.go | 146 ++ .../v1alpha1/zz_generated.deepcopy.go | 98 + .../controlplane/zz_generated.deepcopy.go | 59 + pkg/apis/metrics/doc.go | 21 + pkg/apis/metrics/install/install.go | 30 + pkg/apis/metrics/register.go | 55 + pkg/apis/metrics/types.go | 95 + pkg/apis/metrics/v1alpha1/doc.go | 22 + pkg/apis/metrics/v1alpha1/generated.pb.go | 1723 +++++++++++++++++ pkg/apis/metrics/v1alpha1/generated.proto | 87 + pkg/apis/metrics/v1alpha1/register.go | 53 + pkg/apis/metrics/v1alpha1/types.go | 105 + .../v1alpha1/zz_generated.conversion.go | 275 +++ .../metrics/v1alpha1/zz_generated.deepcopy.go | 219 +++ pkg/apis/metrics/zz_generated.deepcopy.go | 219 +++ pkg/apis/security/v1alpha1/types.go | 2 +- pkg/apiserver/openapi/zz_generated.openapi.go | 448 +++++ pkg/client/clientset/versioned/clientset.go | 28 + .../versioned/fake/clientset_generated.go | 14 + .../clientset/versioned/fake/register.go | 4 + .../clientset/versioned/scheme/register.go | 4 + .../v1alpha1/controlplane_client.go | 87 + .../typed/controlplane/v1alpha1/doc.go | 18 + .../typed/controlplane/v1alpha1/fake/doc.go | 18 + .../v1alpha1/fake/fake_controlplane_client.go | 38 + .../v1alpha1/fake/fake_nodestatssummary.go | 45 + .../v1alpha1/generated_expansion.go | 19 + .../controlplane/v1alpha1/nodestatssummary.go | 62 + .../antreaclusternetworkpolicymetrics.go | 96 + .../v1alpha1/antreanetworkpolicymetrics.go | 101 + .../versioned/typed/metrics/v1alpha1/doc.go | 18 + .../typed/metrics/v1alpha1/fake/doc.go | 18 + .../fake_antreaclusternetworkpolicymetrics.go | 74 + .../fake/fake_antreanetworkpolicymetrics.go | 78 + .../v1alpha1/fake/fake_metrics_client.go | 46 + .../fake/fake_networkpolicymetrics.go | 78 + .../metrics/v1alpha1/generated_expansion.go | 23 + .../typed/metrics/v1alpha1/metrics_client.go | 97 + .../metrics/v1alpha1/networkpolicymetrics.go | 101 + .../networkpolicy/networkpolicy_controller.go | 4 +- test/e2e/k8s_util.go | 8 +- 49 files changed, 6019 insertions(+), 9 deletions(-) create mode 100644 pkg/apis/controlplane/v1alpha1/doc.go create mode 100644 pkg/apis/controlplane/v1alpha1/generated.pb.go create mode 100644 pkg/apis/controlplane/v1alpha1/generated.proto create mode 100644 pkg/apis/controlplane/v1alpha1/register.go create mode 100644 pkg/apis/controlplane/v1alpha1/types.go create mode 100644 pkg/apis/controlplane/v1alpha1/zz_generated.conversion.go create mode 100644 pkg/apis/controlplane/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/apis/metrics/doc.go create mode 100644 pkg/apis/metrics/install/install.go create mode 100644 pkg/apis/metrics/register.go create mode 100644 pkg/apis/metrics/types.go create mode 100644 pkg/apis/metrics/v1alpha1/doc.go create mode 100644 pkg/apis/metrics/v1alpha1/generated.pb.go create mode 100644 pkg/apis/metrics/v1alpha1/generated.proto create mode 100644 pkg/apis/metrics/v1alpha1/register.go create mode 100644 pkg/apis/metrics/v1alpha1/types.go create mode 100644 pkg/apis/metrics/v1alpha1/zz_generated.conversion.go create mode 100644 pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/apis/metrics/zz_generated.deepcopy.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/controlplane_client.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_controlplane_client.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_nodestatssummary.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/controlplane/v1alpha1/nodestatssummary.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreaclusternetworkpolicymetrics.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreanetworkpolicymetrics.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreaclusternetworkpolicymetrics.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreanetworkpolicymetrics.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_metrics_client.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_networkpolicymetrics.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/metrics_client.go create mode 100644 pkg/client/clientset/versioned/typed/metrics/v1alpha1/networkpolicymetrics.go diff --git a/hack/update-codegen-dockerized.sh b/hack/update-codegen-dockerized.sh index 85b9a07640e..cdff6d37317 100755 --- a/hack/update-codegen-dockerized.sh +++ b/hack/update-codegen-dockerized.sh @@ -30,11 +30,13 @@ $GOPATH/bin/client-gen \ --clientset-name versioned \ --input-base "${ANTREA_PKG}/pkg/apis/" \ --input "clusterinformation/v1beta1" \ + --input "controlplane/v1alpha1" \ --input "controlplane/v1beta1" \ --input "system/v1beta1" \ --input "security/v1alpha1" \ --input "core/v1alpha1" \ --input "ops/v1alpha1" \ + --input "metrics/v1alpha1" \ --output-package "${ANTREA_PKG}/pkg/client/clientset" \ --go-header-file hack/boilerplate/license_header.go.txt @@ -57,23 +59,29 @@ $GOPATH/bin/informer-gen \ $GOPATH/bin/deepcopy-gen \ --input-dirs "${ANTREA_PKG}/pkg/apis/clusterinformation/v1beta1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1alpha1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/security/v1alpha1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/core/v1alpha1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/ops/v1alpha1" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/metrics" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/metrics/v1alpha1" \ -O zz_generated.deepcopy \ --go-header-file hack/boilerplate/license_header.go.txt $GOPATH/bin/conversion-gen \ - --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta1,${ANTREA_PKG}/pkg/apis/controlplane/" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1alpha1,${ANTREA_PKG}/pkg/apis/controlplane/v1beta1,${ANTREA_PKG}/pkg/apis/controlplane/" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/metrics/v1alpha1,${ANTREA_PKG}/pkg/apis/metrics/" \ -O zz_generated.conversion \ --go-header-file hack/boilerplate/license_header.go.txt $GOPATH/bin/openapi-gen \ + --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1alpha1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/clusterinformation/v1beta1" \ --input-dirs "${ANTREA_PKG}/pkg/apis/system/v1beta1" \ + --input-dirs "${ANTREA_PKG}/pkg/apis/metrics/v1alpha1" \ --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr" \ --input-dirs "k8s.io/api/core/v1" \ --output-package "${ANTREA_PKG}/pkg/apiserver/openapi" \ @@ -118,7 +126,7 @@ git checkout HEAD -- hack/boilerplate/license_header.raw.txt go mod vendor $GOPATH/bin/go-to-protobuf \ --proto-import vendor \ - --packages "${ANTREA_PKG}/pkg/apis/controlplane/v1beta1" \ + --packages "${ANTREA_PKG}/pkg/apis/metrics/v1alpha1,${ANTREA_PKG}/pkg/apis/controlplane/v1alpha1,${ANTREA_PKG}/pkg/apis/controlplane/v1beta1" \ --go-header-file hack/boilerplate/license_header.go.txt # Clean up vendor directory. rm -rf vendor diff --git a/pkg/apis/controlplane/install/install.go b/pkg/apis/controlplane/install/install.go index 7541d3c3b15..1e2b90e05b4 100644 --- a/pkg/apis/controlplane/install/install.go +++ b/pkg/apis/controlplane/install/install.go @@ -19,12 +19,14 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "github.com/vmware-tanzu/antrea/pkg/apis/controlplane" + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(controlplane.AddToScheme(scheme)) + utilruntime.Must(v1alpha1.AddToScheme(scheme)) utilruntime.Must(v1beta1.AddToScheme(scheme)) utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion)) } diff --git a/pkg/apis/controlplane/types.go b/pkg/apis/controlplane/types.go index 2a3449230e5..8cf8f924efd 100644 --- a/pkg/apis/controlplane/types.go +++ b/pkg/apis/controlplane/types.go @@ -19,6 +19,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" secv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/security/v1alpha1" ) @@ -268,3 +269,25 @@ type NetworkPolicyList struct { metav1.ListMeta Items []NetworkPolicy } + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// NodeStatsSummary contains stats produced on a Node. It's used by the antrea-agents to report stats to the antrea-controller. +type NodeStatsSummary struct { + metav1.TypeMeta + metav1.ObjectMeta + + // The TrafficStats of K8s NetworkPolicies collected from the Node. + NetworkPolicies []NetworkPolicyStats + // The TrafficStats of Antrea ClusterNetworkPolicies collected from the Node. + AntreaClusterNetworkPolicies []NetworkPolicyStats + // The TrafficStats of Antrea NetworkPolicies collected from the Node. + AntreaNetworkPolicies []NetworkPolicyStats +} + +// NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy. +type NetworkPolicyStats struct { + // The reference of the NetworkPolicy. + NetworkPolicy NetworkPolicyReference + // The stats of the NetworkPolicy. + TrafficStats metricsv1alpha1.TrafficStats +} diff --git a/pkg/apis/controlplane/v1alpha1/doc.go b/pkg/apis/controlplane/v1alpha1/doc.go new file mode 100644 index 00000000000..8bac94dff27 --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/doc.go @@ -0,0 +1,23 @@ +// Copyright 2020 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. + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:conversion-gen=github.com/vmware-tanzu/antrea/pkg/apis/controlplane +// +groupName=controlplane.antrea.tanzu.vmware.com + +// Package v1alpha1 is the v1alpha1 version of the Antrea controlplane API. + +package v1alpha1 diff --git a/pkg/apis/controlplane/v1alpha1/generated.pb.go b/pkg/apis/controlplane/v1alpha1/generated.pb.go new file mode 100644 index 00000000000..2a25a8e8b8b --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/generated.pb.go @@ -0,0 +1,1050 @@ +// Copyright 2020 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 protoc-gen-gogo. DO NOT EDIT. +// source: github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1/generated.proto + +package v1alpha1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" + + k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func (m *NetworkPolicyReference) Reset() { *m = NetworkPolicyReference{} } +func (*NetworkPolicyReference) ProtoMessage() {} +func (*NetworkPolicyReference) Descriptor() ([]byte, []int) { + return fileDescriptor_846b555039d6cceb, []int{0} +} +func (m *NetworkPolicyReference) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetworkPolicyReference) 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 *NetworkPolicyReference) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkPolicyReference.Merge(m, src) +} +func (m *NetworkPolicyReference) XXX_Size() int { + return m.Size() +} +func (m *NetworkPolicyReference) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkPolicyReference.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkPolicyReference proto.InternalMessageInfo + +func (m *NetworkPolicyStats) Reset() { *m = NetworkPolicyStats{} } +func (*NetworkPolicyStats) ProtoMessage() {} +func (*NetworkPolicyStats) Descriptor() ([]byte, []int) { + return fileDescriptor_846b555039d6cceb, []int{1} +} +func (m *NetworkPolicyStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetworkPolicyStats) 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 *NetworkPolicyStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkPolicyStats.Merge(m, src) +} +func (m *NetworkPolicyStats) XXX_Size() int { + return m.Size() +} +func (m *NetworkPolicyStats) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkPolicyStats.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkPolicyStats proto.InternalMessageInfo + +func (m *NodeStatsSummary) Reset() { *m = NodeStatsSummary{} } +func (*NodeStatsSummary) ProtoMessage() {} +func (*NodeStatsSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_846b555039d6cceb, []int{2} +} +func (m *NodeStatsSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeStatsSummary) 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 *NodeStatsSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeStatsSummary.Merge(m, src) +} +func (m *NodeStatsSummary) XXX_Size() int { + return m.Size() +} +func (m *NodeStatsSummary) XXX_DiscardUnknown() { + xxx_messageInfo_NodeStatsSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeStatsSummary proto.InternalMessageInfo + +func init() { + proto.RegisterType((*NetworkPolicyReference)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.controlplane.v1alpha1.NetworkPolicyReference") + proto.RegisterType((*NetworkPolicyStats)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.controlplane.v1alpha1.NetworkPolicyStats") + proto.RegisterType((*NodeStatsSummary)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.controlplane.v1alpha1.NodeStatsSummary") +} + +func init() { + proto.RegisterFile("github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1/generated.proto", fileDescriptor_846b555039d6cceb) +} + +var fileDescriptor_846b555039d6cceb = []byte{ + // 614 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0x3d, 0x6f, 0xd3, 0x4e, + 0x1c, 0xc7, 0x73, 0x8d, 0x87, 0xf6, 0xda, 0xaa, 0xff, 0x9e, 0xfe, 0x85, 0xa8, 0x2a, 0x4e, 0x5b, + 0x31, 0x74, 0xe9, 0xb9, 0xad, 0x00, 0xb1, 0x30, 0xd4, 0x54, 0x88, 0x0e, 0x0d, 0xe0, 0x36, 0x0b, + 0x0b, 0x5c, 0x9c, 0x5f, 0x1c, 0x93, 0xf8, 0x41, 0xe7, 0x73, 0xaa, 0x30, 0xf5, 0x25, 0x20, 0xc4, + 0x6b, 0x60, 0xe2, 0x1d, 0xf0, 0x06, 0x32, 0x76, 0xec, 0x14, 0x11, 0x23, 0xf1, 0x02, 0x18, 0x3b, + 0x21, 0x9f, 0x1d, 0x62, 0xa7, 0x49, 0xa9, 0x04, 0xdd, 0x7c, 0x77, 0xdf, 0x87, 0xcf, 0xfd, 0x7c, + 0xf8, 0xc8, 0xb2, 0x45, 0x33, 0xac, 0x51, 0xd3, 0x73, 0xb4, 0x8e, 0x73, 0xca, 0x38, 0x6c, 0x0b, + 0xe6, 0xbe, 0x0f, 0x35, 0xe6, 0x0a, 0x0e, 0x4c, 0xf3, 0x5b, 0x96, 0xc6, 0x7c, 0x3b, 0xd0, 0x4c, + 0xcf, 0x15, 0xdc, 0x6b, 0xfb, 0x6d, 0xe6, 0x82, 0xd6, 0xd9, 0x65, 0x6d, 0xbf, 0xc9, 0x76, 0x35, + 0x0b, 0x5c, 0xe0, 0x4c, 0x40, 0x9d, 0xfa, 0xdc, 0x13, 0x1e, 0x79, 0x32, 0x8a, 0xa3, 0x49, 0xdc, + 0x1b, 0x19, 0x47, 0x93, 0x38, 0xea, 0xb7, 0x2c, 0x1a, 0xc7, 0xd1, 0x6c, 0x1c, 0x1d, 0xc6, 0xad, + 0x6e, 0x67, 0x68, 0x2c, 0xcf, 0xf2, 0x34, 0x99, 0x5a, 0x0b, 0x1b, 0x72, 0x25, 0x17, 0xf2, 0x2b, + 0x69, 0x5b, 0x7d, 0x7e, 0x53, 0x78, 0x07, 0x04, 0xb7, 0xcd, 0x60, 0x2a, 0xf7, 0xea, 0x83, 0xd6, + 0xe3, 0x80, 0xda, 0x5e, 0xac, 0x76, 0x98, 0xd9, 0xb4, 0x5d, 0xe0, 0xdd, 0x9c, 0x9d, 0x69, 0x9d, + 0xab, 0x2e, 0x6d, 0x9a, 0x8b, 0x87, 0xae, 0xb0, 0x1d, 0xb8, 0x62, 0x78, 0xf4, 0x27, 0x43, 0x60, + 0x36, 0xc1, 0x61, 0xe3, 0xbe, 0xcd, 0x1f, 0x08, 0xdf, 0xa9, 0x80, 0x38, 0xf5, 0x78, 0xeb, 0xa5, + 0xd7, 0xb6, 0xcd, 0xae, 0x01, 0x0d, 0xe0, 0xe0, 0x9a, 0x40, 0x1e, 0x62, 0x45, 0x74, 0x7d, 0x28, + 0xa1, 0x75, 0xb4, 0x35, 0xa7, 0x6f, 0xf4, 0xfa, 0xe5, 0x42, 0xd4, 0x2f, 0x2b, 0x27, 0x5d, 0x1f, + 0x2e, 0xfb, 0xe5, 0xe5, 0x9c, 0x2b, 0xde, 0x34, 0xa4, 0x9c, 0x68, 0x78, 0xce, 0x65, 0x0e, 0x04, + 0x3e, 0x33, 0xa1, 0x34, 0x23, 0xbd, 0xcb, 0xa9, 0x77, 0xae, 0x32, 0x3c, 0x30, 0x46, 0x1a, 0xb2, + 0x8e, 0x95, 0x78, 0x51, 0x2a, 0x4a, 0xed, 0xc2, 0xb0, 0x27, 0xd6, 0x1a, 0xf2, 0x84, 0xe8, 0xb8, + 0x18, 0xda, 0xf5, 0x92, 0x22, 0x05, 0x3b, 0xa9, 0xa0, 0x58, 0x3d, 0x3c, 0xb8, 0xec, 0x97, 0x37, + 0xa6, 0x5d, 0x3c, 0x86, 0x09, 0x68, 0xf5, 0xf0, 0xc0, 0x88, 0xcd, 0x9b, 0x5f, 0x66, 0x30, 0xc9, + 0x21, 0x1f, 0x0b, 0x26, 0x02, 0xf2, 0x11, 0xe1, 0x45, 0x37, 0xbb, 0x2d, 0xaf, 0x3b, 0xbf, 0x57, + 0xa5, 0x7f, 0xf5, 0xde, 0xe8, 0xe4, 0x99, 0xea, 0x2b, 0x29, 0xfc, 0x62, 0xfe, 0x3c, 0x8f, 0x40, + 0xce, 0x10, 0x5e, 0x10, 0x9c, 0x35, 0x1a, 0xb6, 0x29, 0x29, 0xe5, 0x18, 0xe7, 0xf7, 0x9e, 0xdd, + 0x98, 0x29, 0x7d, 0x95, 0x23, 0x9c, 0x93, 0x4c, 0x9a, 0xfe, 0x7f, 0x0a, 0xb1, 0x90, 0xdd, 0x35, + 0x72, 0x8d, 0x9b, 0x3f, 0x15, 0xfc, 0x5f, 0xc5, 0xab, 0x83, 0x5c, 0x1d, 0x87, 0x8e, 0xc3, 0x78, + 0x97, 0xbc, 0xc5, 0xb3, 0xf1, 0x83, 0xad, 0x33, 0xc1, 0xd2, 0x31, 0xed, 0xd0, 0x64, 0xfc, 0x34, + 0x3b, 0xfe, 0x1c, 0x07, 0xa3, 0x9d, 0x5d, 0xfa, 0xa2, 0xf6, 0x0e, 0x4c, 0x71, 0x04, 0x82, 0xe9, + 0x24, 0x2d, 0xc7, 0xa3, 0x3d, 0xe3, 0x77, 0x2a, 0xf9, 0x84, 0xf0, 0x52, 0x76, 0x16, 0x36, 0xc4, + 0x97, 0x2f, 0x6e, 0xcd, 0xef, 0xbd, 0xfa, 0x97, 0x3f, 0x24, 0x99, 0xc3, 0xdd, 0x14, 0x65, 0xa9, + 0x92, 0x6f, 0x34, 0xc6, 0x11, 0xc8, 0x57, 0x84, 0xd7, 0x92, 0x9a, 0xa7, 0xed, 0x30, 0x10, 0xc0, + 0xc7, 0x1c, 0xa5, 0xe2, 0x6d, 0x31, 0xde, 0x4f, 0x19, 0xd7, 0xf6, 0xaf, 0xa9, 0x37, 0xae, 0x85, + 0x23, 0x9f, 0x11, 0x5e, 0x49, 0x04, 0xe3, 0xd8, 0xca, 0x6d, 0x61, 0xdf, 0x4b, 0xb1, 0x57, 0xf6, + 0x27, 0xf5, 0x1a, 0x93, 0x71, 0x74, 0xda, 0x1b, 0xa8, 0x85, 0xf3, 0x81, 0x5a, 0xb8, 0x18, 0xa8, + 0x85, 0xb3, 0x48, 0x45, 0xbd, 0x48, 0x45, 0xe7, 0x91, 0x8a, 0x2e, 0x22, 0x15, 0x7d, 0x8b, 0x54, + 0xf4, 0xe1, 0xbb, 0x5a, 0x78, 0x3d, 0x3b, 0x2c, 0xfe, 0x15, 0x00, 0x00, 0xff, 0xff, 0x81, 0xac, + 0xf6, 0x8f, 0x63, 0x06, 0x00, 0x00, +} + +func (m *NetworkPolicyReference) 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 *NetworkPolicyReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetworkPolicyReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.UID) + copy(dAtA[i:], m.UID) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.UID))) + i-- + dAtA[i] = 0x22 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *NetworkPolicyStats) 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 *NetworkPolicyStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetworkPolicyStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TrafficStats.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.NetworkPolicy.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 *NodeStatsSummary) 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 *NodeStatsSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeStatsSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AntreaNetworkPolicies) > 0 { + for iNdEx := len(m.AntreaNetworkPolicies) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AntreaNetworkPolicies[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.AntreaClusterNetworkPolicies) > 0 { + for iNdEx := len(m.AntreaClusterNetworkPolicies) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AntreaClusterNetworkPolicies[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.NetworkPolicies) > 0 { + for iNdEx := len(m.NetworkPolicies) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NetworkPolicies[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 encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NetworkPolicyReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.UID) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *NetworkPolicyStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NetworkPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.TrafficStats.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *NodeStatsSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.NetworkPolicies) > 0 { + for _, e := range m.NetworkPolicies { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.AntreaClusterNetworkPolicies) > 0 { + for _, e := range m.AntreaClusterNetworkPolicies { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.AntreaNetworkPolicies) > 0 { + for _, e := range m.AntreaNetworkPolicies { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *NetworkPolicyReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NetworkPolicyReference{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `UID:` + fmt.Sprintf("%v", this.UID) + `,`, + `}`, + }, "") + return s +} +func (this *NetworkPolicyStats) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NetworkPolicyStats{`, + `NetworkPolicy:` + strings.Replace(strings.Replace(this.NetworkPolicy.String(), "NetworkPolicyReference", "NetworkPolicyReference", 1), `&`, ``, 1) + `,`, + `TrafficStats:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.TrafficStats), "TrafficStats", "v1alpha1.TrafficStats", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *NodeStatsSummary) String() string { + if this == nil { + return "nil" + } + repeatedStringForNetworkPolicies := "[]NetworkPolicyStats{" + for _, f := range this.NetworkPolicies { + repeatedStringForNetworkPolicies += strings.Replace(strings.Replace(f.String(), "NetworkPolicyStats", "NetworkPolicyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForNetworkPolicies += "}" + repeatedStringForAntreaClusterNetworkPolicies := "[]NetworkPolicyStats{" + for _, f := range this.AntreaClusterNetworkPolicies { + repeatedStringForAntreaClusterNetworkPolicies += strings.Replace(strings.Replace(f.String(), "NetworkPolicyStats", "NetworkPolicyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForAntreaClusterNetworkPolicies += "}" + repeatedStringForAntreaNetworkPolicies := "[]NetworkPolicyStats{" + for _, f := range this.AntreaNetworkPolicies { + repeatedStringForAntreaNetworkPolicies += strings.Replace(strings.Replace(f.String(), "NetworkPolicyStats", "NetworkPolicyStats", 1), `&`, ``, 1) + "," + } + repeatedStringForAntreaNetworkPolicies += "}" + s := strings.Join([]string{`&NodeStatsSummary{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `NetworkPolicies:` + repeatedStringForNetworkPolicies + `,`, + `AntreaClusterNetworkPolicies:` + repeatedStringForAntreaClusterNetworkPolicies + `,`, + `AntreaNetworkPolicies:` + repeatedStringForAntreaNetworkPolicies + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *NetworkPolicyReference) 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: NetworkPolicyReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkPolicyReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", 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.Type = NetworkPolicyType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", 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.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UID", 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.UID = k8s_io_apimachinery_pkg_types.UID(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetworkPolicyStats) 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: NetworkPolicyStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkPolicyStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkPolicy", 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.NetworkPolicy.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 + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeStatsSummary) 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: NodeStatsSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeStatsSummary: 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 NetworkPolicies", 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.NetworkPolicies = append(m.NetworkPolicies, NetworkPolicyStats{}) + if err := m.NetworkPolicies[len(m.NetworkPolicies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AntreaClusterNetworkPolicies", 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.AntreaClusterNetworkPolicies = append(m.AntreaClusterNetworkPolicies, NetworkPolicyStats{}) + if err := m.AntreaClusterNetworkPolicies[len(m.AntreaClusterNetworkPolicies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AntreaNetworkPolicies", 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.AntreaNetworkPolicies = append(m.AntreaNetworkPolicies, NetworkPolicyStats{}) + if err := m.AntreaNetworkPolicies[len(m.AntreaNetworkPolicies)-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 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/pkg/apis/controlplane/v1alpha1/generated.proto b/pkg/apis/controlplane/v1alpha1/generated.proto new file mode 100644 index 00000000000..7cec443cccc --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/generated.proto @@ -0,0 +1,65 @@ +// Copyright 2020 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. + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = 'proto2'; + +package github.com.vmware_tanzu.antrea.pkg.apis.controlplane.v1alpha1; + +import "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1/generated.proto"; +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "v1alpha1"; + +message NetworkPolicyReference { + // Type of the NetworkPolicy. + optional string type = 1; + + // Namespace of the NetworkPolicy. It's empty for ClusterNetworkPolicy. + optional string namespace = 2; + + // Name of the NetworkPolicy. + optional string name = 3; + + // UID of the NetworkPolicy. + optional string uid = 4; +} + +// NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy. +message NetworkPolicyStats { + // The reference of the NetworkPolicy. + optional NetworkPolicyReference networkPolicy = 1; + + // The stats of the NetworkPolicy. + optional github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.TrafficStats trafficStats = 2; +} + +// NodeStatsSummary contains stats produced on a Node. It's used by the antrea-agents to report stats to the antrea-controller. +message NodeStatsSummary { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // The TrafficStats of K8s NetworkPolicies collected from the Node. + repeated NetworkPolicyStats networkPolicies = 2; + + // The TrafficStats of Antrea ClusterNetworkPolicies collected from the Node. + repeated NetworkPolicyStats antreaClusterNetworkPolicies = 3; + + // The TrafficStats of Antrea NetworkPolicies collected from the Node. + repeated NetworkPolicyStats antreaNetworkPolicies = 4; +} + diff --git a/pkg/apis/controlplane/v1alpha1/register.go b/pkg/apis/controlplane/v1alpha1/register.go new file mode 100644 index 00000000000..eea7348e356 --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/register.go @@ -0,0 +1,50 @@ +// Copyright 2019 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name used in this package. +const GroupName = "controlplane.antrea.tanzu.vmware.com" + +var ( + // SchemeGroupVersion is group version used to register these objects. + SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &NodeStatsSummary{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/controlplane/v1alpha1/types.go b/pkg/apis/controlplane/v1alpha1/types.go new file mode 100644 index 00000000000..4a4b3d201ed --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/types.go @@ -0,0 +1,67 @@ +// Copyright 2020 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" +) + +// +genclient +// +genclient:nonNamespaced +// +genclient:onlyVerbs=create +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NodeStatsSummary contains stats produced on a Node. It's used by the antrea-agents to report stats to the antrea-controller. +type NodeStatsSummary struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // The TrafficStats of K8s NetworkPolicies collected from the Node. + NetworkPolicies []NetworkPolicyStats `json:"networkPolicies,omitempty" protobuf:"bytes,2,rep,name=networkPolicies"` + // The TrafficStats of Antrea ClusterNetworkPolicies collected from the Node. + AntreaClusterNetworkPolicies []NetworkPolicyStats `json:"antreaClusterNetworkPolicies,omitempty" protobuf:"bytes,3,rep,name=antreaClusterNetworkPolicies"` + // The TrafficStats of Antrea NetworkPolicies collected from the Node. + AntreaNetworkPolicies []NetworkPolicyStats `json:"antreaNetworkPolicies,omitempty" protobuf:"bytes,4,rep,name=antreaNetworkPolicies"` +} + +type NetworkPolicyType string + +const ( + K8sNetworkPolicy NetworkPolicyType = "K8sNetworkPolicy" + AntreaClusterNetworkPolicy NetworkPolicyType = "AntreaClusterNetworkPolicy" + AntreaNetworkPolicy NetworkPolicyType = "AntreaNetworkPolicy" +) + +type NetworkPolicyReference struct { + // Type of the NetworkPolicy. + Type NetworkPolicyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=NetworkPolicyType"` + // Namespace of the NetworkPolicy. It's empty for ClusterNetworkPolicy. + Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"` + // Name of the NetworkPolicy. + Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` + // UID of the NetworkPolicy. + UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` +} + +// NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy. +type NetworkPolicyStats struct { + // The reference of the NetworkPolicy. + NetworkPolicy NetworkPolicyReference `json:"networkPolicy,omitempty" protobuf:"bytes,1,opt,name=networkPolicy"` + // The stats of the NetworkPolicy. + TrafficStats metricsv1alpha1.TrafficStats `json:"trafficStats,omitempty" protobuf:"bytes,2,opt,name=trafficStats"` +} diff --git a/pkg/apis/controlplane/v1alpha1/zz_generated.conversion.go b/pkg/apis/controlplane/v1alpha1/zz_generated.conversion.go new file mode 100644 index 00000000000..a524db8bd9c --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,146 @@ +// +build !ignore_autogenerated + +// Copyright 2020 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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + controlplane "github.com/vmware-tanzu/antrea/pkg/apis/controlplane" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*NetworkPolicyReference)(nil), (*controlplane.NetworkPolicyReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference(a.(*NetworkPolicyReference), b.(*controlplane.NetworkPolicyReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*controlplane.NetworkPolicyReference)(nil), (*NetworkPolicyReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference(a.(*controlplane.NetworkPolicyReference), b.(*NetworkPolicyReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkPolicyStats)(nil), (*controlplane.NetworkPolicyStats)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NetworkPolicyStats_To_controlplane_NetworkPolicyStats(a.(*NetworkPolicyStats), b.(*controlplane.NetworkPolicyStats), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*controlplane.NetworkPolicyStats)(nil), (*NetworkPolicyStats)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_controlplane_NetworkPolicyStats_To_v1alpha1_NetworkPolicyStats(a.(*controlplane.NetworkPolicyStats), b.(*NetworkPolicyStats), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NodeStatsSummary)(nil), (*controlplane.NodeStatsSummary)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NodeStatsSummary_To_controlplane_NodeStatsSummary(a.(*NodeStatsSummary), b.(*controlplane.NodeStatsSummary), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*controlplane.NodeStatsSummary)(nil), (*NodeStatsSummary)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_controlplane_NodeStatsSummary_To_v1alpha1_NodeStatsSummary(a.(*controlplane.NodeStatsSummary), b.(*NodeStatsSummary), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference(in *NetworkPolicyReference, out *controlplane.NetworkPolicyReference, s conversion.Scope) error { + out.Type = controlplane.NetworkPolicyType(in.Type) + out.Namespace = in.Namespace + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference is an autogenerated conversion function. +func Convert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference(in *NetworkPolicyReference, out *controlplane.NetworkPolicyReference, s conversion.Scope) error { + return autoConvert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference(in, out, s) +} + +func autoConvert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference(in *controlplane.NetworkPolicyReference, out *NetworkPolicyReference, s conversion.Scope) error { + out.Type = NetworkPolicyType(in.Type) + out.Namespace = in.Namespace + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference is an autogenerated conversion function. +func Convert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference(in *controlplane.NetworkPolicyReference, out *NetworkPolicyReference, s conversion.Scope) error { + return autoConvert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference(in, out, s) +} + +func autoConvert_v1alpha1_NetworkPolicyStats_To_controlplane_NetworkPolicyStats(in *NetworkPolicyStats, out *controlplane.NetworkPolicyStats, s conversion.Scope) error { + if err := Convert_v1alpha1_NetworkPolicyReference_To_controlplane_NetworkPolicyReference(&in.NetworkPolicy, &out.NetworkPolicy, s); err != nil { + return err + } + out.TrafficStats = in.TrafficStats + return nil +} + +// Convert_v1alpha1_NetworkPolicyStats_To_controlplane_NetworkPolicyStats is an autogenerated conversion function. +func Convert_v1alpha1_NetworkPolicyStats_To_controlplane_NetworkPolicyStats(in *NetworkPolicyStats, out *controlplane.NetworkPolicyStats, s conversion.Scope) error { + return autoConvert_v1alpha1_NetworkPolicyStats_To_controlplane_NetworkPolicyStats(in, out, s) +} + +func autoConvert_controlplane_NetworkPolicyStats_To_v1alpha1_NetworkPolicyStats(in *controlplane.NetworkPolicyStats, out *NetworkPolicyStats, s conversion.Scope) error { + if err := Convert_controlplane_NetworkPolicyReference_To_v1alpha1_NetworkPolicyReference(&in.NetworkPolicy, &out.NetworkPolicy, s); err != nil { + return err + } + out.TrafficStats = in.TrafficStats + return nil +} + +// Convert_controlplane_NetworkPolicyStats_To_v1alpha1_NetworkPolicyStats is an autogenerated conversion function. +func Convert_controlplane_NetworkPolicyStats_To_v1alpha1_NetworkPolicyStats(in *controlplane.NetworkPolicyStats, out *NetworkPolicyStats, s conversion.Scope) error { + return autoConvert_controlplane_NetworkPolicyStats_To_v1alpha1_NetworkPolicyStats(in, out, s) +} + +func autoConvert_v1alpha1_NodeStatsSummary_To_controlplane_NodeStatsSummary(in *NodeStatsSummary, out *controlplane.NodeStatsSummary, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.NetworkPolicies = *(*[]controlplane.NetworkPolicyStats)(unsafe.Pointer(&in.NetworkPolicies)) + out.AntreaClusterNetworkPolicies = *(*[]controlplane.NetworkPolicyStats)(unsafe.Pointer(&in.AntreaClusterNetworkPolicies)) + out.AntreaNetworkPolicies = *(*[]controlplane.NetworkPolicyStats)(unsafe.Pointer(&in.AntreaNetworkPolicies)) + return nil +} + +// Convert_v1alpha1_NodeStatsSummary_To_controlplane_NodeStatsSummary is an autogenerated conversion function. +func Convert_v1alpha1_NodeStatsSummary_To_controlplane_NodeStatsSummary(in *NodeStatsSummary, out *controlplane.NodeStatsSummary, s conversion.Scope) error { + return autoConvert_v1alpha1_NodeStatsSummary_To_controlplane_NodeStatsSummary(in, out, s) +} + +func autoConvert_controlplane_NodeStatsSummary_To_v1alpha1_NodeStatsSummary(in *controlplane.NodeStatsSummary, out *NodeStatsSummary, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.NetworkPolicies = *(*[]NetworkPolicyStats)(unsafe.Pointer(&in.NetworkPolicies)) + out.AntreaClusterNetworkPolicies = *(*[]NetworkPolicyStats)(unsafe.Pointer(&in.AntreaClusterNetworkPolicies)) + out.AntreaNetworkPolicies = *(*[]NetworkPolicyStats)(unsafe.Pointer(&in.AntreaNetworkPolicies)) + return nil +} + +// Convert_controlplane_NodeStatsSummary_To_v1alpha1_NodeStatsSummary is an autogenerated conversion function. +func Convert_controlplane_NodeStatsSummary_To_v1alpha1_NodeStatsSummary(in *controlplane.NodeStatsSummary, out *NodeStatsSummary, s conversion.Scope) error { + return autoConvert_controlplane_NodeStatsSummary_To_v1alpha1_NodeStatsSummary(in, out, s) +} diff --git a/pkg/apis/controlplane/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/controlplane/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..96c29706aa5 --- /dev/null +++ b/pkg/apis/controlplane/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,98 @@ +// +build !ignore_autogenerated + +// Copyright 2020 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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkPolicyReference) DeepCopyInto(out *NetworkPolicyReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyReference. +func (in *NetworkPolicyReference) DeepCopy() *NetworkPolicyReference { + if in == nil { + return nil + } + out := new(NetworkPolicyReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkPolicyStats) DeepCopyInto(out *NetworkPolicyStats) { + *out = *in + out.NetworkPolicy = in.NetworkPolicy + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyStats. +func (in *NetworkPolicyStats) DeepCopy() *NetworkPolicyStats { + if in == nil { + return nil + } + out := new(NetworkPolicyStats) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatsSummary) DeepCopyInto(out *NodeStatsSummary) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.NetworkPolicies != nil { + in, out := &in.NetworkPolicies, &out.NetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + if in.AntreaClusterNetworkPolicies != nil { + in, out := &in.AntreaClusterNetworkPolicies, &out.AntreaClusterNetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + if in.AntreaNetworkPolicies != nil { + in, out := &in.AntreaNetworkPolicies, &out.AntreaNetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatsSummary. +func (in *NodeStatsSummary) DeepCopy() *NodeStatsSummary { + if in == nil { + return nil + } + out := new(NodeStatsSummary) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeStatsSummary) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/pkg/apis/controlplane/zz_generated.deepcopy.go b/pkg/apis/controlplane/zz_generated.deepcopy.go index de1b3cc6885..c43c204128a 100644 --- a/pkg/apis/controlplane/zz_generated.deepcopy.go +++ b/pkg/apis/controlplane/zz_generated.deepcopy.go @@ -655,6 +655,65 @@ func (in *NetworkPolicyRule) DeepCopy() *NetworkPolicyRule { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkPolicyStats) DeepCopyInto(out *NetworkPolicyStats) { + *out = *in + out.NetworkPolicy = in.NetworkPolicy + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyStats. +func (in *NetworkPolicyStats) DeepCopy() *NetworkPolicyStats { + if in == nil { + return nil + } + out := new(NetworkPolicyStats) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatsSummary) DeepCopyInto(out *NodeStatsSummary) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.NetworkPolicies != nil { + in, out := &in.NetworkPolicies, &out.NetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + if in.AntreaClusterNetworkPolicies != nil { + in, out := &in.AntreaClusterNetworkPolicies, &out.AntreaClusterNetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + if in.AntreaNetworkPolicies != nil { + in, out := &in.AntreaNetworkPolicies, &out.AntreaNetworkPolicies + *out = make([]NetworkPolicyStats, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatsSummary. +func (in *NodeStatsSummary) DeepCopy() *NodeStatsSummary { + if in == nil { + return nil + } + out := new(NodeStatsSummary) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeStatsSummary) 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 *PodReference) DeepCopyInto(out *PodReference) { *out = *in diff --git a/pkg/apis/metrics/doc.go b/pkg/apis/metrics/doc.go new file mode 100644 index 00000000000..7aa6df819b3 --- /dev/null +++ b/pkg/apis/metrics/doc.go @@ -0,0 +1,21 @@ +// Copyright 2020 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. + +// +k8s:deepcopy-gen=package +// +groupName=metrics.antrea.tanzu.vmware.com + +// Package metrics is the internal version of the Antrea Metrics API. +// Refer to https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md doc +// for more information. +package metrics diff --git a/pkg/apis/metrics/install/install.go b/pkg/apis/metrics/install/install.go new file mode 100644 index 00000000000..f1bced70ba2 --- /dev/null +++ b/pkg/apis/metrics/install/install.go @@ -0,0 +1,30 @@ +// Copyright 2020 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 install + +import ( + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + "github.com/vmware-tanzu/antrea/pkg/apis/metrics" + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" +) + +// Install registers the API group and adds types to a scheme +func Install(scheme *runtime.Scheme) { + utilruntime.Must(metrics.AddToScheme(scheme)) + utilruntime.Must(v1alpha1.AddToScheme(scheme)) + utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)) +} diff --git a/pkg/apis/metrics/register.go b/pkg/apis/metrics/register.go new file mode 100644 index 00000000000..a54910f1476 --- /dev/null +++ b/pkg/apis/metrics/register.go @@ -0,0 +1,55 @@ +// Copyright 2020 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 metrics + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "metrics.antrea.tanzu.vmware.com" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &AntreaClusterNetworkPolicyMetrics{}, + &AntreaClusterNetworkPolicyMetricsList{}, + &AntreaNetworkPolicyMetrics{}, + &AntreaNetworkPolicyMetricsList{}, + &NetworkPolicyMetrics{}, + &NetworkPolicyMetricsList{}, + ) + return nil +} diff --git a/pkg/apis/metrics/types.go b/pkg/apis/metrics/types.go new file mode 100644 index 00000000000..ca30ae19166 --- /dev/null +++ b/pkg/apis/metrics/types.go @@ -0,0 +1,95 @@ +// Copyright 2020 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 metrics + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaClusterNetworkPolicyMetrics is the metrics of a Antrea ClusterNetworkPolicy. +type AntreaClusterNetworkPolicyMetrics struct { + metav1.TypeMeta + metav1.ObjectMeta + + // The traffic stats of the Antrea ClusterNetworkPolicy. + TrafficStats TrafficStats +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaClusterNetworkPolicyMetricsList is a list of AntreaClusterNetworkPolicyMetrics. +type AntreaClusterNetworkPolicyMetricsList struct { + metav1.TypeMeta + metav1.ListMeta + + // List of AntreaClusterNetworkPolicyMetrics. + Items []AntreaClusterNetworkPolicyMetrics +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaNetworkPolicyMetrics is the metrics of a Antrea NetworkPolicy. +type AntreaNetworkPolicyMetrics struct { + metav1.TypeMeta + metav1.ObjectMeta + + // The traffic stats of the Antrea NetworkPolicy. + TrafficStats TrafficStats +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaNetworkPolicyMetricsList is a list of AntreaNetworkPolicyMetrics. +type AntreaNetworkPolicyMetricsList struct { + metav1.TypeMeta + metav1.ListMeta + + // List of AntreaNetworkPolicyMetrics. + Items []AntreaNetworkPolicyMetrics +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkPolicyMetrics is the metrics of a K8s NetworkPolicy. +type NetworkPolicyMetrics struct { + metav1.TypeMeta + metav1.ObjectMeta + + // The traffic stats of the K8s NetworkPolicy. + TrafficStats TrafficStats +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkPolicyMetricsList is a list of NetworkPolicyMetrics. +type NetworkPolicyMetricsList struct { + metav1.TypeMeta + metav1.ListMeta + + // List of NetworkPolicyMetrics. + Items []NetworkPolicyMetrics +} + +// TrafficStats contains the traffic stats of a NetworkPolicy. +type TrafficStats struct { + // Packets is the packets count hit by the NetworkPolicy. + Packets int64 + // Bytes is the bytes count hit by the NetworkPolicy. + Bytes int64 + // Sessions is the sessions count hit by the NetworkPolicy. + Sessions int64 +} diff --git a/pkg/apis/metrics/v1alpha1/doc.go b/pkg/apis/metrics/v1alpha1/doc.go new file mode 100644 index 00000000000..829e1a51775 --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/doc.go @@ -0,0 +1,22 @@ +// Copyright 2020 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. + +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:conversion-gen=github.com/vmware-tanzu/antrea/pkg/apis/metrics +// +groupName=metrics.antrea.tanzu.vmware.com + +// Package v1alpha1 is the v1alpha1 version of the Antrea Metrics API. +package v1alpha1 diff --git a/pkg/apis/metrics/v1alpha1/generated.pb.go b/pkg/apis/metrics/v1alpha1/generated.pb.go new file mode 100644 index 00000000000..96d04767468 --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/generated.pb.go @@ -0,0 +1,1723 @@ +// Copyright 2020 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 protoc-gen-gogo. DO NOT EDIT. +// source: github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1/generated.proto + +package v1alpha1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func (m *AntreaClusterNetworkPolicyMetrics) Reset() { *m = AntreaClusterNetworkPolicyMetrics{} } +func (*AntreaClusterNetworkPolicyMetrics) ProtoMessage() {} +func (*AntreaClusterNetworkPolicyMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{0} +} +func (m *AntreaClusterNetworkPolicyMetrics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AntreaClusterNetworkPolicyMetrics) 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 *AntreaClusterNetworkPolicyMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_AntreaClusterNetworkPolicyMetrics.Merge(m, src) +} +func (m *AntreaClusterNetworkPolicyMetrics) XXX_Size() int { + return m.Size() +} +func (m *AntreaClusterNetworkPolicyMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_AntreaClusterNetworkPolicyMetrics.DiscardUnknown(m) +} + +var xxx_messageInfo_AntreaClusterNetworkPolicyMetrics proto.InternalMessageInfo + +func (m *AntreaClusterNetworkPolicyMetricsList) Reset() { *m = AntreaClusterNetworkPolicyMetricsList{} } +func (*AntreaClusterNetworkPolicyMetricsList) ProtoMessage() {} +func (*AntreaClusterNetworkPolicyMetricsList) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{1} +} +func (m *AntreaClusterNetworkPolicyMetricsList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AntreaClusterNetworkPolicyMetricsList) 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 *AntreaClusterNetworkPolicyMetricsList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AntreaClusterNetworkPolicyMetricsList.Merge(m, src) +} +func (m *AntreaClusterNetworkPolicyMetricsList) XXX_Size() int { + return m.Size() +} +func (m *AntreaClusterNetworkPolicyMetricsList) XXX_DiscardUnknown() { + xxx_messageInfo_AntreaClusterNetworkPolicyMetricsList.DiscardUnknown(m) +} + +var xxx_messageInfo_AntreaClusterNetworkPolicyMetricsList proto.InternalMessageInfo + +func (m *AntreaNetworkPolicyMetrics) Reset() { *m = AntreaNetworkPolicyMetrics{} } +func (*AntreaNetworkPolicyMetrics) ProtoMessage() {} +func (*AntreaNetworkPolicyMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{2} +} +func (m *AntreaNetworkPolicyMetrics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AntreaNetworkPolicyMetrics) 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 *AntreaNetworkPolicyMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_AntreaNetworkPolicyMetrics.Merge(m, src) +} +func (m *AntreaNetworkPolicyMetrics) XXX_Size() int { + return m.Size() +} +func (m *AntreaNetworkPolicyMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_AntreaNetworkPolicyMetrics.DiscardUnknown(m) +} + +var xxx_messageInfo_AntreaNetworkPolicyMetrics proto.InternalMessageInfo + +func (m *AntreaNetworkPolicyMetricsList) Reset() { *m = AntreaNetworkPolicyMetricsList{} } +func (*AntreaNetworkPolicyMetricsList) ProtoMessage() {} +func (*AntreaNetworkPolicyMetricsList) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{3} +} +func (m *AntreaNetworkPolicyMetricsList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AntreaNetworkPolicyMetricsList) 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 *AntreaNetworkPolicyMetricsList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AntreaNetworkPolicyMetricsList.Merge(m, src) +} +func (m *AntreaNetworkPolicyMetricsList) XXX_Size() int { + return m.Size() +} +func (m *AntreaNetworkPolicyMetricsList) XXX_DiscardUnknown() { + xxx_messageInfo_AntreaNetworkPolicyMetricsList.DiscardUnknown(m) +} + +var xxx_messageInfo_AntreaNetworkPolicyMetricsList proto.InternalMessageInfo + +func (m *NetworkPolicyMetrics) Reset() { *m = NetworkPolicyMetrics{} } +func (*NetworkPolicyMetrics) ProtoMessage() {} +func (*NetworkPolicyMetrics) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{4} +} +func (m *NetworkPolicyMetrics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetworkPolicyMetrics) 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 *NetworkPolicyMetrics) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkPolicyMetrics.Merge(m, src) +} +func (m *NetworkPolicyMetrics) XXX_Size() int { + return m.Size() +} +func (m *NetworkPolicyMetrics) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkPolicyMetrics.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkPolicyMetrics proto.InternalMessageInfo + +func (m *NetworkPolicyMetricsList) Reset() { *m = NetworkPolicyMetricsList{} } +func (*NetworkPolicyMetricsList) ProtoMessage() {} +func (*NetworkPolicyMetricsList) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{5} +} +func (m *NetworkPolicyMetricsList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetworkPolicyMetricsList) 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 *NetworkPolicyMetricsList) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkPolicyMetricsList.Merge(m, src) +} +func (m *NetworkPolicyMetricsList) XXX_Size() int { + return m.Size() +} +func (m *NetworkPolicyMetricsList) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkPolicyMetricsList.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkPolicyMetricsList proto.InternalMessageInfo + +func (m *TrafficStats) Reset() { *m = TrafficStats{} } +func (*TrafficStats) ProtoMessage() {} +func (*TrafficStats) Descriptor() ([]byte, []int) { + return fileDescriptor_e729775dede77d0e, []int{6} +} +func (m *TrafficStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TrafficStats) 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 *TrafficStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_TrafficStats.Merge(m, src) +} +func (m *TrafficStats) XXX_Size() int { + return m.Size() +} +func (m *TrafficStats) XXX_DiscardUnknown() { + xxx_messageInfo_TrafficStats.DiscardUnknown(m) +} + +var xxx_messageInfo_TrafficStats proto.InternalMessageInfo + +func init() { + proto.RegisterType((*AntreaClusterNetworkPolicyMetrics)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.AntreaClusterNetworkPolicyMetrics") + proto.RegisterType((*AntreaClusterNetworkPolicyMetricsList)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.AntreaClusterNetworkPolicyMetricsList") + proto.RegisterType((*AntreaNetworkPolicyMetrics)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.AntreaNetworkPolicyMetrics") + proto.RegisterType((*AntreaNetworkPolicyMetricsList)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.AntreaNetworkPolicyMetricsList") + proto.RegisterType((*NetworkPolicyMetrics)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.NetworkPolicyMetrics") + proto.RegisterType((*NetworkPolicyMetricsList)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.NetworkPolicyMetricsList") + proto.RegisterType((*TrafficStats)(nil), "github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1.TrafficStats") +} + +func init() { + proto.RegisterFile("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1/generated.proto", fileDescriptor_e729775dede77d0e) +} + +var fileDescriptor_e729775dede77d0e = []byte{ + // 541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x52, 0xcd, 0x6b, 0x13, 0x4f, + 0x18, 0xde, 0x49, 0x08, 0x0d, 0xd3, 0xfe, 0xf8, 0xc9, 0xd2, 0x43, 0xc8, 0x61, 0xaa, 0x15, 0xa1, + 0x82, 0x9d, 0x31, 0x45, 0xa4, 0x57, 0x57, 0x10, 0x05, 0x5b, 0xcb, 0xb6, 0x27, 0x15, 0x74, 0xb2, + 0x9d, 0x6c, 0xc6, 0xcd, 0x7e, 0x30, 0x33, 0x9b, 0x12, 0x4f, 0xf5, 0xe6, 0xc1, 0x83, 0x7f, 0x56, + 0x8e, 0x3d, 0xf6, 0x54, 0xcc, 0x7a, 0xf6, 0x0f, 0x10, 0x2f, 0xb2, 0x33, 0x9b, 0x8f, 0x35, 0x94, + 0xd8, 0x08, 0x7a, 0xe8, 0x6d, 0xf7, 0xdd, 0x7d, 0x3e, 0xde, 0xe7, 0x79, 0xe1, 0x53, 0x9f, 0xab, + 0x6e, 0xda, 0xc6, 0x5e, 0x1c, 0x92, 0x7e, 0x78, 0x42, 0x05, 0xdb, 0x56, 0x34, 0x7a, 0x9f, 0x12, + 0x1a, 0x29, 0xc1, 0x28, 0x49, 0x02, 0x9f, 0xd0, 0x84, 0x4b, 0x12, 0x32, 0x25, 0xb8, 0x27, 0x49, + 0xbf, 0x45, 0x7b, 0x49, 0x97, 0xb6, 0x88, 0xcf, 0x22, 0x26, 0xa8, 0x62, 0xc7, 0x38, 0x11, 0xb1, + 0x8a, 0xed, 0xdd, 0x29, 0x13, 0x36, 0x4c, 0x6f, 0x34, 0x13, 0x36, 0x4c, 0x38, 0x09, 0x7c, 0x9c, + 0x33, 0xe1, 0x82, 0x09, 0x8f, 0x99, 0x9a, 0xdb, 0x33, 0x1e, 0xfc, 0xd8, 0x8f, 0x89, 0x26, 0x6c, + 0xa7, 0x1d, 0xfd, 0xa6, 0x5f, 0xf4, 0x93, 0x11, 0x6a, 0x3e, 0x08, 0x76, 0x25, 0xe6, 0x71, 0x6e, + 0x2b, 0xa4, 0x5e, 0x97, 0x47, 0x4c, 0x0c, 0x4a, 0x3e, 0x29, 0xe9, 0xcf, 0xd9, 0x6b, 0x92, 0xcb, + 0x50, 0x22, 0x8d, 0x14, 0x0f, 0xd9, 0x1c, 0xe0, 0xe1, 0x22, 0x80, 0xf4, 0xba, 0x2c, 0xa4, 0xbf, + 0xe2, 0x36, 0x3f, 0x56, 0xe0, 0xad, 0x47, 0x7a, 0xe5, 0xc7, 0xbd, 0x54, 0x2a, 0x26, 0xf6, 0x99, + 0x3a, 0x89, 0x45, 0x70, 0x10, 0xf7, 0xb8, 0x37, 0xd8, 0x33, 0xcb, 0xdb, 0x6f, 0x61, 0x3d, 0x77, + 0x7a, 0x4c, 0x15, 0x6d, 0x80, 0x9b, 0x60, 0x6b, 0x75, 0xe7, 0x3e, 0x36, 0x82, 0x78, 0x56, 0xb0, + 0x94, 0x1a, 0xc5, 0xfd, 0x16, 0x7e, 0xd1, 0x7e, 0xc7, 0x3c, 0xb5, 0xc7, 0x14, 0x75, 0xec, 0xe1, + 0xc5, 0x86, 0x95, 0x5d, 0x6c, 0xc0, 0xe9, 0xcc, 0x9d, 0xb0, 0xda, 0xa7, 0x00, 0xae, 0x29, 0x41, + 0x3b, 0x1d, 0xee, 0x1d, 0x2a, 0xaa, 0x64, 0xa3, 0xa2, 0x65, 0x9e, 0xe0, 0x65, 0x7b, 0xc2, 0x47, + 0x33, 0x6c, 0xce, 0x7a, 0x21, 0xbe, 0x36, 0x3b, 0x75, 0x4b, 0x8a, 0x79, 0x14, 0x77, 0x16, 0x46, + 0xf1, 0x9c, 0x4b, 0x65, 0xbf, 0x9e, 0x8b, 0x03, 0xff, 0x5e, 0x1c, 0x39, 0x5a, 0x87, 0x71, 0xa3, + 0xf0, 0x53, 0x1f, 0x4f, 0xca, 0x51, 0xd4, 0xb8, 0x62, 0x61, 0x9e, 0x41, 0x75, 0x6b, 0x75, 0xe7, + 0xd5, 0xf2, 0x19, 0x2c, 0x5c, 0xc7, 0xf9, 0xaf, 0x30, 0x52, 0x7b, 0x96, 0x2b, 0xba, 0x46, 0x78, + 0xf3, 0x43, 0x05, 0x36, 0x0d, 0xf6, 0xfa, 0x9e, 0xc3, 0x77, 0x00, 0xd1, 0xe5, 0x19, 0xfc, 0x85, + 0x3b, 0x18, 0x94, 0xcf, 0xe0, 0xe8, 0x4f, 0xcf, 0xe0, 0x0a, 0xfd, 0xff, 0x00, 0x70, 0xfd, 0xfa, + 0x36, 0xff, 0x0d, 0xc0, 0xc6, 0x3f, 0xea, 0x5c, 0x96, 0x3b, 0xdf, 0x5f, 0x7e, 0xeb, 0x2b, 0xb4, + 0xfd, 0x09, 0xc0, 0x52, 0x1c, 0xf6, 0x5d, 0xb8, 0x92, 0x50, 0x2f, 0x60, 0x4a, 0xea, 0x15, 0xab, + 0xce, 0xff, 0x05, 0x6e, 0xe5, 0xc0, 0x8c, 0xdd, 0xf1, 0x77, 0xfb, 0x36, 0xac, 0xb5, 0x07, 0x8a, + 0x99, 0x9a, 0xaa, 0x53, 0x01, 0x27, 0x1f, 0xba, 0xe6, 0x9b, 0x7d, 0x0f, 0xd6, 0x25, 0x93, 0x92, + 0xc7, 0x91, 0x6c, 0x54, 0xf5, 0x7f, 0x93, 0x0c, 0x0e, 0x8b, 0xb9, 0x3b, 0xf9, 0xc3, 0xc1, 0xc3, + 0x11, 0xb2, 0xce, 0x46, 0xc8, 0x3a, 0x1f, 0x21, 0xeb, 0x34, 0x43, 0x60, 0x98, 0x21, 0x70, 0x96, + 0x21, 0x70, 0x9e, 0x21, 0xf0, 0x25, 0x43, 0xe0, 0xf3, 0x57, 0x64, 0xbd, 0xac, 0x8f, 0x37, 0xfd, + 0x19, 0x00, 0x00, 0xff, 0xff, 0x45, 0x99, 0x64, 0xf7, 0x15, 0x08, 0x00, 0x00, +} + +func (m *AntreaClusterNetworkPolicyMetrics) 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 *AntreaClusterNetworkPolicyMetrics) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AntreaClusterNetworkPolicyMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TrafficStats.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 *AntreaClusterNetworkPolicyMetricsList) 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 *AntreaClusterNetworkPolicyMetricsList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AntreaClusterNetworkPolicyMetricsList) 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 *AntreaNetworkPolicyMetrics) 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 *AntreaNetworkPolicyMetrics) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AntreaNetworkPolicyMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TrafficStats.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 *AntreaNetworkPolicyMetricsList) 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 *AntreaNetworkPolicyMetricsList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AntreaNetworkPolicyMetricsList) 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 *NetworkPolicyMetrics) 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 *NetworkPolicyMetrics) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetworkPolicyMetrics) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TrafficStats.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 *NetworkPolicyMetricsList) 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 *NetworkPolicyMetricsList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NetworkPolicyMetricsList) 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 *TrafficStats) 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 *TrafficStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TrafficStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.Sessions)) + i-- + dAtA[i] = 0x18 + i = encodeVarintGenerated(dAtA, i, uint64(m.Bytes)) + i-- + dAtA[i] = 0x10 + i = encodeVarintGenerated(dAtA, i, uint64(m.Packets)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AntreaClusterNetworkPolicyMetrics) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.TrafficStats.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *AntreaClusterNetworkPolicyMetricsList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + 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 *AntreaNetworkPolicyMetrics) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.TrafficStats.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *AntreaNetworkPolicyMetricsList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + 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 *NetworkPolicyMetrics) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.TrafficStats.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *NetworkPolicyMetricsList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + 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) { + 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) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *AntreaClusterNetworkPolicyMetrics) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AntreaClusterNetworkPolicyMetrics{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `TrafficStats:` + strings.Replace(strings.Replace(this.TrafficStats.String(), "TrafficStats", "TrafficStats", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *AntreaClusterNetworkPolicyMetricsList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]AntreaClusterNetworkPolicyMetrics{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "AntreaClusterNetworkPolicyMetrics", "AntreaClusterNetworkPolicyMetrics", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&AntreaClusterNetworkPolicyMetricsList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *AntreaNetworkPolicyMetrics) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AntreaNetworkPolicyMetrics{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `TrafficStats:` + strings.Replace(strings.Replace(this.TrafficStats.String(), "TrafficStats", "TrafficStats", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *AntreaNetworkPolicyMetricsList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]AntreaNetworkPolicyMetrics{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "AntreaNetworkPolicyMetrics", "AntreaNetworkPolicyMetrics", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&AntreaNetworkPolicyMetricsList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *NetworkPolicyMetrics) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NetworkPolicyMetrics{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `TrafficStats:` + strings.Replace(strings.Replace(this.TrafficStats.String(), "TrafficStats", "TrafficStats", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *NetworkPolicyMetricsList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]NetworkPolicyMetrics{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "NetworkPolicyMetrics", "NetworkPolicyMetrics", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&NetworkPolicyMetricsList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *TrafficStats) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TrafficStats{`, + `Packets:` + fmt.Sprintf("%v", this.Packets) + `,`, + `Bytes:` + fmt.Sprintf("%v", this.Bytes) + `,`, + `Sessions:` + fmt.Sprintf("%v", this.Sessions) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *AntreaClusterNetworkPolicyMetrics) 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: AntreaClusterNetworkPolicyMetrics: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaClusterNetworkPolicyMetrics: 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 + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaClusterNetworkPolicyMetricsList) 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: AntreaClusterNetworkPolicyMetricsList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaClusterNetworkPolicyMetricsList: 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, AntreaClusterNetworkPolicyMetrics{}) + 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 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaNetworkPolicyMetrics) 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: AntreaNetworkPolicyMetrics: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaNetworkPolicyMetrics: 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 + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AntreaNetworkPolicyMetricsList) 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: AntreaNetworkPolicyMetricsList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AntreaNetworkPolicyMetricsList: 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, AntreaNetworkPolicyMetrics{}) + 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 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetworkPolicyMetrics) 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: NetworkPolicyMetrics: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkPolicyMetrics: 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 + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetworkPolicyMetricsList) 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: NetworkPolicyMetricsList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetworkPolicyMetricsList: 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, NetworkPolicyMetrics{}) + 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 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TrafficStats) 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: TrafficStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TrafficStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Packets", wireType) + } + m.Packets = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Packets |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) + } + m.Bytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Bytes |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sessions", wireType) + } + m.Sessions = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sessions |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/pkg/apis/metrics/v1alpha1/generated.proto b/pkg/apis/metrics/v1alpha1/generated.proto new file mode 100644 index 00000000000..30be5b77dd8 --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/generated.proto @@ -0,0 +1,87 @@ +// Copyright 2020 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. + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = 'proto2'; + +package github.com.vmware_tanzu.antrea.pkg.apis.metrics.v1alpha1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "v1alpha1"; + +// AntreaClusterNetworkPolicyMetrics is the metrics of a Antrea ClusterNetworkPolicy. +message AntreaClusterNetworkPolicyMetrics { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // The traffic stats of the Antrea ClusterNetworkPolicy. + optional TrafficStats trafficStats = 2; +} + +// AntreaClusterNetworkPolicyMetricsList is a list of AntreaClusterNetworkPolicyMetrics. +message AntreaClusterNetworkPolicyMetricsList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of AntreaClusterNetworkPolicyMetrics. + repeated AntreaClusterNetworkPolicyMetrics items = 2; +} + +// AntreaNetworkPolicyMetrics is the metrics of a Antrea NetworkPolicy. +message AntreaNetworkPolicyMetrics { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // The traffic stats of the Antrea NetworkPolicy. + optional TrafficStats trafficStats = 2; +} + +// AntreaNetworkPolicyMetricsList is a list of AntreaNetworkPolicyMetrics. +message AntreaNetworkPolicyMetricsList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of AntreaNetworkPolicyMetrics. + repeated AntreaNetworkPolicyMetrics items = 2; +} + +// NetworkPolicyMetrics is the metrics of a K8s NetworkPolicy. +message NetworkPolicyMetrics { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // The traffic stats of the K8s NetworkPolicy. + optional TrafficStats trafficStats = 2; +} + +// NetworkPolicyMetricsList is a list of NetworkPolicyMetrics. +message NetworkPolicyMetricsList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of NetworkPolicyMetrics. + repeated NetworkPolicyMetrics items = 2; +} + +// TrafficStats contains the traffic stats of a NetworkPolicy. +message TrafficStats { + // Packets is the packets count hit by the NetworkPolicy. + optional int64 packets = 1; + + // Bytes is the bytes count hit by the NetworkPolicy. + optional int64 bytes = 2; + + // Sessions is the sessions count hit by the NetworkPolicy. + optional int64 sessions = 3; +} + diff --git a/pkg/apis/metrics/v1alpha1/register.go b/pkg/apis/metrics/v1alpha1/register.go new file mode 100644 index 00000000000..07cd99689dd --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/register.go @@ -0,0 +1,53 @@ +// Copyright 2020 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name use in this package +const GroupName = "metrics.antrea.tanzu.vmware.com" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &AntreaClusterNetworkPolicyMetrics{}, + &AntreaClusterNetworkPolicyMetricsList{}, + &AntreaNetworkPolicyMetrics{}, + &AntreaNetworkPolicyMetricsList{}, + &NetworkPolicyMetrics{}, + &NetworkPolicyMetricsList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/metrics/v1alpha1/types.go b/pkg/apis/metrics/v1alpha1/types.go new file mode 100644 index 00000000000..3c18d546370 --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/types.go @@ -0,0 +1,105 @@ +// Copyright 2020 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +resourceName=antreaclusternetworkpolicymetrics +// +genclient:readonly +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaClusterNetworkPolicyMetrics is the metrics of a Antrea ClusterNetworkPolicy. +type AntreaClusterNetworkPolicyMetrics struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // The traffic stats of the Antrea ClusterNetworkPolicy. + TrafficStats TrafficStats `json:"trafficStats,omitempty" protobuf:"bytes,2,opt,name=trafficStats"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaClusterNetworkPolicyMetricsList is a list of AntreaClusterNetworkPolicyMetrics. +type AntreaClusterNetworkPolicyMetricsList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // List of AntreaClusterNetworkPolicyMetrics. + Items []AntreaClusterNetworkPolicyMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient +// +resourceName=antreanetworkpolicymetrics +// +genclient:readonly +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaNetworkPolicyMetrics is the metrics of a Antrea NetworkPolicy. +type AntreaNetworkPolicyMetrics struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // The traffic stats of the Antrea NetworkPolicy. + TrafficStats TrafficStats `json:"trafficStats,omitempty" protobuf:"bytes,2,opt,name=trafficStats"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AntreaNetworkPolicyMetricsList is a list of AntreaNetworkPolicyMetrics. +type AntreaNetworkPolicyMetricsList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // List of AntreaNetworkPolicyMetrics. + Items []AntreaNetworkPolicyMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// +genclient +// +resourceName=networkpolicymetrics +// +genclient:readonly +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkPolicyMetrics is the metrics of a K8s NetworkPolicy. +type NetworkPolicyMetrics struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // The traffic stats of the K8s NetworkPolicy. + TrafficStats TrafficStats `json:"trafficStats,omitempty" protobuf:"bytes,2,opt,name=trafficStats"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// NetworkPolicyMetricsList is a list of NetworkPolicyMetrics. +type NetworkPolicyMetricsList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // List of NetworkPolicyMetrics. + Items []NetworkPolicyMetrics `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// TrafficStats contains the traffic stats of a NetworkPolicy. +type TrafficStats struct { + // Packets is the packets count hit by the NetworkPolicy. + Packets int64 `json:"packets,omitempty" protobuf:"varint,1,opt,name=packets"` + // Bytes is the bytes count hit by the NetworkPolicy. + Bytes int64 `json:"bytes,omitempty" protobuf:"varint,2,opt,name=bytes"` + // Sessions is the sessions count hit by the NetworkPolicy. + Sessions int64 `json:"sessions,omitempty" protobuf:"varint,3,opt,name=sessions"` +} diff --git a/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go b/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go new file mode 100644 index 00000000000..6929412554b --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,275 @@ +// +build !ignore_autogenerated + +// Copyright 2020 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 conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + metrics "github.com/vmware-tanzu/antrea/pkg/apis/metrics" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*AntreaClusterNetworkPolicyMetrics)(nil), (*metrics.AntreaClusterNetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AntreaClusterNetworkPolicyMetrics_To_metrics_AntreaClusterNetworkPolicyMetrics(a.(*AntreaClusterNetworkPolicyMetrics), b.(*metrics.AntreaClusterNetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.AntreaClusterNetworkPolicyMetrics)(nil), (*AntreaClusterNetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_AntreaClusterNetworkPolicyMetrics_To_v1alpha1_AntreaClusterNetworkPolicyMetrics(a.(*metrics.AntreaClusterNetworkPolicyMetrics), b.(*AntreaClusterNetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AntreaClusterNetworkPolicyMetricsList)(nil), (*metrics.AntreaClusterNetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AntreaClusterNetworkPolicyMetricsList_To_metrics_AntreaClusterNetworkPolicyMetricsList(a.(*AntreaClusterNetworkPolicyMetricsList), b.(*metrics.AntreaClusterNetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.AntreaClusterNetworkPolicyMetricsList)(nil), (*AntreaClusterNetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_AntreaClusterNetworkPolicyMetricsList_To_v1alpha1_AntreaClusterNetworkPolicyMetricsList(a.(*metrics.AntreaClusterNetworkPolicyMetricsList), b.(*AntreaClusterNetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AntreaNetworkPolicyMetrics)(nil), (*metrics.AntreaNetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AntreaNetworkPolicyMetrics_To_metrics_AntreaNetworkPolicyMetrics(a.(*AntreaNetworkPolicyMetrics), b.(*metrics.AntreaNetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.AntreaNetworkPolicyMetrics)(nil), (*AntreaNetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_AntreaNetworkPolicyMetrics_To_v1alpha1_AntreaNetworkPolicyMetrics(a.(*metrics.AntreaNetworkPolicyMetrics), b.(*AntreaNetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AntreaNetworkPolicyMetricsList)(nil), (*metrics.AntreaNetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AntreaNetworkPolicyMetricsList_To_metrics_AntreaNetworkPolicyMetricsList(a.(*AntreaNetworkPolicyMetricsList), b.(*metrics.AntreaNetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.AntreaNetworkPolicyMetricsList)(nil), (*AntreaNetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_AntreaNetworkPolicyMetricsList_To_v1alpha1_AntreaNetworkPolicyMetricsList(a.(*metrics.AntreaNetworkPolicyMetricsList), b.(*AntreaNetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkPolicyMetrics)(nil), (*metrics.NetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NetworkPolicyMetrics_To_metrics_NetworkPolicyMetrics(a.(*NetworkPolicyMetrics), b.(*metrics.NetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.NetworkPolicyMetrics)(nil), (*NetworkPolicyMetrics)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_NetworkPolicyMetrics_To_v1alpha1_NetworkPolicyMetrics(a.(*metrics.NetworkPolicyMetrics), b.(*NetworkPolicyMetrics), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkPolicyMetricsList)(nil), (*metrics.NetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_NetworkPolicyMetricsList_To_metrics_NetworkPolicyMetricsList(a.(*NetworkPolicyMetricsList), b.(*metrics.NetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.NetworkPolicyMetricsList)(nil), (*NetworkPolicyMetricsList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_NetworkPolicyMetricsList_To_v1alpha1_NetworkPolicyMetricsList(a.(*metrics.NetworkPolicyMetricsList), b.(*NetworkPolicyMetricsList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*TrafficStats)(nil), (*metrics.TrafficStats)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats(a.(*TrafficStats), b.(*metrics.TrafficStats), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*metrics.TrafficStats)(nil), (*TrafficStats)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats(a.(*metrics.TrafficStats), b.(*TrafficStats), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_AntreaClusterNetworkPolicyMetrics_To_metrics_AntreaClusterNetworkPolicyMetrics(in *AntreaClusterNetworkPolicyMetrics, out *metrics.AntreaClusterNetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AntreaClusterNetworkPolicyMetrics_To_metrics_AntreaClusterNetworkPolicyMetrics is an autogenerated conversion function. +func Convert_v1alpha1_AntreaClusterNetworkPolicyMetrics_To_metrics_AntreaClusterNetworkPolicyMetrics(in *AntreaClusterNetworkPolicyMetrics, out *metrics.AntreaClusterNetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_v1alpha1_AntreaClusterNetworkPolicyMetrics_To_metrics_AntreaClusterNetworkPolicyMetrics(in, out, s) +} + +func autoConvert_metrics_AntreaClusterNetworkPolicyMetrics_To_v1alpha1_AntreaClusterNetworkPolicyMetrics(in *metrics.AntreaClusterNetworkPolicyMetrics, out *AntreaClusterNetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_metrics_AntreaClusterNetworkPolicyMetrics_To_v1alpha1_AntreaClusterNetworkPolicyMetrics is an autogenerated conversion function. +func Convert_metrics_AntreaClusterNetworkPolicyMetrics_To_v1alpha1_AntreaClusterNetworkPolicyMetrics(in *metrics.AntreaClusterNetworkPolicyMetrics, out *AntreaClusterNetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_metrics_AntreaClusterNetworkPolicyMetrics_To_v1alpha1_AntreaClusterNetworkPolicyMetrics(in, out, s) +} + +func autoConvert_v1alpha1_AntreaClusterNetworkPolicyMetricsList_To_metrics_AntreaClusterNetworkPolicyMetricsList(in *AntreaClusterNetworkPolicyMetricsList, out *metrics.AntreaClusterNetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]metrics.AntreaClusterNetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_AntreaClusterNetworkPolicyMetricsList_To_metrics_AntreaClusterNetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_v1alpha1_AntreaClusterNetworkPolicyMetricsList_To_metrics_AntreaClusterNetworkPolicyMetricsList(in *AntreaClusterNetworkPolicyMetricsList, out *metrics.AntreaClusterNetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_v1alpha1_AntreaClusterNetworkPolicyMetricsList_To_metrics_AntreaClusterNetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_metrics_AntreaClusterNetworkPolicyMetricsList_To_v1alpha1_AntreaClusterNetworkPolicyMetricsList(in *metrics.AntreaClusterNetworkPolicyMetricsList, out *AntreaClusterNetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]AntreaClusterNetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_metrics_AntreaClusterNetworkPolicyMetricsList_To_v1alpha1_AntreaClusterNetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_metrics_AntreaClusterNetworkPolicyMetricsList_To_v1alpha1_AntreaClusterNetworkPolicyMetricsList(in *metrics.AntreaClusterNetworkPolicyMetricsList, out *AntreaClusterNetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_metrics_AntreaClusterNetworkPolicyMetricsList_To_v1alpha1_AntreaClusterNetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_v1alpha1_AntreaNetworkPolicyMetrics_To_metrics_AntreaNetworkPolicyMetrics(in *AntreaNetworkPolicyMetrics, out *metrics.AntreaNetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AntreaNetworkPolicyMetrics_To_metrics_AntreaNetworkPolicyMetrics is an autogenerated conversion function. +func Convert_v1alpha1_AntreaNetworkPolicyMetrics_To_metrics_AntreaNetworkPolicyMetrics(in *AntreaNetworkPolicyMetrics, out *metrics.AntreaNetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_v1alpha1_AntreaNetworkPolicyMetrics_To_metrics_AntreaNetworkPolicyMetrics(in, out, s) +} + +func autoConvert_metrics_AntreaNetworkPolicyMetrics_To_v1alpha1_AntreaNetworkPolicyMetrics(in *metrics.AntreaNetworkPolicyMetrics, out *AntreaNetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_metrics_AntreaNetworkPolicyMetrics_To_v1alpha1_AntreaNetworkPolicyMetrics is an autogenerated conversion function. +func Convert_metrics_AntreaNetworkPolicyMetrics_To_v1alpha1_AntreaNetworkPolicyMetrics(in *metrics.AntreaNetworkPolicyMetrics, out *AntreaNetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_metrics_AntreaNetworkPolicyMetrics_To_v1alpha1_AntreaNetworkPolicyMetrics(in, out, s) +} + +func autoConvert_v1alpha1_AntreaNetworkPolicyMetricsList_To_metrics_AntreaNetworkPolicyMetricsList(in *AntreaNetworkPolicyMetricsList, out *metrics.AntreaNetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]metrics.AntreaNetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_AntreaNetworkPolicyMetricsList_To_metrics_AntreaNetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_v1alpha1_AntreaNetworkPolicyMetricsList_To_metrics_AntreaNetworkPolicyMetricsList(in *AntreaNetworkPolicyMetricsList, out *metrics.AntreaNetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_v1alpha1_AntreaNetworkPolicyMetricsList_To_metrics_AntreaNetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_metrics_AntreaNetworkPolicyMetricsList_To_v1alpha1_AntreaNetworkPolicyMetricsList(in *metrics.AntreaNetworkPolicyMetricsList, out *AntreaNetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]AntreaNetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_metrics_AntreaNetworkPolicyMetricsList_To_v1alpha1_AntreaNetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_metrics_AntreaNetworkPolicyMetricsList_To_v1alpha1_AntreaNetworkPolicyMetricsList(in *metrics.AntreaNetworkPolicyMetricsList, out *AntreaNetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_metrics_AntreaNetworkPolicyMetricsList_To_v1alpha1_AntreaNetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_v1alpha1_NetworkPolicyMetrics_To_metrics_NetworkPolicyMetrics(in *NetworkPolicyMetrics, out *metrics.NetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_NetworkPolicyMetrics_To_metrics_NetworkPolicyMetrics is an autogenerated conversion function. +func Convert_v1alpha1_NetworkPolicyMetrics_To_metrics_NetworkPolicyMetrics(in *NetworkPolicyMetrics, out *metrics.NetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_v1alpha1_NetworkPolicyMetrics_To_metrics_NetworkPolicyMetrics(in, out, s) +} + +func autoConvert_metrics_NetworkPolicyMetrics_To_v1alpha1_NetworkPolicyMetrics(in *metrics.NetworkPolicyMetrics, out *NetworkPolicyMetrics, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats(&in.TrafficStats, &out.TrafficStats, s); err != nil { + return err + } + return nil +} + +// Convert_metrics_NetworkPolicyMetrics_To_v1alpha1_NetworkPolicyMetrics is an autogenerated conversion function. +func Convert_metrics_NetworkPolicyMetrics_To_v1alpha1_NetworkPolicyMetrics(in *metrics.NetworkPolicyMetrics, out *NetworkPolicyMetrics, s conversion.Scope) error { + return autoConvert_metrics_NetworkPolicyMetrics_To_v1alpha1_NetworkPolicyMetrics(in, out, s) +} + +func autoConvert_v1alpha1_NetworkPolicyMetricsList_To_metrics_NetworkPolicyMetricsList(in *NetworkPolicyMetricsList, out *metrics.NetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]metrics.NetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_NetworkPolicyMetricsList_To_metrics_NetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_v1alpha1_NetworkPolicyMetricsList_To_metrics_NetworkPolicyMetricsList(in *NetworkPolicyMetricsList, out *metrics.NetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_v1alpha1_NetworkPolicyMetricsList_To_metrics_NetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_metrics_NetworkPolicyMetricsList_To_v1alpha1_NetworkPolicyMetricsList(in *metrics.NetworkPolicyMetricsList, out *NetworkPolicyMetricsList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]NetworkPolicyMetrics)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_metrics_NetworkPolicyMetricsList_To_v1alpha1_NetworkPolicyMetricsList is an autogenerated conversion function. +func Convert_metrics_NetworkPolicyMetricsList_To_v1alpha1_NetworkPolicyMetricsList(in *metrics.NetworkPolicyMetricsList, out *NetworkPolicyMetricsList, s conversion.Scope) error { + return autoConvert_metrics_NetworkPolicyMetricsList_To_v1alpha1_NetworkPolicyMetricsList(in, out, s) +} + +func autoConvert_v1alpha1_TrafficStats_To_metrics_TrafficStats(in *TrafficStats, out *metrics.TrafficStats, s conversion.Scope) error { + out.Packets = in.Packets + out.Bytes = in.Bytes + out.Sessions = in.Sessions + return nil +} + +// Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats is an autogenerated conversion function. +func Convert_v1alpha1_TrafficStats_To_metrics_TrafficStats(in *TrafficStats, out *metrics.TrafficStats, s conversion.Scope) error { + return autoConvert_v1alpha1_TrafficStats_To_metrics_TrafficStats(in, out, s) +} + +func autoConvert_metrics_TrafficStats_To_v1alpha1_TrafficStats(in *metrics.TrafficStats, out *TrafficStats, s conversion.Scope) error { + out.Packets = in.Packets + out.Bytes = in.Bytes + out.Sessions = in.Sessions + return nil +} + +// Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats is an autogenerated conversion function. +func Convert_metrics_TrafficStats_To_v1alpha1_TrafficStats(in *metrics.TrafficStats, out *TrafficStats, s conversion.Scope) error { + return autoConvert_metrics_TrafficStats_To_v1alpha1_TrafficStats(in, out, s) +} diff --git a/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..cd7edae78cb --- /dev/null +++ b/pkg/apis/metrics/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,219 @@ +// +build !ignore_autogenerated + +// Copyright 2020 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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AntreaClusterNetworkPolicyMetrics) DeepCopyInto(out *AntreaClusterNetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaClusterNetworkPolicyMetrics. +func (in *AntreaClusterNetworkPolicyMetrics) DeepCopy() *AntreaClusterNetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(AntreaClusterNetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaClusterNetworkPolicyMetrics) 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 *AntreaClusterNetworkPolicyMetricsList) DeepCopyInto(out *AntreaClusterNetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AntreaClusterNetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaClusterNetworkPolicyMetricsList. +func (in *AntreaClusterNetworkPolicyMetricsList) DeepCopy() *AntreaClusterNetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(AntreaClusterNetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaClusterNetworkPolicyMetricsList) 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 *AntreaNetworkPolicyMetrics) DeepCopyInto(out *AntreaNetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaNetworkPolicyMetrics. +func (in *AntreaNetworkPolicyMetrics) DeepCopy() *AntreaNetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(AntreaNetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaNetworkPolicyMetrics) 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 *AntreaNetworkPolicyMetricsList) DeepCopyInto(out *AntreaNetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AntreaNetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaNetworkPolicyMetricsList. +func (in *AntreaNetworkPolicyMetricsList) DeepCopy() *AntreaNetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(AntreaNetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaNetworkPolicyMetricsList) 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 *NetworkPolicyMetrics) DeepCopyInto(out *NetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyMetrics. +func (in *NetworkPolicyMetrics) DeepCopy() *NetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(NetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkPolicyMetrics) 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 *NetworkPolicyMetricsList) DeepCopyInto(out *NetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyMetricsList. +func (in *NetworkPolicyMetricsList) DeepCopy() *NetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(NetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkPolicyMetricsList) 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 *TrafficStats) DeepCopyInto(out *TrafficStats) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficStats. +func (in *TrafficStats) DeepCopy() *TrafficStats { + if in == nil { + return nil + } + out := new(TrafficStats) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/metrics/zz_generated.deepcopy.go b/pkg/apis/metrics/zz_generated.deepcopy.go new file mode 100644 index 00000000000..abaa6cb9f67 --- /dev/null +++ b/pkg/apis/metrics/zz_generated.deepcopy.go @@ -0,0 +1,219 @@ +// +build !ignore_autogenerated + +// Copyright 2020 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 deepcopy-gen. DO NOT EDIT. + +package metrics + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AntreaClusterNetworkPolicyMetrics) DeepCopyInto(out *AntreaClusterNetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaClusterNetworkPolicyMetrics. +func (in *AntreaClusterNetworkPolicyMetrics) DeepCopy() *AntreaClusterNetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(AntreaClusterNetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaClusterNetworkPolicyMetrics) 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 *AntreaClusterNetworkPolicyMetricsList) DeepCopyInto(out *AntreaClusterNetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AntreaClusterNetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaClusterNetworkPolicyMetricsList. +func (in *AntreaClusterNetworkPolicyMetricsList) DeepCopy() *AntreaClusterNetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(AntreaClusterNetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaClusterNetworkPolicyMetricsList) 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 *AntreaNetworkPolicyMetrics) DeepCopyInto(out *AntreaNetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaNetworkPolicyMetrics. +func (in *AntreaNetworkPolicyMetrics) DeepCopy() *AntreaNetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(AntreaNetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaNetworkPolicyMetrics) 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 *AntreaNetworkPolicyMetricsList) DeepCopyInto(out *AntreaNetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AntreaNetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AntreaNetworkPolicyMetricsList. +func (in *AntreaNetworkPolicyMetricsList) DeepCopy() *AntreaNetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(AntreaNetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AntreaNetworkPolicyMetricsList) 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 *NetworkPolicyMetrics) DeepCopyInto(out *NetworkPolicyMetrics) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.TrafficStats = in.TrafficStats + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyMetrics. +func (in *NetworkPolicyMetrics) DeepCopy() *NetworkPolicyMetrics { + if in == nil { + return nil + } + out := new(NetworkPolicyMetrics) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkPolicyMetrics) 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 *NetworkPolicyMetricsList) DeepCopyInto(out *NetworkPolicyMetricsList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NetworkPolicyMetrics, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicyMetricsList. +func (in *NetworkPolicyMetricsList) DeepCopy() *NetworkPolicyMetricsList { + if in == nil { + return nil + } + out := new(NetworkPolicyMetricsList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NetworkPolicyMetricsList) 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 *TrafficStats) DeepCopyInto(out *TrafficStats) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficStats. +func (in *TrafficStats) DeepCopy() *TrafficStats { + if in == nil { + return nil + } + out := new(TrafficStats) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/security/v1alpha1/types.go b/pkg/apis/security/v1alpha1/types.go index f1968f2c90d..3f50dd10e62 100644 --- a/pkg/apis/security/v1alpha1/types.go +++ b/pkg/apis/security/v1alpha1/types.go @@ -172,7 +172,7 @@ type ClusterNetworkPolicySpec struct { // Tier right above the K8s NetworkPolicy which resides at the bottom. Tier string `json:"tier,omitempty"` // Priority specfies the order of the ClusterNetworkPolicy relative to - // other ClusterNetworkPolicies. + // other AntreaClusterNetworkPolicies. Priority float64 `json:"priority"` // Select workloads on which the rules will be applied to. AppliedTo []NetworkPolicyPeer `json:"appliedTo"` diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 3292fb18923..4be852edf39 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -37,6 +37,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/vmware-tanzu/antrea/pkg/apis/clusterinformation/v1beta1.ControllerCondition": schema_pkg_apis_clusterinformation_v1beta1_ControllerCondition(ref), "github.com/vmware-tanzu/antrea/pkg/apis/clusterinformation/v1beta1.NetworkPolicyControllerInfo": schema_pkg_apis_clusterinformation_v1beta1_NetworkPolicyControllerInfo(ref), "github.com/vmware-tanzu/antrea/pkg/apis/clusterinformation/v1beta1.OVSInfo": schema_pkg_apis_clusterinformation_v1beta1_OVSInfo(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyReference": schema_pkg_apis_controlplane_v1alpha1_NetworkPolicyReference(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyStats": schema_pkg_apis_controlplane_v1alpha1_NetworkPolicyStats(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NodeStatsSummary": schema_pkg_apis_controlplane_v1alpha1_NodeStatsSummary(ref), "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.AddressGroup": schema_pkg_apis_controlplane_v1beta1_AddressGroup(ref), "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.AddressGroupList": schema_pkg_apis_controlplane_v1beta1_AddressGroupList(ref), "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.AddressGroupPatch": schema_pkg_apis_controlplane_v1beta1_AddressGroupPatch(ref), @@ -57,6 +60,13 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.NetworkPolicyRule": schema_pkg_apis_controlplane_v1beta1_NetworkPolicyRule(ref), "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.PodReference": schema_pkg_apis_controlplane_v1beta1_PodReference(ref), "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1.Service": schema_pkg_apis_controlplane_v1beta1_Service(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaClusterNetworkPolicyMetrics": schema_pkg_apis_metrics_v1alpha1_AntreaClusterNetworkPolicyMetrics(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaClusterNetworkPolicyMetricsList": schema_pkg_apis_metrics_v1alpha1_AntreaClusterNetworkPolicyMetricsList(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaNetworkPolicyMetrics": schema_pkg_apis_metrics_v1alpha1_AntreaNetworkPolicyMetrics(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaNetworkPolicyMetricsList": schema_pkg_apis_metrics_v1alpha1_AntreaNetworkPolicyMetricsList(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.NetworkPolicyMetrics": schema_pkg_apis_metrics_v1alpha1_NetworkPolicyMetrics(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.NetworkPolicyMetricsList": schema_pkg_apis_metrics_v1alpha1_NetworkPolicyMetricsList(ref), + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats": schema_pkg_apis_metrics_v1alpha1_TrafficStats(ref), "github.com/vmware-tanzu/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), "k8s.io/api/core/v1.Affinity": schema_k8sio_api_core_v1_Affinity(ref), @@ -765,6 +775,146 @@ func schema_pkg_apis_clusterinformation_v1beta1_OVSInfo(ref common.ReferenceCall } } +func schema_pkg_apis_controlplane_v1alpha1_NetworkPolicyReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of the NetworkPolicy.", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of the NetworkPolicy. It's empty for ClusterNetworkPolicy.", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the NetworkPolicy.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the NetworkPolicy.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_controlplane_v1alpha1_NetworkPolicyStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "networkPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "The reference of the NetworkPolicy.", + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyReference"), + }, + }, + "trafficStats": { + SchemaProps: spec.SchemaProps{ + Description: "The stats of the NetworkPolicy.", + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyReference", "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats"}, + } +} + +func schema_pkg_apis_controlplane_v1alpha1_NodeStatsSummary(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NodeStatsSummary contains stats produced on a Node. It's used by the antrea-agents to report stats to the antrea-controller.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "networkPolicies": { + SchemaProps: spec.SchemaProps{ + Description: "The TrafficStats of K8s NetworkPolicies collected from the Node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyStats"), + }, + }, + }, + }, + }, + "antreaClusterNetworkPolicies": { + SchemaProps: spec.SchemaProps{ + Description: "The TrafficStats of Antrea ClusterNetworkPolicies collected from the Node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyStats"), + }, + }, + }, + }, + }, + "antreaNetworkPolicies": { + SchemaProps: spec.SchemaProps{ + Description: "The TrafficStats of Antrea NetworkPolicies collected from the Node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyStats"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1.NetworkPolicyStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + func schema_pkg_apis_controlplane_v1beta1_AddressGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1704,6 +1854,304 @@ func schema_pkg_apis_controlplane_v1beta1_Service(ref common.ReferenceCallback) } } +func schema_pkg_apis_metrics_v1alpha1_AntreaClusterNetworkPolicyMetrics(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AntreaClusterNetworkPolicyMetrics is the metrics of a Antrea ClusterNetworkPolicy.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "trafficStats": { + SchemaProps: spec.SchemaProps{ + Description: "The traffic stats of the Antrea ClusterNetworkPolicy.", + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_AntreaClusterNetworkPolicyMetricsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AntreaClusterNetworkPolicyMetricsList is a list of AntreaClusterNetworkPolicyMetrics.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of AntreaClusterNetworkPolicyMetrics.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaClusterNetworkPolicyMetrics"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaClusterNetworkPolicyMetrics", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_AntreaNetworkPolicyMetrics(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AntreaNetworkPolicyMetrics is the metrics of a Antrea NetworkPolicy.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "trafficStats": { + SchemaProps: spec.SchemaProps{ + Description: "The traffic stats of the Antrea NetworkPolicy.", + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_AntreaNetworkPolicyMetricsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AntreaNetworkPolicyMetricsList is a list of AntreaNetworkPolicyMetrics.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of AntreaNetworkPolicyMetrics.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaNetworkPolicyMetrics"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.AntreaNetworkPolicyMetrics", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_NetworkPolicyMetrics(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NetworkPolicyMetrics is the metrics of a K8s NetworkPolicy.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "trafficStats": { + SchemaProps: spec.SchemaProps{ + Description: "The traffic stats of the K8s NetworkPolicy.", + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.TrafficStats", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_NetworkPolicyMetricsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "NetworkPolicyMetricsList is a list of NetworkPolicyMetrics.", + 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{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of NetworkPolicyMetrics.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.NetworkPolicyMetrics"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1.NetworkPolicyMetrics", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_metrics_v1alpha1_TrafficStats(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrafficStats contains the traffic stats of a NetworkPolicy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "packets": { + SchemaProps: spec.SchemaProps{ + Description: "Packets is the packets count hit by the NetworkPolicy.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "bytes": { + SchemaProps: spec.SchemaProps{ + Description: "Bytes is the bytes count hit by the NetworkPolicy.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "sessions": { + SchemaProps: spec.SchemaProps{ + Description: "Sessions is the sessions count hit by the NetworkPolicy.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + } +} + func schema_pkg_apis_system_v1beta1_SupportBundle(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index e106e94d04f..68185156c61 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -20,8 +20,10 @@ import ( "fmt" clusterinformationv1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/clusterinformation/v1beta1" + controlplanev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1alpha1" controlplanev1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1beta1" corev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/core/v1alpha1" + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/metrics/v1alpha1" opsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/ops/v1alpha1" securityv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/security/v1alpha1" systemv1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/system/v1beta1" @@ -33,8 +35,10 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface ClusterinformationV1beta1() clusterinformationv1beta1.ClusterinformationV1beta1Interface + ControlplaneV1alpha1() controlplanev1alpha1.ControlplaneV1alpha1Interface ControlplaneV1beta1() controlplanev1beta1.ControlplaneV1beta1Interface CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface + MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface OpsV1alpha1() opsv1alpha1.OpsV1alpha1Interface SecurityV1alpha1() securityv1alpha1.SecurityV1alpha1Interface SystemV1beta1() systemv1beta1.SystemV1beta1Interface @@ -45,8 +49,10 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient clusterinformationV1beta1 *clusterinformationv1beta1.ClusterinformationV1beta1Client + controlplaneV1alpha1 *controlplanev1alpha1.ControlplaneV1alpha1Client controlplaneV1beta1 *controlplanev1beta1.ControlplaneV1beta1Client coreV1alpha1 *corev1alpha1.CoreV1alpha1Client + metricsV1alpha1 *metricsv1alpha1.MetricsV1alpha1Client opsV1alpha1 *opsv1alpha1.OpsV1alpha1Client securityV1alpha1 *securityv1alpha1.SecurityV1alpha1Client systemV1beta1 *systemv1beta1.SystemV1beta1Client @@ -57,6 +63,11 @@ func (c *Clientset) ClusterinformationV1beta1() clusterinformationv1beta1.Cluste return c.clusterinformationV1beta1 } +// ControlplaneV1alpha1 retrieves the ControlplaneV1alpha1Client +func (c *Clientset) ControlplaneV1alpha1() controlplanev1alpha1.ControlplaneV1alpha1Interface { + return c.controlplaneV1alpha1 +} + // ControlplaneV1beta1 retrieves the ControlplaneV1beta1Client func (c *Clientset) ControlplaneV1beta1() controlplanev1beta1.ControlplaneV1beta1Interface { return c.controlplaneV1beta1 @@ -67,6 +78,11 @@ func (c *Clientset) CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface { return c.coreV1alpha1 } +// MetricsV1alpha1 retrieves the MetricsV1alpha1Client +func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface { + return c.metricsV1alpha1 +} + // OpsV1alpha1 retrieves the OpsV1alpha1Client func (c *Clientset) OpsV1alpha1() opsv1alpha1.OpsV1alpha1Interface { return c.opsV1alpha1 @@ -107,6 +123,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.controlplaneV1alpha1, err = controlplanev1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.controlplaneV1beta1, err = controlplanev1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -115,6 +135,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.metricsV1alpha1, err = metricsv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.opsV1alpha1, err = opsv1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -140,8 +164,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.clusterinformationV1beta1 = clusterinformationv1beta1.NewForConfigOrDie(c) + cs.controlplaneV1alpha1 = controlplanev1alpha1.NewForConfigOrDie(c) cs.controlplaneV1beta1 = controlplanev1beta1.NewForConfigOrDie(c) cs.coreV1alpha1 = corev1alpha1.NewForConfigOrDie(c) + cs.metricsV1alpha1 = metricsv1alpha1.NewForConfigOrDie(c) cs.opsV1alpha1 = opsv1alpha1.NewForConfigOrDie(c) cs.securityV1alpha1 = securityv1alpha1.NewForConfigOrDie(c) cs.systemV1beta1 = systemv1beta1.NewForConfigOrDie(c) @@ -154,8 +180,10 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.clusterinformationV1beta1 = clusterinformationv1beta1.New(c) + cs.controlplaneV1alpha1 = controlplanev1alpha1.New(c) cs.controlplaneV1beta1 = controlplanev1beta1.New(c) cs.coreV1alpha1 = corev1alpha1.New(c) + cs.metricsV1alpha1 = metricsv1alpha1.New(c) cs.opsV1alpha1 = opsv1alpha1.New(c) cs.securityV1alpha1 = securityv1alpha1.New(c) cs.systemV1beta1 = systemv1beta1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 90ff91870be..79ee44c2748 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -20,10 +20,14 @@ import ( clientset "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned" clusterinformationv1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/clusterinformation/v1beta1" fakeclusterinformationv1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/clusterinformation/v1beta1/fake" + controlplanev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1alpha1" + fakecontrolplanev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake" controlplanev1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1beta1" fakecontrolplanev1beta1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1beta1/fake" corev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/core/v1alpha1" fakecorev1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/core/v1alpha1/fake" + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/metrics/v1alpha1" + fakemetricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake" opsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/ops/v1alpha1" fakeopsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/ops/v1alpha1/fake" securityv1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/security/v1alpha1" @@ -89,6 +93,11 @@ func (c *Clientset) ClusterinformationV1beta1() clusterinformationv1beta1.Cluste return &fakeclusterinformationv1beta1.FakeClusterinformationV1beta1{Fake: &c.Fake} } +// ControlplaneV1alpha1 retrieves the ControlplaneV1alpha1Client +func (c *Clientset) ControlplaneV1alpha1() controlplanev1alpha1.ControlplaneV1alpha1Interface { + return &fakecontrolplanev1alpha1.FakeControlplaneV1alpha1{Fake: &c.Fake} +} + // ControlplaneV1beta1 retrieves the ControlplaneV1beta1Client func (c *Clientset) ControlplaneV1beta1() controlplanev1beta1.ControlplaneV1beta1Interface { return &fakecontrolplanev1beta1.FakeControlplaneV1beta1{Fake: &c.Fake} @@ -99,6 +108,11 @@ func (c *Clientset) CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface { return &fakecorev1alpha1.FakeCoreV1alpha1{Fake: &c.Fake} } +// MetricsV1alpha1 retrieves the MetricsV1alpha1Client +func (c *Clientset) MetricsV1alpha1() metricsv1alpha1.MetricsV1alpha1Interface { + return &fakemetricsv1alpha1.FakeMetricsV1alpha1{Fake: &c.Fake} +} + // OpsV1alpha1 retrieves the OpsV1alpha1Client func (c *Clientset) OpsV1alpha1() opsv1alpha1.OpsV1alpha1Interface { return &fakeopsv1alpha1.FakeOpsV1alpha1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index d9079ca3179..d5d1015c1d4 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -18,8 +18,10 @@ package fake import ( clusterinformationv1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/clusterinformation/v1beta1" + controlplanev1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" controlplanev1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1" corev1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/core/v1alpha1" + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" opsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/ops/v1alpha1" securityv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/security/v1alpha1" systemv1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/system/v1beta1" @@ -35,8 +37,10 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ clusterinformationv1beta1.AddToScheme, + controlplanev1alpha1.AddToScheme, controlplanev1beta1.AddToScheme, corev1alpha1.AddToScheme, + metricsv1alpha1.AddToScheme, opsv1alpha1.AddToScheme, securityv1alpha1.AddToScheme, systemv1beta1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 9dd3e66f469..3df1758a0cd 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -18,8 +18,10 @@ package scheme import ( clusterinformationv1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/clusterinformation/v1beta1" + controlplanev1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" controlplanev1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1beta1" corev1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/core/v1alpha1" + metricsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" opsv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/ops/v1alpha1" securityv1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/security/v1alpha1" systemv1beta1 "github.com/vmware-tanzu/antrea/pkg/apis/system/v1beta1" @@ -35,8 +37,10 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ clusterinformationv1beta1.AddToScheme, + controlplanev1alpha1.AddToScheme, controlplanev1beta1.AddToScheme, corev1alpha1.AddToScheme, + metricsv1alpha1.AddToScheme, opsv1alpha1.AddToScheme, securityv1alpha1.AddToScheme, systemv1beta1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/controlplane_client.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/controlplane_client.go new file mode 100644 index 00000000000..dc26b5448a9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/controlplane_client.go @@ -0,0 +1,87 @@ +// Copyright 2020 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 ( + v1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" + "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type ControlplaneV1alpha1Interface interface { + RESTClient() rest.Interface + NodeStatsSummariesGetter +} + +// ControlplaneV1alpha1Client is used to interact with features provided by the controlplane.antrea.tanzu.vmware.com group. +type ControlplaneV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ControlplaneV1alpha1Client) NodeStatsSummaries() NodeStatsSummaryInterface { + return newNodeStatsSummaries(c) +} + +// NewForConfig creates a new ControlplaneV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ControlplaneV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ControlplaneV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ControlplaneV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ControlplaneV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ControlplaneV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ControlplaneV1alpha1Client { + return &ControlplaneV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ControlplaneV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/doc.go new file mode 100644 index 00000000000..16e4506b415 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 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. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..ed1b262831b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 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 has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_controlplane_client.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_controlplane_client.go new file mode 100644 index 00000000000..63b87d8f642 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_controlplane_client.go @@ -0,0 +1,38 @@ +// Copyright 2020 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 ( + v1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/controlplane/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeControlplaneV1alpha1 struct { + *testing.Fake +} + +func (c *FakeControlplaneV1alpha1) NodeStatsSummaries() v1alpha1.NodeStatsSummaryInterface { + return &FakeNodeStatsSummaries{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeControlplaneV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_nodestatssummary.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_nodestatssummary.go new file mode 100644 index 00000000000..71228605c9e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/fake/fake_nodestatssummary.go @@ -0,0 +1,45 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeNodeStatsSummaries implements NodeStatsSummaryInterface +type FakeNodeStatsSummaries struct { + Fake *FakeControlplaneV1alpha1 +} + +var nodestatssummariesResource = schema.GroupVersionResource{Group: "controlplane.antrea.tanzu.vmware.com", Version: "v1alpha1", Resource: "nodestatssummaries"} + +var nodestatssummariesKind = schema.GroupVersionKind{Group: "controlplane.antrea.tanzu.vmware.com", Version: "v1alpha1", Kind: "NodeStatsSummary"} + +// Create takes the representation of a nodeStatsSummary and creates it. Returns the server's representation of the nodeStatsSummary, and an error, if there is any. +func (c *FakeNodeStatsSummaries) Create(ctx context.Context, nodeStatsSummary *v1alpha1.NodeStatsSummary, opts v1.CreateOptions) (result *v1alpha1.NodeStatsSummary, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(nodestatssummariesResource, nodeStatsSummary), &v1alpha1.NodeStatsSummary{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NodeStatsSummary), err +} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..3e32b7a4d20 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/generated_expansion.go @@ -0,0 +1,19 @@ +// Copyright 2020 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 + +type NodeStatsSummaryExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/nodestatssummary.go b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/nodestatssummary.go new file mode 100644 index 00000000000..6109d681b21 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/controlplane/v1alpha1/nodestatssummary.go @@ -0,0 +1,62 @@ +// Copyright 2020 Antrea Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/controlplane/v1alpha1" + scheme "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// NodeStatsSummariesGetter has a method to return a NodeStatsSummaryInterface. +// A group's client should implement this interface. +type NodeStatsSummariesGetter interface { + NodeStatsSummaries() NodeStatsSummaryInterface +} + +// NodeStatsSummaryInterface has methods to work with NodeStatsSummary resources. +type NodeStatsSummaryInterface interface { + Create(ctx context.Context, nodeStatsSummary *v1alpha1.NodeStatsSummary, opts v1.CreateOptions) (*v1alpha1.NodeStatsSummary, error) + NodeStatsSummaryExpansion +} + +// nodeStatsSummaries implements NodeStatsSummaryInterface +type nodeStatsSummaries struct { + client rest.Interface +} + +// newNodeStatsSummaries returns a NodeStatsSummaries +func newNodeStatsSummaries(c *ControlplaneV1alpha1Client) *nodeStatsSummaries { + return &nodeStatsSummaries{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a nodeStatsSummary and creates it. Returns the server's representation of the nodeStatsSummary, and an error, if there is any. +func (c *nodeStatsSummaries) Create(ctx context.Context, nodeStatsSummary *v1alpha1.NodeStatsSummary, opts v1.CreateOptions) (result *v1alpha1.NodeStatsSummary, err error) { + result = &v1alpha1.NodeStatsSummary{} + err = c.client.Post(). + Resource("nodestatssummaries"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(nodeStatsSummary). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreaclusternetworkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreaclusternetworkpolicymetrics.go new file mode 100644 index 00000000000..ff069a67b27 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreaclusternetworkpolicymetrics.go @@ -0,0 +1,96 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + scheme "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AntreaClusterNetworkPolicyMetricsesGetter has a method to return a AntreaClusterNetworkPolicyMetricsInterface. +// A group's client should implement this interface. +type AntreaClusterNetworkPolicyMetricsesGetter interface { + AntreaClusterNetworkPolicyMetricses() AntreaClusterNetworkPolicyMetricsInterface +} + +// AntreaClusterNetworkPolicyMetricsInterface has methods to work with AntreaClusterNetworkPolicyMetrics resources. +type AntreaClusterNetworkPolicyMetricsInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.AntreaClusterNetworkPolicyMetrics, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AntreaClusterNetworkPolicyMetricsList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + AntreaClusterNetworkPolicyMetricsExpansion +} + +// antreaClusterNetworkPolicyMetricses implements AntreaClusterNetworkPolicyMetricsInterface +type antreaClusterNetworkPolicyMetricses struct { + client rest.Interface +} + +// newAntreaClusterNetworkPolicyMetricses returns a AntreaClusterNetworkPolicyMetricses +func newAntreaClusterNetworkPolicyMetricses(c *MetricsV1alpha1Client) *antreaClusterNetworkPolicyMetricses { + return &antreaClusterNetworkPolicyMetricses{ + client: c.RESTClient(), + } +} + +// Get takes name of the antreaClusterNetworkPolicyMetrics, and returns the corresponding antreaClusterNetworkPolicyMetrics object, and an error if there is any. +func (c *antreaClusterNetworkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaClusterNetworkPolicyMetrics, err error) { + result = &v1alpha1.AntreaClusterNetworkPolicyMetrics{} + err = c.client.Get(). + Resource("antreaclusternetworkpolicymetrics"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AntreaClusterNetworkPolicyMetricses that match those selectors. +func (c *antreaClusterNetworkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaClusterNetworkPolicyMetricsList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.AntreaClusterNetworkPolicyMetricsList{} + err = c.client.Get(). + Resource("antreaclusternetworkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested antreaClusterNetworkPolicyMetricses. +func (c *antreaClusterNetworkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("antreaclusternetworkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreanetworkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreanetworkpolicymetrics.go new file mode 100644 index 00000000000..b0d31b41f88 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/antreanetworkpolicymetrics.go @@ -0,0 +1,101 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + scheme "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AntreaNetworkPolicyMetricsesGetter has a method to return a AntreaNetworkPolicyMetricsInterface. +// A group's client should implement this interface. +type AntreaNetworkPolicyMetricsesGetter interface { + AntreaNetworkPolicyMetricses(namespace string) AntreaNetworkPolicyMetricsInterface +} + +// AntreaNetworkPolicyMetricsInterface has methods to work with AntreaNetworkPolicyMetrics resources. +type AntreaNetworkPolicyMetricsInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.AntreaNetworkPolicyMetrics, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AntreaNetworkPolicyMetricsList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + AntreaNetworkPolicyMetricsExpansion +} + +// antreaNetworkPolicyMetricses implements AntreaNetworkPolicyMetricsInterface +type antreaNetworkPolicyMetricses struct { + client rest.Interface + ns string +} + +// newAntreaNetworkPolicyMetricses returns a AntreaNetworkPolicyMetricses +func newAntreaNetworkPolicyMetricses(c *MetricsV1alpha1Client, namespace string) *antreaNetworkPolicyMetricses { + return &antreaNetworkPolicyMetricses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the antreaNetworkPolicyMetrics, and returns the corresponding antreaNetworkPolicyMetrics object, and an error if there is any. +func (c *antreaNetworkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaNetworkPolicyMetrics, err error) { + result = &v1alpha1.AntreaNetworkPolicyMetrics{} + err = c.client.Get(). + Namespace(c.ns). + Resource("antreanetworkpolicymetrics"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AntreaNetworkPolicyMetricses that match those selectors. +func (c *antreaNetworkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaNetworkPolicyMetricsList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.AntreaNetworkPolicyMetricsList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("antreanetworkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested antreaNetworkPolicyMetricses. +func (c *antreaNetworkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("antreanetworkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/doc.go new file mode 100644 index 00000000000..16e4506b415 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 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. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/doc.go new file mode 100644 index 00000000000..ed1b262831b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2020 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 has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreaclusternetworkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreaclusternetworkpolicymetrics.go new file mode 100644 index 00000000000..9f73898196d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreaclusternetworkpolicymetrics.go @@ -0,0 +1,74 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAntreaClusterNetworkPolicyMetricses implements AntreaClusterNetworkPolicyMetricsInterface +type FakeAntreaClusterNetworkPolicyMetricses struct { + Fake *FakeMetricsV1alpha1 +} + +var antreaclusternetworkpolicymetricsesResource = schema.GroupVersionResource{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Resource: "antreaclusternetworkpolicymetrics"} + +var antreaclusternetworkpolicymetricsesKind = schema.GroupVersionKind{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Kind: "AntreaClusterNetworkPolicyMetrics"} + +// Get takes name of the antreaClusterNetworkPolicyMetrics, and returns the corresponding antreaClusterNetworkPolicyMetrics object, and an error if there is any. +func (c *FakeAntreaClusterNetworkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaClusterNetworkPolicyMetrics, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(antreaclusternetworkpolicymetricsesResource, name), &v1alpha1.AntreaClusterNetworkPolicyMetrics{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AntreaClusterNetworkPolicyMetrics), err +} + +// List takes label and field selectors, and returns the list of AntreaClusterNetworkPolicyMetricses that match those selectors. +func (c *FakeAntreaClusterNetworkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaClusterNetworkPolicyMetricsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(antreaclusternetworkpolicymetricsesResource, antreaclusternetworkpolicymetricsesKind, opts), &v1alpha1.AntreaClusterNetworkPolicyMetricsList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.AntreaClusterNetworkPolicyMetricsList{ListMeta: obj.(*v1alpha1.AntreaClusterNetworkPolicyMetricsList).ListMeta} + for _, item := range obj.(*v1alpha1.AntreaClusterNetworkPolicyMetricsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested antreaClusterNetworkPolicyMetricses. +func (c *FakeAntreaClusterNetworkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(antreaclusternetworkpolicymetricsesResource, opts)) +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreanetworkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreanetworkpolicymetrics.go new file mode 100644 index 00000000000..f42bf10e9fb --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_antreanetworkpolicymetrics.go @@ -0,0 +1,78 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAntreaNetworkPolicyMetricses implements AntreaNetworkPolicyMetricsInterface +type FakeAntreaNetworkPolicyMetricses struct { + Fake *FakeMetricsV1alpha1 + ns string +} + +var antreanetworkpolicymetricsesResource = schema.GroupVersionResource{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Resource: "antreanetworkpolicymetrics"} + +var antreanetworkpolicymetricsesKind = schema.GroupVersionKind{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Kind: "AntreaNetworkPolicyMetrics"} + +// Get takes name of the antreaNetworkPolicyMetrics, and returns the corresponding antreaNetworkPolicyMetrics object, and an error if there is any. +func (c *FakeAntreaNetworkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AntreaNetworkPolicyMetrics, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(antreanetworkpolicymetricsesResource, c.ns, name), &v1alpha1.AntreaNetworkPolicyMetrics{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AntreaNetworkPolicyMetrics), err +} + +// List takes label and field selectors, and returns the list of AntreaNetworkPolicyMetricses that match those selectors. +func (c *FakeAntreaNetworkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AntreaNetworkPolicyMetricsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(antreanetworkpolicymetricsesResource, antreanetworkpolicymetricsesKind, c.ns, opts), &v1alpha1.AntreaNetworkPolicyMetricsList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.AntreaNetworkPolicyMetricsList{ListMeta: obj.(*v1alpha1.AntreaNetworkPolicyMetricsList).ListMeta} + for _, item := range obj.(*v1alpha1.AntreaNetworkPolicyMetricsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested antreaNetworkPolicyMetricses. +func (c *FakeAntreaNetworkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(antreanetworkpolicymetricsesResource, c.ns, opts)) + +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_metrics_client.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_metrics_client.go new file mode 100644 index 00000000000..8292ceaf4c6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_metrics_client.go @@ -0,0 +1,46 @@ +// Copyright 2020 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 ( + v1alpha1 "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/typed/metrics/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMetricsV1alpha1 struct { + *testing.Fake +} + +func (c *FakeMetricsV1alpha1) AntreaClusterNetworkPolicyMetricses() v1alpha1.AntreaClusterNetworkPolicyMetricsInterface { + return &FakeAntreaClusterNetworkPolicyMetricses{c} +} + +func (c *FakeMetricsV1alpha1) AntreaNetworkPolicyMetricses(namespace string) v1alpha1.AntreaNetworkPolicyMetricsInterface { + return &FakeAntreaNetworkPolicyMetricses{c, namespace} +} + +func (c *FakeMetricsV1alpha1) NetworkPolicyMetricses(namespace string) v1alpha1.NetworkPolicyMetricsInterface { + return &FakeNetworkPolicyMetricses{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMetricsV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_networkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_networkpolicymetrics.go new file mode 100644 index 00000000000..cdc7c3876d7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/fake/fake_networkpolicymetrics.go @@ -0,0 +1,78 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeNetworkPolicyMetricses implements NetworkPolicyMetricsInterface +type FakeNetworkPolicyMetricses struct { + Fake *FakeMetricsV1alpha1 + ns string +} + +var networkpolicymetricsesResource = schema.GroupVersionResource{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Resource: "networkpolicymetrics"} + +var networkpolicymetricsesKind = schema.GroupVersionKind{Group: "metrics.antrea.tanzu.vmware.com", Version: "v1alpha1", Kind: "NetworkPolicyMetrics"} + +// Get takes name of the networkPolicyMetrics, and returns the corresponding networkPolicyMetrics object, and an error if there is any. +func (c *FakeNetworkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkPolicyMetrics, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(networkpolicymetricsesResource, c.ns, name), &v1alpha1.NetworkPolicyMetrics{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NetworkPolicyMetrics), err +} + +// List takes label and field selectors, and returns the list of NetworkPolicyMetricses that match those selectors. +func (c *FakeNetworkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkPolicyMetricsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(networkpolicymetricsesResource, networkpolicymetricsesKind, c.ns, opts), &v1alpha1.NetworkPolicyMetricsList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.NetworkPolicyMetricsList{ListMeta: obj.(*v1alpha1.NetworkPolicyMetricsList).ListMeta} + for _, item := range obj.(*v1alpha1.NetworkPolicyMetricsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested networkPolicyMetricses. +func (c *FakeNetworkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(networkpolicymetricsesResource, c.ns, opts)) + +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/generated_expansion.go new file mode 100644 index 00000000000..3c476d1ae53 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/generated_expansion.go @@ -0,0 +1,23 @@ +// Copyright 2020 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 + +type AntreaClusterNetworkPolicyMetricsExpansion interface{} + +type AntreaNetworkPolicyMetricsExpansion interface{} + +type NetworkPolicyMetricsExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/metrics_client.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/metrics_client.go new file mode 100644 index 00000000000..b6b94a84fe3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/metrics_client.go @@ -0,0 +1,97 @@ +// Copyright 2020 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 ( + v1alpha1 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type MetricsV1alpha1Interface interface { + RESTClient() rest.Interface + AntreaClusterNetworkPolicyMetricsesGetter + AntreaNetworkPolicyMetricsesGetter + NetworkPolicyMetricsesGetter +} + +// MetricsV1alpha1Client is used to interact with features provided by the metrics.antrea.tanzu.vmware.com group. +type MetricsV1alpha1Client struct { + restClient rest.Interface +} + +func (c *MetricsV1alpha1Client) AntreaClusterNetworkPolicyMetricses() AntreaClusterNetworkPolicyMetricsInterface { + return newAntreaClusterNetworkPolicyMetricses(c) +} + +func (c *MetricsV1alpha1Client) AntreaNetworkPolicyMetricses(namespace string) AntreaNetworkPolicyMetricsInterface { + return newAntreaNetworkPolicyMetricses(c, namespace) +} + +func (c *MetricsV1alpha1Client) NetworkPolicyMetricses(namespace string) NetworkPolicyMetricsInterface { + return newNetworkPolicyMetricses(c, namespace) +} + +// NewForConfig creates a new MetricsV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*MetricsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MetricsV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new MetricsV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MetricsV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MetricsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *MetricsV1alpha1Client { + return &MetricsV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MetricsV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/metrics/v1alpha1/networkpolicymetrics.go b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/networkpolicymetrics.go new file mode 100644 index 00000000000..745533742a7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/metrics/v1alpha1/networkpolicymetrics.go @@ -0,0 +1,101 @@ +// Copyright 2020 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 "github.com/vmware-tanzu/antrea/pkg/apis/metrics/v1alpha1" + scheme "github.com/vmware-tanzu/antrea/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// NetworkPolicyMetricsesGetter has a method to return a NetworkPolicyMetricsInterface. +// A group's client should implement this interface. +type NetworkPolicyMetricsesGetter interface { + NetworkPolicyMetricses(namespace string) NetworkPolicyMetricsInterface +} + +// NetworkPolicyMetricsInterface has methods to work with NetworkPolicyMetrics resources. +type NetworkPolicyMetricsInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NetworkPolicyMetrics, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NetworkPolicyMetricsList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + NetworkPolicyMetricsExpansion +} + +// networkPolicyMetricses implements NetworkPolicyMetricsInterface +type networkPolicyMetricses struct { + client rest.Interface + ns string +} + +// newNetworkPolicyMetricses returns a NetworkPolicyMetricses +func newNetworkPolicyMetricses(c *MetricsV1alpha1Client, namespace string) *networkPolicyMetricses { + return &networkPolicyMetricses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the networkPolicyMetrics, and returns the corresponding networkPolicyMetrics object, and an error if there is any. +func (c *networkPolicyMetricses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NetworkPolicyMetrics, err error) { + result = &v1alpha1.NetworkPolicyMetrics{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkpolicymetrics"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NetworkPolicyMetricses that match those selectors. +func (c *networkPolicyMetricses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NetworkPolicyMetricsList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.NetworkPolicyMetricsList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("networkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested networkPolicyMetricses. +func (c *networkPolicyMetricses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("networkpolicymetrics"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} diff --git a/pkg/controller/networkpolicy/networkpolicy_controller.go b/pkg/controller/networkpolicy/networkpolicy_controller.go index 9d37072e776..4d44e1d0276 100644 --- a/pkg/controller/networkpolicy/networkpolicy_controller.go +++ b/pkg/controller/networkpolicy/networkpolicy_controller.go @@ -138,10 +138,10 @@ type NetworkPolicyController struct { networkPolicyListerSynced cache.InformerSynced cnpInformer secinformers.ClusterNetworkPolicyInformer - // cnpLister is able to list/get ClusterNetworkPolicies and is populated by the shared informer passed to + // cnpLister is able to list/get AntreaClusterNetworkPolicies and is populated by the shared informer passed to // NewClusterNetworkPolicyController. cnpLister seclisters.ClusterNetworkPolicyLister - // cnpListerSynced is a function which returns true if the ClusterNetworkPolicies shared informer has been synced at least once. + // cnpListerSynced is a function which returns true if the AntreaClusterNetworkPolicies shared informer has been synced at least once. cnpListerSynced cache.InformerSynced anpInformer secinformers.NetworkPolicyInformer diff --git a/test/e2e/k8s_util.go b/test/e2e/k8s_util.go index 98206c07169..f089916e1f4 100644 --- a/test/e2e/k8s_util.go +++ b/test/e2e/k8s_util.go @@ -242,14 +242,14 @@ func (k *KubernetesUtils) CreateOrUpdateNetworkPolicy(ns string, netpol *v1net.N return np, err } -// CleanCNPs is a convenience function for deleting ClusterNetworkPolicies before startup of any new test. +// CleanCNPs is a convenience function for deleting AntreaClusterNetworkPolicies before startup of any new test. func (k *KubernetesUtils) CleanCNPs() error { l, err := k.securityClient.ClusterNetworkPolicies().List(context.TODO(), metav1.ListOptions{}) if err != nil { - return errors.Wrapf(err, "unable to list ClusterNetworkPolicies") + return errors.Wrapf(err, "unable to list AntreaClusterNetworkPolicies") } for _, cnp := range l.Items { - log.Infof("deleting ClusterNetworkPolicies %s", cnp.Name) + log.Infof("deleting AntreaClusterNetworkPolicies %s", cnp.Name) err = k.securityClient.ClusterNetworkPolicies().Delete(context.TODO(), cnp.Name, metav1.DeleteOptions{}) if err != nil { return errors.Wrapf(err, "unable to delete ClusterNetworkPolicy %s", cnp.Name) @@ -258,7 +258,7 @@ func (k *KubernetesUtils) CleanCNPs() error { return nil } -// CreateOrUpdateCNP is a convenience function for updating/creating ClusterNetworkPolicies. +// CreateOrUpdateCNP is a convenience function for updating/creating AntreaClusterNetworkPolicies. func (k *KubernetesUtils) CreateOrUpdateCNP(cnp *secv1alpha1.ClusterNetworkPolicy) (*secv1alpha1.ClusterNetworkPolicy, error) { log.Infof("creating/updating ClusterNetworkPolicy %s", cnp.Name) cnpReturned, err := k.securityClient.ClusterNetworkPolicies().Get(context.TODO(), cnp.Name, metav1.GetOptions{})