Skip to content
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
4 changes: 4 additions & 0 deletions internal/provisioner/controller/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

}
}

Expand Down
50 changes: 50 additions & 0 deletions internal/provisioner/controller/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,56 @@ func TestGatewayReconcile(t *testing.T) {
},
},

"If ContourDeployment.Spec.Envoy.OverloadMaxHeapSize is specified, the envoy-initconfig container's arguments contain --overload-max-heap": {
gatewayClass: reconcilableGatewayClassWithParams("gatewayclass-1", controller),
gatewayClassParams: &contourv1alpha1.ContourDeployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: "projectcontour",
Name: "gatewayclass-1-params",
},
Spec: contourv1alpha1.ContourDeploymentSpec{
Envoy: &contourv1alpha1.EnvoySettings{
OverloadMaxHeapSize: 10000000,
},
},
},
gateway: makeGateway(),
assertions: func(t *testing.T, r *gatewayReconciler, gw *gatewayv1beta1.Gateway, reconcileErr error) {
ds := &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: "gateway-1",
Name: "envoy-gateway-1",
},
}
require.NoError(t, r.client.Get(context.Background(), keyFor(ds), ds))
assert.Contains(t, ds.Spec.Template.Spec.InitContainers[0].Args, "--overload-max-heap=10000000")
},
},

"If ContourDeployment.Spec.Envoy.OverloadMaxHeapSize is not specified, the envoy-initconfig container's arguments contain --overload-max-heap=0": {
gatewayClass: reconcilableGatewayClassWithParams("gatewayclass-1", controller),
gatewayClassParams: &contourv1alpha1.ContourDeployment{
ObjectMeta: metav1.ObjectMeta{
Namespace: "projectcontour",
Name: "gatewayclass-1-params",
},
Spec: contourv1alpha1.ContourDeploymentSpec{
Envoy: &contourv1alpha1.EnvoySettings{},
},
},
gateway: makeGateway(),
assertions: func(t *testing.T, r *gatewayReconciler, gw *gatewayv1beta1.Gateway, reconcileErr error) {
ds := &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Namespace: "gateway-1",
Name: "envoy-gateway-1",
},
}
require.NoError(t, r.client.Get(context.Background(), keyFor(ds), ds))
assert.Contains(t, ds.Spec.Template.Spec.InitContainers[0].Args, "--overload-max-heap=0")
},
},

"If ContourDeployment.Spec.Contour.PodAnnotations is specified, the Contour pods' have annotations for prometheus & user-defined": {
gatewayClass: reconcilableGatewayClassWithParams("gatewayclass-1", controller),
gatewayClassParams: &contourv1alpha1.ContourDeployment{
Expand Down
11 changes: 6 additions & 5 deletions internal/provisioner/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions internal/provisioner/objects/dataplane/dataplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand All @@ -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)
Expand Down