Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Multicast] Add Multicast statistics API #3354

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,16 @@ type NodeStatsSummary struct {
AntreaClusterNetworkPolicies []NetworkPolicyStats
// The TrafficStats of Antrea NetworkPolicies collected from the Node.
AntreaNetworkPolicies []NetworkPolicyStats
// Multicast group information from the Node.
Multicast []MulticastGroupInfo
}

// MulticastGroupInfo contains the list of Pods that have joined a multicast group, for a given Node.
type MulticastGroupInfo struct {
// Group is the IP of the multicast group.
Group string
// Pods is the list of Pods that have joined the multicast group.
Pods []PodReference
}

// NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy.
Expand Down
573 changes: 429 additions & 144 deletions pkg/apis/controlplane/v1beta2/generated.pb.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions pkg/apis/controlplane/v1beta2/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/apis/controlplane/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ type NodeStatsSummary struct {
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"`
// Multicast group information collected from the Node.
Multicast []MulticastGroupInfo `json:"multicast,omitempty" protobuf:"bytes,5,rep,name=multicast"`
}

// MulticastGroupInfo contains the list of Pods that have joined a multicast group, for a given Node.
type MulticastGroupInfo struct {
// Group is the IP of the multicast group.
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
// Pods is the list of Pods that have joined the multicast group.
Pods []PodReference `json:"pods,omitempty" protobuf:"bytes,2,rep,name=pods"`
}

// NetworkPolicyStats contains the information and traffic stats of a NetworkPolicy.
Expand Down
34 changes: 34 additions & 0 deletions pkg/apis/controlplane/v1beta2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions pkg/apis/controlplane/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions pkg/apis/controlplane/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/apis/stats/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&AntreaNetworkPolicyStatsList{},
&NetworkPolicyStats{},
&NetworkPolicyStatsList{},
&MulticastGroup{},
&MulticastGroupList{},
)
return nil
}
32 changes: 32 additions & 0 deletions pkg/apis/stats/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,38 @@ type AntreaNetworkPolicyStatsList struct {
Items []AntreaNetworkPolicyStats
}

// PodReference represents a Pod Reference.
type PodReference struct {
// The name of this Pod.
Name string
// The namespace of this Pod.
Namespace string
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MulticastGroup contains the mapping between multicast group and Pods.
type MulticastGroup struct {
metav1.TypeMeta
metav1.ObjectMeta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use standard K8s API for this, what would be the name of the object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the the name of the object would be same as group IP

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also think it is not necessary to have a single field for name also namespace.


// Group is the IP of the multicast group.
Group string
// Pods is the list of Pods that have joined the multicast group.
Pods []PodReference
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MulticastGroupList is a list of MulticastGroup.
type MulticastGroupList struct {
metav1.TypeMeta
metav1.ListMeta

// List of MulticastGroup.
Items []MulticastGroup
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NetworkPolicyStats is the statistics of a K8s NetworkPolicy.
Expand Down
Loading