Skip to content

Commit

Permalink
[Multicast] Add Multicast statistics API and controlplane stats API
Browse files Browse the repository at this point in the history
This PR adds a field MulticastStats for control-plane API NodeStatsSummary
and field MulticastGroupPodsMember for public statistics API group.

Signed-off-by: ceclinux <[email protected]>
  • Loading branch information
ceclinux committed Feb 24, 2022
1 parent 0ffcfc9 commit 2291d90
Show file tree
Hide file tree
Showing 22 changed files with 2,046 additions and 186 deletions.
10 changes: 10 additions & 0 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ type NodeStatsSummary struct {
AntreaClusterNetworkPolicies []NetworkPolicyStats
// The TrafficStats of Antrea NetworkPolicies collected from the Node.
AntreaNetworkPolicies []NetworkPolicyStats
// The stats related to multicast collected from the Node.
MulticastStats []MulticastStats
}

// MulticastStats contains the information for Multicast Groups that a pod has joined.
type MulticastStats struct {
Pod *PodReference

// List of multicast IPs that the pod has joined.
GroupJoinedList []IPAddress
}

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

Large diffs are not rendered by default.

11 changes: 11 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 @@ -313,6 +313,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"`
// List of PodMulticast statistics collected from the Node.
MulticastStats []MulticastStats `json:"multicastStats,omitempty" protobuf:"bytes,5,rep,name=multicastStats"`
}

// MulticastStats contains the information for Multicast Groups that a pod has joined.
type MulticastStats struct {
Pod *PodReference `json:"pod,omitempty" protobuf:"bytes,1,opt,name=pod"`

// List of multicast IPs that the pod has joined.
GroupJoinedList []IPAddress `json:"groupJoinedList,omitempty" protobuf:"bytes,2,rep,name=groupJoinedList"`
}

// 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.

39 changes: 39 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.

39 changes: 39 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{},
&MulticastGroupPodsMember{},
&MulticastGroupPodsMemberList{},
)
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

// MulticastGroupPodsMember contains the mapping between Multicast Group and Pods.
type MulticastGroupPodsMember struct {
metav1.TypeMeta
metav1.ObjectMeta

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

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

// MulticastGroupPodsMemberList is a list of MulticastGroupPodsMember.
type MulticastGroupPodsMemberList struct {
metav1.TypeMeta
metav1.ListMeta

// List of MulticastGroupPodsMember.
Items []MulticastGroupPodsMember
}

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

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

0 comments on commit 2291d90

Please sign in to comment.