From fa09e0568609e45e8ba34e5f6e79a56a0a2d0fd3 Mon Sep 17 00:00:00 2001 From: yangyang Date: Sun, 8 Oct 2023 14:42:14 +0800 Subject: [PATCH] fix envoy-max-heapsize not set Signed-off-by: yangyang --- internal/provisioner/controller/gateway.go | 4 ++++ internal/provisioner/model/model.go | 11 ++++++----- .../provisioner/objects/dataplane/dataplane_test.go | 5 +++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/internal/provisioner/controller/gateway.go b/internal/provisioner/controller/gateway.go index 0fd328566ad..baf1b39ddf3 100644 --- a/internal/provisioner/controller/gateway.go +++ b/internal/provisioner/controller/gateway.go @@ -361,6 +361,10 @@ func (r *gatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct contourModel.Spec.EnvoyBaseID = envoyParams.BaseID } + if envoyParams.OverloadMaxHeapSize > 0 { + contourModel.Spec.EnvoyMaxHeapSizeBytes = envoyParams.OverloadMaxHeapSize + } + } } diff --git a/internal/provisioner/model/model.go b/internal/provisioner/model/model.go index 0c925ecc1f9..cdb9d149297 100644 --- a/internal/provisioner/model/model.go +++ b/internal/provisioner/model/model.go @@ -38,11 +38,12 @@ func Default(namespace, name string) *Contour { Name: name, }, Spec: ContourSpec{ - ContourReplicas: 2, - EnvoyWorkloadType: WorkloadTypeDaemonSet, - EnvoyReplicas: 2, // ignored if not provisioning Envoy as a deployment. - EnvoyLogLevel: contourv1alpha1.InfoLog, - EnvoyBaseID: 0, + ContourReplicas: 2, + EnvoyWorkloadType: WorkloadTypeDaemonSet, + EnvoyReplicas: 2, // ignored if not provisioning Envoy as a deployment. + EnvoyLogLevel: contourv1alpha1.InfoLog, + EnvoyBaseID: 0, + EnvoyMaxHeapSizeBytes: 0, NetworkPublishing: NetworkPublishing{ Envoy: EnvoyNetworkPublishing{ Type: LoadBalancerServicePublishingType, diff --git a/internal/provisioner/objects/dataplane/dataplane_test.go b/internal/provisioner/objects/dataplane/dataplane_test.go index da5449b7bbf..c6918500d5e 100644 --- a/internal/provisioner/objects/dataplane/dataplane_test.go +++ b/internal/provisioner/objects/dataplane/dataplane_test.go @@ -290,6 +290,7 @@ func TestDesiredDaemonSet(t *testing.T) { testEnvoyImage := "docker.io/envoyproxy/envoy:test" testLogLevelArg := "--log-level debug" testBaseIDArg := "--base-id 1" + testEnvoyMaxHeapSize := "--overload-max-heap=8000000000" resQutoa := corev1.ResourceRequirements{ Limits: corev1.ResourceList{ @@ -315,6 +316,8 @@ func TestDesiredDaemonSet(t *testing.T) { // Change the Envoy base id to test --base-id 1 cntr.Spec.EnvoyBaseID = 1 + cntr.Spec.EnvoyMaxHeapSizeBytes = 8000000000 + ds := DesiredDaemonSet(cntr, testContourImage, testEnvoyImage) container := checkDaemonSetHasContainer(t, ds, EnvoyContainerName, true) checkContainerHasArg(t, container, testLogLevelArg) @@ -330,6 +333,8 @@ func TestDesiredDaemonSet(t *testing.T) { checkContainerHaveResourceRequirements(t, container) checkContainerHasImage(t, container, testContourImage) + checkContainerHasArg(t, container, testEnvoyMaxHeapSize) + checkDaemonSetHasEnvVar(t, ds, EnvoyContainerName, envoyNsEnvVar) checkDaemonSetHasEnvVar(t, ds, EnvoyContainerName, envoyPodEnvVar) checkDaemonSetHasEnvVar(t, ds, envoyInitContainerName, envoyNsEnvVar)