From b868de55cb94e3434aae2bd529a58e549ff22b74 Mon Sep 17 00:00:00 2001 From: graysonwu Date: Mon, 22 May 2023 11:45:04 -0700 Subject: [PATCH] diff setup Signed-off-by: graysonwu --- batch_mcnp_pt.sh | 5 +++-- build/charts/antrea/values.yaml | 10 ++++++++++ build/yamls/antrea-aks.yml | 8 ++++++++ build/yamls/antrea-eks.yml | 8 ++++++++ build/yamls/antrea-gke.yml | 8 ++++++++ build/yamls/antrea-ipsec.yml | 10 ++++++++++ build/yamls/antrea.yml | 8 ++++++++ mcnp_performance_test.sh | 6 ++++-- .../yamls/antrea-multicluster-leader-namespaced.yml | 2 ++ .../build/yamls/antrea-multicluster-member.yml | 2 ++ multicluster/cmd/multicluster-controller/controller.go | 2 ++ .../multicluster/commonarea/remote_common_area.go | 3 ++- .../leader/labelidentity_export_controller.go | 4 ++-- .../multicluster/member/labelidentity_controller.go | 4 ++-- .../member/labelidentity_import_controller.go | 3 +-- 15 files changed, 72 insertions(+), 11 deletions(-) diff --git a/batch_mcnp_pt.sh b/batch_mcnp_pt.sh index 1c265bd3399..6a6f1c88535 100644 --- a/batch_mcnp_pt.sh +++ b/batch_mcnp_pt.sh @@ -3,9 +3,10 @@ START=$1 END=$2 STEP=$3 +POD_SHARE_ID=$4 for ((i=$START;i<=$END;i+=$STEP)) do - bash mcnp_performance_test.sh 1 $i - sleep 60 + sleep 30 + bash mcnp_performance_test.sh 1 $i $POD_SHARE_ID done diff --git a/build/charts/antrea/values.yaml b/build/charts/antrea/values.yaml index aaaef299754..22a6f17a4e7 100644 --- a/build/charts/antrea/values.yaml +++ b/build/charts/antrea/values.yaml @@ -218,6 +218,8 @@ agent: resources: requests: cpu: "100m" + limits: + cpu: "100m" antreaAgent: # -- Extra environment variables to be injected into antrea-agent. extraEnv: {} @@ -233,6 +235,8 @@ agent: resources: requests: cpu: "200m" + limits: + cpu: "200m" antreaOVS: # -- Max size in MBs of any single log file. logFileMaxSize: 100 @@ -244,12 +248,16 @@ agent: resources: requests: cpu: "200m" + limits: + cpu: "200m" antreaIPsec: # -- Resource requests and limits for the antrea-ipsec container (when IPsec # is enabled). resources: requests: cpu: "50m" + limits: + cpu: "50m" controller: # -- Port for the antrea-controller APIServer to serve on. @@ -297,6 +305,8 @@ controller: resources: requests: cpu: "200m" + limits: + cpu: "200m" flowCollector: # -- IPFIX collector address as a string with format :[][:]. diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index 295b1b695a6..38455286153 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -4388,6 +4388,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 100m requests: cpu: 100m command: ["install_cni_chaining"] @@ -4445,6 +4447,8 @@ spec: fieldRef: fieldPath: spec.nodeName resources: + limits: + cpu: 200m requests: cpu: 200m ports: @@ -4514,6 +4518,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["start_ovs"] @@ -4627,6 +4633,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["antrea-controller"] diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index bafb9450370..c3415126434 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -4387,6 +4387,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 100m requests: cpu: 100m command: ["install_cni_chaining"] @@ -4446,6 +4448,8 @@ spec: - name: "ANTREA_CLOUD_EKS" value: "true" resources: + limits: + cpu: 200m requests: cpu: 200m ports: @@ -4515,6 +4519,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["start_ovs"] @@ -4628,6 +4634,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["antrea-controller"] diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index a6c0e508494..98581d5e131 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -4386,6 +4386,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 100m requests: cpu: 100m command: ["install_cni"] @@ -4443,6 +4445,8 @@ spec: fieldRef: fieldPath: spec.nodeName resources: + limits: + cpu: 200m requests: cpu: 200m ports: @@ -4512,6 +4516,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["start_ovs"] @@ -4625,6 +4631,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["antrea-controller"] diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index 0db8c87cf57..530d4e6a20f 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -4400,6 +4400,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 100m requests: cpu: 100m command: ["install_cni"] @@ -4463,6 +4465,8 @@ spec: name: antrea-ipsec key: psk resources: + limits: + cpu: 200m requests: cpu: 200m ports: @@ -4535,6 +4539,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["start_ovs"] @@ -4572,6 +4578,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 50m requests: cpu: 50m command: ["start_ovs_ipsec"] @@ -4684,6 +4692,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["antrea-controller"] diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 9c6cc68528a..976a3a40169 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -4386,6 +4386,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 100m requests: cpu: 100m command: ["install_cni"] @@ -4443,6 +4445,8 @@ spec: fieldRef: fieldPath: spec.nodeName resources: + limits: + cpu: 200m requests: cpu: 200m ports: @@ -4512,6 +4516,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["start_ovs"] @@ -4625,6 +4631,8 @@ spec: image: "antrea/antrea-ubuntu:latest" imagePullPolicy: IfNotPresent resources: + limits: + cpu: 200m requests: cpu: 200m command: ["antrea-controller"] diff --git a/mcnp_performance_test.sh b/mcnp_performance_test.sh index 8f2739d3f70..d45f00ee746 100644 --- a/mcnp_performance_test.sh +++ b/mcnp_performance_test.sh @@ -17,8 +17,10 @@ SERVER_CLUSTER="kind-east" NS_NUM=$1 CLIENT_POD_NUM=$2 +POD_SHARE_ID=$3 TOTAL_CLIENT_POD_NUM=$((NS_NUM*CLIENT_POD_NUM)) + client_agent_names=() server_agent_names=() label_id_tracker=() @@ -50,7 +52,7 @@ metadata: name: ${POD_NAME_PREFIX}${j} namespace: ${NS_NAME_PREFIX}${i} labels: - ${POD_LABEL_KEY}: ${ORI_LABEL_PREFIX}${i}-${j} + ${POD_LABEL_KEY}: ${ORI_LABEL_PREFIX}${i}-$(((j-1)/POD_SHARE_ID)) spec: containers: - name: agc @@ -170,7 +172,7 @@ function get_policy_update_timestamps { do for agent_name in "${server_agent_names[@]}" do - target_log=$(kubectl logs -n kube-system -c antrea-agent "${agent_name}" --context "${SERVER_CLUSTER}" --timestamps --since_time "${time_since}" | grep "Num of LabelIdentity: ${TOTAL_CLIENT_POD_NUM} ." | tail -1) + target_log=$(kubectl logs -n kube-system -c antrea-agent "${agent_name}" --context "${SERVER_CLUSTER}" --timestamps --since_time "${time_since}" | grep "Num of LabelIdentity: $((TOTAL_CLIENT_POD_NUM/POD_SHARE_ID)) ." | tail -1) if [[ "${target_log}" != "" ]]; then end_timestamps=$(get_timestamps_from_log "$target_log") break diff --git a/multicluster/build/yamls/antrea-multicluster-leader-namespaced.yml b/multicluster/build/yamls/antrea-multicluster-leader-namespaced.yml index ad04e65cc71..8368fc9de22 100644 --- a/multicluster/build/yamls/antrea-multicluster-leader-namespaced.yml +++ b/multicluster/build/yamls/antrea-multicluster-leader-namespaced.yml @@ -401,6 +401,8 @@ spec: resources: requests: cpu: 200m + limits: + cpu: 200m securityContext: allowPrivilegeEscalation: false volumeMounts: diff --git a/multicluster/build/yamls/antrea-multicluster-member.yml b/multicluster/build/yamls/antrea-multicluster-member.yml index 8615b550a87..8e7c65eb041 100644 --- a/multicluster/build/yamls/antrea-multicluster-member.yml +++ b/multicluster/build/yamls/antrea-multicluster-member.yml @@ -1150,6 +1150,8 @@ spec: resources: requests: cpu: 200m + limits: + cpu: 200m securityContext: allowPrivilegeEscalation: false volumeMounts: diff --git a/multicluster/cmd/multicluster-controller/controller.go b/multicluster/cmd/multicluster-controller/controller.go index f27f108c766..8f9a8937254 100644 --- a/multicluster/cmd/multicluster-controller/controller.go +++ b/multicluster/cmd/multicluster-controller/controller.go @@ -134,6 +134,8 @@ func setupManagerAndCertController(isLeader bool, o *Options) (manager.Manager, // build up cert controller to manage certificate for MC Controller k8sConfig := ctrl.GetConfigOrDie() + k8sConfig.QPS = 200 + k8sConfig.Burst = 400 client, aggregatorClient, apiExtensionClient, err := createClients(k8sConfig) if err != nil { return nil, fmt.Errorf("error creating K8s clients: %v", err) diff --git a/multicluster/controllers/multicluster/commonarea/remote_common_area.go b/multicluster/controllers/multicluster/commonarea/remote_common_area.go index f49336a4603..7a1f6a4b6d7 100644 --- a/multicluster/controllers/multicluster/commonarea/remote_common_area.go +++ b/multicluster/controllers/multicluster/commonarea/remote_common_area.go @@ -148,7 +148,8 @@ func GetRemoteConfigAndClient(secretObj *v1.Secret, url string, clusterID common } config.BearerToken = string(token) config.CAData = crtData - + config.QPS = 200 + config.Burst = 400 remoteCommonAreaMgr, err := ctrl.NewManager(config, ctrl.Options{ Scheme: scheme, MetricsBindAddress: "0", diff --git a/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go b/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go index 886860817db..7a52601f102 100644 --- a/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go +++ b/multicluster/controllers/multicluster/leader/labelidentity_export_controller.go @@ -123,7 +123,7 @@ func (r *LabelIdentityExportReconciler) SetupWithManager(mgr ctrl.Manager) error For(&mcsv1alpha1.ResourceExport{}). WithEventFilter(instance). WithOptions(controller.Options{ - MaxConcurrentReconciles: common.DefaultWorkerCount, + MaxConcurrentReconciles: 50, }). Complete(r) } @@ -175,7 +175,7 @@ func (r *LabelIdentityExportReconciler) onLabelExportAdd(clusterID, labelHash, l func (r *LabelIdentityExportReconciler) Run(stopCh <-chan struct{}) { defer r.labelQueue.ShutDown() - for i := 0; i < common.DefaultWorkerCount; i++ { + for i := 0; i < 50; i++ { go wait.Until(r.labelQueueWorker, time.Second, stopCh) } <-stopCh diff --git a/multicluster/controllers/multicluster/member/labelidentity_controller.go b/multicluster/controllers/multicluster/member/labelidentity_controller.go index ddde0939e33..c70bb94bc85 100644 --- a/multicluster/controllers/multicluster/member/labelidentity_controller.go +++ b/multicluster/controllers/multicluster/member/labelidentity_controller.go @@ -136,7 +136,7 @@ func (r *LabelIdentityReconciler) SetupWithManager(mgr ctrl.Manager) error { handler.EnqueueRequestsFromMapFunc(r.namespaceMapFunc), builder.WithPredicates(predicate.LabelChangedPredicate{})). WithOptions(controller.Options{ - MaxConcurrentReconciles: common.DefaultWorkerCount, + MaxConcurrentReconciles: 50, }). Complete(r) } @@ -213,7 +213,7 @@ func (r *LabelIdentityReconciler) onPodCreateOrUpdate(podNamespacedName, current func (r *LabelIdentityReconciler) Run(stopCh <-chan struct{}) { defer r.labelQueue.ShutDown() - for i := 0; i < common.DefaultWorkerCount; i++ { + for i := 0; i < 50; i++ { go wait.Until(r.labelQueueWorker, time.Second, stopCh) } <-stopCh diff --git a/multicluster/controllers/multicluster/member/labelidentity_import_controller.go b/multicluster/controllers/multicluster/member/labelidentity_import_controller.go index 18179820479..46176670c35 100644 --- a/multicluster/controllers/multicluster/member/labelidentity_import_controller.go +++ b/multicluster/controllers/multicluster/member/labelidentity_import_controller.go @@ -31,7 +31,6 @@ import ( "antrea.io/antrea/multicluster/apis/multicluster/constants" multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1" - "antrea.io/antrea/multicluster/controllers/multicluster/common" "antrea.io/antrea/multicluster/controllers/multicluster/commonarea" ) @@ -148,7 +147,7 @@ func (r *LabelIdentityResourceImportReconciler) SetupWithManager(mgr ctrl.Manage For(&multiclusterv1alpha1.ResourceImport{}). WithEventFilter(instance). WithOptions(controller.Options{ - MaxConcurrentReconciles: common.DefaultWorkerCount, + MaxConcurrentReconciles: 50, }). Complete(r)