Skip to content

Commit

Permalink
feat(default-memory-limits): set default memory limits for all contai…
Browse files Browse the repository at this point in the history
…ners

Signed-off-by: Ryan Hristovski <[email protected]>
  • Loading branch information
ryanhristovski authored and zirain committed Dec 27, 2024
1 parent 24a50b4 commit 7c5bdda
Show file tree
Hide file tree
Showing 51 changed files with 520 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/envoyproxy_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func DefaultShutdownManagerContainerResourceRequirements() *corev1.ResourceRequi
corev1.ResourceCPU: resource.MustParse(DefaultShutdownManagerCPUResourceRequests),
corev1.ResourceMemory: resource.MustParse(DefaultShutdownManagerMemoryResourceRequests),
},
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse(DefaultShutdownManagerMemoryResourceLimits),
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/kubernetes_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func DefaultResourceRequirements() *corev1.ResourceRequirements {
corev1.ResourceCPU: resource.MustParse(DefaultDeploymentCPUResourceRequests),
corev1.ResourceMemory: resource.MustParse(DefaultDeploymentMemoryResourceRequests),
},
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse(DefaultDeploymentMemoryResourceLimits),
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ const (
DefaultDeploymentCPUResourceRequests = "100m"
// DefaultDeploymentMemoryResourceRequests for deployment memory resource
DefaultDeploymentMemoryResourceRequests = "512Mi"
// DefaultDeploymentMemoryResourceLimits for deployment memory resource limits
DefaultDeploymentMemoryResourceLimits = "512Mi"
// DefaultEnvoyProxyImage is the default image used by envoyproxy
DefaultEnvoyProxyImage = "docker.io/envoyproxy/envoy:distroless-dev"
// DefaultShutdownManagerCPUResourceRequests for shutdown manager cpu resource
DefaultShutdownManagerCPUResourceRequests = "10m"
// DefaultShutdownManagerMemoryResourceRequests for shutdown manager memory resource
DefaultShutdownManagerMemoryResourceRequests = "32Mi"
// DefaultShutdownManagerMemoryResourceLimits for shutdown manager memory resource limits
DefaultShutdownManagerMemoryResourceLimits = "32Mi"
// DefaultShutdownManagerImage is the default image used for the shutdown manager.
DefaultShutdownManagerImage = "docker.io/envoyproxy/gateway-dev:latest"
// DefaultRateLimitImage is the default image used by ratelimit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -155,6 +157,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -246,6 +261,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -322,6 +339,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -216,6 +231,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -292,6 +309,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -255,6 +270,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -331,6 +348,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -246,6 +261,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -322,6 +339,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -246,6 +261,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -251,6 +266,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -327,6 +344,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -155,6 +157,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ spec:
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 50000
- name: "envoy.resource_monitors.fixed_heap"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.fixed_heap.v3.FixedHeapConfig
max_heap_size_bytes: 429496729
actions:
- name: "envoy.overload_actions.shrink_heap"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.95
- name: "envoy.overload_actions.stop_accepting_requests"
triggers:
- name: "envoy.resource_monitors.fixed_heap"
threshold:
value: 0.98
- --log-level warn
- --cpuset-threads
- --drain-strategy immediate
Expand Down Expand Up @@ -248,6 +263,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 100m
memory: 512Mi
Expand Down Expand Up @@ -324,6 +341,8 @@ spec:
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi
Expand Down
Loading

0 comments on commit 7c5bdda

Please sign in to comment.