Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Dyanngg <dingyang@vmware.com>
  • Loading branch information
Dyanngg committed May 10, 2023
1 parent cfe8582 commit 686d124
Show file tree
Hide file tree
Showing 24 changed files with 612 additions and 742 deletions.
22 changes: 16 additions & 6 deletions cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
genericoptions "k8s.io/apiserver/pkg/server/options"
"k8s.io/client-go/informers"
csrinformers "k8s.io/client-go/informers/certificates/v1"
coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
csrlisters "k8s.io/client-go/listers/certificates/v1"
"k8s.io/client-go/tools/cache"
Expand All @@ -44,6 +45,7 @@ import (
"antrea.io/antrea/pkg/apiserver/openapi"
"antrea.io/antrea/pkg/apiserver/storage"
crdinformers "antrea.io/antrea/pkg/client/informers/externalversions"
crdv1a2informers "antrea.io/antrea/pkg/client/informers/externalversions/crd/v1alpha2"
"antrea.io/antrea/pkg/clusteridentity"
"antrea.io/antrea/pkg/controller/certificatesigningrequest"
"antrea.io/antrea/pkg/controller/egress"
Expand Down Expand Up @@ -140,6 +142,14 @@ func run(o *Options) error {
externalIPPoolInformer := crdInformerFactory.Crd().V1alpha2().ExternalIPPools()
externalNodeInformer := crdInformerFactory.Crd().V1alpha1().ExternalNodes()

// Add IP-Pod index. Each Pod has no more than 2 IPs, the extra overhead is constant and acceptable.
// @tnqn evaluated the performance without/with IP index is 3us vs 4us per pod, i.e. 300ms vs 400ms for 100k Pods.
podInformer.Informer().AddIndexers(cache.Indexers{grouping.PodIPsIndex: grouping.PodIPsIndexFunc})

if features.DefaultFeatureGate.Enabled(features.AntreaPolicy) {
eeInformer.Informer().AddIndexers(cache.Indexers{grouping.ExternalEntityIPsIndex: grouping.ExternalEntityIndexFunc})
}

clusterIdentityAllocator := clusteridentity.NewClusterIdentityAllocator(
env.GetAntreaNamespace(),
clusteridentity.DefaultClusterIdentityConfigMapName,
Expand Down Expand Up @@ -269,12 +279,12 @@ func run(o *Options) error {
networkPolicyStore,
egressGroupStore,
bundleCollectionStore,
podInformer,
eeInformer,
controllerQuerier,
endpointQuerier,
networkPolicyController,
networkPolicyStatusController,
groupEntityController,
traceflowController,
egressController,
statsAggregator,
bundleCollectionController,
Expand Down Expand Up @@ -454,12 +464,12 @@ func createAPIServerConfig(kubeconfig string,
networkPolicyStore storage.Interface,
egressGroupStore storage.Interface,
supportBundleCollectionStore storage.Interface,
podInformer coreinformers.PodInformer,
eeInformer crdv1a2informers.ExternalEntityInformer,
controllerQuerier querier.ControllerQuerier,
endpointQuerier networkpolicy.EndpointQuerier,
npController *networkpolicy.NetworkPolicyController,
networkPolicyStatusController *networkpolicy.StatusController,
groupingController *grouping.GroupEntityController,
traceflowController *traceflow.Controller,
egressController *egress.EgressController,
statsAggregator *stats.Aggregator,
bundleCollectionStore *supportbundlecollection.Controller,
Expand Down Expand Up @@ -520,14 +530,14 @@ func createAPIServerConfig(kubeconfig string,
networkPolicyStore,
egressGroupStore,
supportBundleCollectionStore,
podInformer,
eeInformer,
caCertController,
statsAggregator,
controllerQuerier,
networkPolicyStatusController,
endpointQuerier,
npController,
groupingController,
traceflowController,
egressController,
bundleCollectionStore), nil
}
2 changes: 1 addition & 1 deletion pkg/apis/controlplane/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ClusterGroupMembers{},
&PaginationGetOptions{},
&GroupAssociation{},
&IPAssociation{},
&IPGroupAssociation{},
&EgressGroup{},
&EgressGroupPatch{},
&EgressGroupList{},
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ type GroupAssociation struct {

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

// IPAssociation is a list of GroupReferences for responses to IP association queries.
type IPAssociation struct {
// IPGroupAssociation is a list of GroupReferences for responses to IP association queries.
type IPGroupAssociation struct {
metav1.TypeMeta
metav1.ObjectMeta
// AssociatedGroups is a list of GroupReferences that is associated with the
Expand Down
488 changes: 244 additions & 244 deletions pkg/apis/controlplane/v1beta2/generated.pb.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pkg/apis/controlplane/v1beta2/generated.proto

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

2 changes: 1 addition & 1 deletion pkg/apis/controlplane/v1beta2/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ClusterGroupMembers{},
&PaginationGetOptions{},
&GroupAssociation{},
&IPAssociation{},
&IPGroupAssociation{},
&EgressGroup{},
&EgressGroupPatch{},
&EgressGroupList{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/controlplane/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ type GroupAssociation struct {
// +genclient:onlyVerbs=get
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type IPAssociation struct {
type IPGroupAssociation struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// AssociatedGroups is a list of GroupReferences that is associated with the
Expand Down
60 changes: 30 additions & 30 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.

58 changes: 29 additions & 29 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.

Loading

0 comments on commit 686d124

Please sign in to comment.