Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
feat(hpa): Adds memory targetAverageUtilization (#4217)
Browse files Browse the repository at this point in the history
Allows HPA to react to memory utilization(not only CPU)

Signed-off-by: Shalier Xia <[email protected]>
  • Loading branch information
shalier authored Nov 8, 2021
1 parent 52e13ad commit 701d1c3
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 21 deletions.
10 changes: 6 additions & 4 deletions charts/osm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ The following table lists the configurable parameters of the osm chart and their
| osm.image.tag | string | `"latest-main"` | Container image tag for control plane images |
| osm.imagePullSecrets | list | `[]` | `osm-controller` image pull secret |
| osm.inboundPortExclusionList | list | `[]` | Specifies a global list of ports to exclude from inbound traffic interception by the sidecar proxy. If specified, must be a list of positive integers. |
| osm.injector.autoScale | object | `{"enable":false,"maxReplicas":5,"minReplicas":1,"targetAverageUtilization":80}` | Auto scale configuration |
| osm.injector.autoScale | object | `{"cpu":{"targetAverageUtilization":80},"enable":false,"maxReplicas":5,"memory":{"targetAverageUtilization":80},"minReplicas":1}` | Auto scale configuration |
| osm.injector.autoScale.cpu.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| osm.injector.autoScale.enable | bool | `false` | Enable Autoscale |
| osm.injector.autoScale.maxReplicas | int | `5` | Maximum replicas for autoscale |
| osm.injector.autoScale.memory.targetAverageUtilization | int | `80` | Average target memory utilization (%) |
| osm.injector.autoScale.minReplicas | int | `1` | Minimum replicas for autoscale |
| osm.injector.autoScale.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| osm.injector.enablePodDisruptionBudget | bool | `false` | Enable Pod Disruption Budget |
| osm.injector.podLabels | object | `{}` | Sidecar injector's pod labels |
| osm.injector.replicaCount | int | `1` | Sidecar injector's replica count (ignored when autoscale.enable is true) |
Expand All @@ -134,11 +135,12 @@ The following table lists the configurable parameters of the osm chart and their
| osm.osmBootstrap.podLabels | object | `{}` | OSM bootstrap's pod labels |
| osm.osmBootstrap.replicaCount | int | `1` | OSM bootstrap's replica count |
| osm.osmBootstrap.resource | object | `{"limits":{"cpu":"0.5","memory":"128M"},"requests":{"cpu":"0.3","memory":"128M"}}` | OSM bootstrap's container resource parameters |
| osm.osmController.autoScale | object | `{"enable":false,"maxReplicas":5,"minReplicas":1,"targetAverageUtilization":80}` | Auto scale configuration |
| osm.osmController.autoScale | object | `{"cpu":{"targetAverageUtilization":80},"enable":false,"maxReplicas":5,"memory":{"targetAverageUtilization":80},"minReplicas":1}` | Auto scale configuration |
| osm.osmController.autoScale.cpu.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| osm.osmController.autoScale.enable | bool | `false` | Enable Autoscale |
| osm.osmController.autoScale.maxReplicas | int | `5` | Maximum replicas for autoscale |
| osm.osmController.autoScale.memory.targetAverageUtilization | int | `80` | Average target memory utilization (%) |
| osm.osmController.autoScale.minReplicas | int | `1` | Minimum replicas for autoscale |
| osm.osmController.autoScale.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| osm.osmController.enablePodDisruptionBudget | bool | `false` | Enable Pod Disruption Budget |
| osm.osmController.podLabels | object | `{}` | OSM controller's pod labels |
| osm.osmController.replicaCount | int | `1` | OSM controller's replica count (ignored when autoscale.enable is true) |
Expand Down
8 changes: 7 additions & 1 deletion charts/osm/templates/osm-controller-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ spec:
name: cpu
target:
type: Utilization
averageUtilization: {{.Values.osm.osmController.autoScale.targetAverageUtilization}}
averageUtilization: {{.Values.osm.osmController.autoScale.cpu.targetAverageUtilization}}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageValue: {{.Values.osm.osmController.autoScale.memory.targetAverageUtilization}}
{{- end }}
8 changes: 7 additions & 1 deletion charts/osm/templates/osm-injector-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ spec:
name: cpu
target:
type: Utilization
averageUtilization: {{.Values.osm.injector.autoScale.targetAverageUtilization}}
averageUtilization: {{.Values.osm.injector.autoScale.cpu.targetAverageUtilization}}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageValue: {{.Values.osm.injector.autoScale.memory.targetAverageUtilization}}
{{- end }}
57 changes: 46 additions & 11 deletions charts/osm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"$id": "#/properties/definitions/properties/containerResources/properties/limits/properties/memory",
"type": "string",
"title": "The containerResources' memory limit schema",
"description": "The constainer's memory limit"
"description": "The container's memory limit"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -110,16 +110,51 @@
5
]
},
"targetAverageUtilization": {
"$id": "#/properties/definitions/properties/autoScale/properties/targetAverageUtilization",
"type": "integer",
"title": "Autoscale targetAverageUtilization",
"description": "Indicates average target CPU utilization (percentage) for autoscale.",
"minimum": 0,
"maximum": 100,
"examples": [
80
]
"cpu": {
"$id": "#/properties/definitions/properties/autoScale/properties/cpu",
"type": "object",
"title": "Autoscale CPU resource schema",
"description": "Autoscale CPU configuration",
"required": [
"targetAverageUtilization"
],
"properties": {
"targetAverageUtilization": {
"$id": "#/properties/definitions/properties/autoScale/properties/cpu/properties/targetAverageUtilization",
"type": "integer",
"title": "Autoscale cpu targetAverageUtilization",
"description": "Indicates average target cpu utilization (percentage) for autoscale.",
"minimum": 0,
"maximum": 100,
"examples": [
80
]
}
},
"additionalProperties": false
},
"memory": {
"$id": "#/properties/definitions/properties/autoScale/properties/memory",
"type": "object",
"title": "Autoscale memory resource schema",
"description": "Autoscale memory configuration",
"required": [
"targetAverageUtilization"
],
"properties": {
"targetAverageUtilization": {
"$id": "#/properties/definitions/properties/autoScale/properties/memory/properties/targetAverageUtilization",
"type": "integer",
"title": "Autoscale memory targetAverageUtilization",
"description": "Indicates average target memory utilization (percentage) for autoscale.",
"minimum": 0,
"maximum": 100,
"examples": [
80
]
}
},
"additionalProperties": false
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions charts/osm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ osm:
minReplicas: 1
# -- Maximum replicas for autoscale
maxReplicas: 5
# -- Average target CPU utilization (%)
targetAverageUtilization: 80
cpu:
# -- Average target CPU utilization (%)
targetAverageUtilization: 80
memory:
# -- Average target memory utilization (%)
targetAverageUtilization: 80

#
# -- Prometheus parameters
Expand Down Expand Up @@ -256,8 +260,12 @@ osm:
minReplicas: 1
# -- Maximum replicas for autoscale
maxReplicas: 5
# -- Average target CPU utilization (%)
targetAverageUtilization: 80
cpu:
# -- Average target CPU utilization (%)
targetAverageUtilization: 80
memory:
# -- Average target memory utilization (%)
targetAverageUtilization: 80
# -- Mutating webhook timeout
webhookTimeoutSeconds: 20

Expand Down

0 comments on commit 701d1c3

Please sign in to comment.