Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provisioner: add field overloadMaxHeapSize for envoy #5699

Merged
merged 3 commits into from
Sep 21, 2023
Merged
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
9 changes: 9 additions & 0 deletions apis/projectcontour/v1alpha1/contourdeployment.go
Original file line number Diff line number Diff line change
@@ -215,6 +215,15 @@ type EnvoySettings struct {
// +kubebuilder:validation:Minimum=0
// +optional
BaseID int32 `json:"baseID,omitempty"`

// OverloadMaxHeapSize defines the maximum heap memory of the envoy controlled by the overload manager.
// When the value is greater than 0, the overload manager is enabled,
// and when envoy reaches 95% of the maximum heap size, it performs a shrink heap operation,
// When it reaches 98% of the maximum heap size, Envoy Will stop accepting requests.
// More info: https://projectcontour.io/docs/main/config/overload-manager/
//
// +optional
OverloadMaxHeapSize uint64 `json:"overloadMaxHeapSize,omitempty"`
}

// WorkloadType is the type of Kubernetes workload to use for a component.
1 change: 1 addition & 0 deletions changelogs/unreleased/5699-yangyy93-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gateway provisioner: Add the `overloadMaxHeapSize` configuration option to contourDeployment to allow adding [overloadManager](https://projectcontour.io/docs/main/config/overload-manager/) configuration when generating envoy's initial configuration file.
9 changes: 9 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
@@ -3381,6 +3381,15 @@ spec:
type: object
type: array
type: object
overloadMaxHeapSize:
description: 'OverloadMaxHeapSize defines the maximum heap memory
of the envoy controlled by the overload manager. When the value
is greater than 0, the overload manager is enabled, and when
envoy reaches 95% of the maximum heap size, it performs a shrink
heap operation, When it reaches 98% of the maximum heap size,
Envoy Will stop accepting requests. More info: https://projectcontour.io/docs/main/config/overload-manager/'
format: int64
type: integer
podAnnotations:
additionalProperties:
type: string
9 changes: 9 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
@@ -3600,6 +3600,15 @@ spec:
type: object
type: array
type: object
overloadMaxHeapSize:
description: 'OverloadMaxHeapSize defines the maximum heap memory
of the envoy controlled by the overload manager. When the value
is greater than 0, the overload manager is enabled, and when
envoy reaches 95% of the maximum heap size, it performs a shrink
heap operation, When it reaches 98% of the maximum heap size,
Envoy Will stop accepting requests. More info: https://projectcontour.io/docs/main/config/overload-manager/'
format: int64
type: integer
podAnnotations:
additionalProperties:
type: string
9 changes: 9 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
@@ -3395,6 +3395,15 @@ spec:
type: object
type: array
type: object
overloadMaxHeapSize:
description: 'OverloadMaxHeapSize defines the maximum heap memory
of the envoy controlled by the overload manager. When the value
is greater than 0, the overload manager is enabled, and when
envoy reaches 95% of the maximum heap size, it performs a shrink
heap operation, When it reaches 98% of the maximum heap size,
Envoy Will stop accepting requests. More info: https://projectcontour.io/docs/main/config/overload-manager/'
format: int64
type: integer
podAnnotations:
additionalProperties:
type: string
9 changes: 9 additions & 0 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
@@ -3606,6 +3606,15 @@ spec:
type: object
type: array
type: object
overloadMaxHeapSize:
description: 'OverloadMaxHeapSize defines the maximum heap memory
of the envoy controlled by the overload manager. When the value
is greater than 0, the overload manager is enabled, and when
envoy reaches 95% of the maximum heap size, it performs a shrink
heap operation, When it reaches 98% of the maximum heap size,
Envoy Will stop accepting requests. More info: https://projectcontour.io/docs/main/config/overload-manager/'
format: int64
type: integer
podAnnotations:
additionalProperties:
type: string
9 changes: 9 additions & 0 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
@@ -3600,6 +3600,15 @@ spec:
type: object
type: array
type: object
overloadMaxHeapSize:
description: 'OverloadMaxHeapSize defines the maximum heap memory
of the envoy controlled by the overload manager. When the value
is greater than 0, the overload manager is enabled, and when
envoy reaches 95% of the maximum heap size, it performs a shrink
heap operation, When it reaches 98% of the maximum heap size,
Envoy Will stop accepting requests. More info: https://projectcontour.io/docs/main/config/overload-manager/'
format: int64
type: integer
podAnnotations:
additionalProperties:
type: string
5 changes: 5 additions & 0 deletions internal/provisioner/model/model.go
Original file line number Diff line number Diff line change
@@ -231,6 +231,11 @@ type ContourSpec struct {
// so that the shared memory regions do not conflict.
// defaults to 0.
EnvoyBaseID int32

// MaximumHeapSizeBytes defines how much memory the overload manager controls Envoy to allocate at most.
// If the value is 0, the overload manager is disabled.
// defaults to 0.
EnvoyMaxHeapSizeBytes uint64
}

// WorkloadType is the type of Kubernetes workload to use for a component.
1 change: 1 addition & 0 deletions internal/provisioner/objects/dataplane/dataplane.go
Original file line number Diff line number Diff line change
@@ -295,6 +295,7 @@ func desiredContainers(contour *model.Contour, contourImage, envoyImage string)
fmt.Sprintf("--envoy-cafile=%s", filepath.Join("/", envoyCertsVolMntDir, "ca.crt")),
fmt.Sprintf("--envoy-cert-file=%s", filepath.Join("/", envoyCertsVolMntDir, "tls.crt")),
fmt.Sprintf("--envoy-key-file=%s", filepath.Join("/", envoyCertsVolMntDir, "tls.key")),
fmt.Sprintf("--overload-max-heap=%d", contour.Spec.EnvoyMaxHeapSizeBytes),
},
VolumeMounts: []corev1.VolumeMount{
{
17 changes: 17 additions & 0 deletions site/content/docs/main/config/api-reference.html
Original file line number Diff line number Diff line change
@@ -7067,6 +7067,23 @@ <h3 id="projectcontour.io/v1alpha1.EnvoySettings">EnvoySettings
defaults to 0.</p>
</td>
</tr>
<tr>
<td style="white-space:nowrap">
<code>overloadMaxHeapSize</code>
<br>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>OverloadMaxHeapSize defines the maximum heap memory of the envoy controlled by the overload manager.
When the value is greater than 0, the overload manager is enabled,
and when envoy reaches 95% of the maximum heap size, it performs a shrink heap operation,
When it reaches 98% of the maximum heap size, Envoy Will stop accepting requests.
More info: <a href="https://projectcontour.io/docs/main/config/overload-manager/">https://projectcontour.io/docs/main/config/overload-manager/</a></p>
</td>
</tr>
</tbody>
</table>
<h3 id="projectcontour.io/v1alpha1.EnvoyTLS">EnvoyTLS
4 changes: 2 additions & 2 deletions site/content/docs/main/configuration.md
Original file line number Diff line number Diff line change
@@ -497,7 +497,7 @@ There are flags that can be passed to `contour bootstrap` that help configure ho
connects to Contour:

| Flag | Default | Description |
| -------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| -------------------------------------- |-------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <nobr>--resources-dir</nobr> | "" | Directory where resource files will be written. |
| <nobr>--admin-address</nobr> | /admin/admin.sock | Path to Envoy admin unix domain socket. |
| <nobr>--admin-port (Deprecated)</nobr> | 9001 | Deprecated: Port is now configured as a Contour flag. |
@@ -510,7 +510,7 @@ connects to Contour:
| <nobr>--xds-resource-version</nobr> | v3 | Currently, the only valid xDS API resource version is `v3`. |
| <nobr>--dns-lookup-family</nobr> | auto | Defines what DNS Resolution Policy to use for Envoy -> Contour cluster name lookup. Either v4, v6, auto or all. |
| <nobr>--log-format | text | Log output format for Contour. Either text or json. |
| <nobr>--overload-max-heap | "" | Defines the maximum heap size in bytes until Envoy overload manager stops accepting new connections. |
| <nobr>--overload-max-heap | 0 | Defines the maximum heap memory of the envoy controlled by the overload manager. When the value is greater than 0, the overload manager is enabled, and when envoy reaches 95% of the maximum heap size, it performs a shrink heap operation. When it reaches 98% of the maximum heap size, Envoy Will stop accepting requests. |


[1]: {{< param github_url>}}/tree/{{< param branch >}}/examples/contour/01-contour-config.yaml