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

Commit

Permalink
Add hpa to osm controller and injector (#3499)
Browse files Browse the repository at this point in the history
Signed-off-by: Shalier Xia <shalierxia@microsoft.com>
  • Loading branch information
shalier authored Jun 8, 2021
1 parent eeddf2e commit 3f79415
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
10 changes: 10 additions & 0 deletions charts/osm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,22 @@ The following table lists the configurable parameters of the osm chart and their
| OpenServiceMesh.image.registry | string | `"openservicemesh"` | Container image registry |
| OpenServiceMesh.image.tag | string | `"v0.8.4"` | Container image tag |
| OpenServiceMesh.imagePullSecrets | list | `[]` | `osm-controller` image pull secret |
| OpenServiceMesh.injector.autoScale | object | `{"enable":false,"maxReplicas":5,"minReplicas":1,"targetAverageUtilization":80}` | Auto scale configuration |
| OpenServiceMesh.injector.autoScale.enable | bool | `false` | Enable Autoscale |
| OpenServiceMesh.injector.autoScale.maxReplicas | int | `5` | Maximum replicas for autoscale |
| OpenServiceMesh.injector.autoScale.minReplicas | int | `1` | Minimum replicas for autoscale |
| OpenServiceMesh.injector.autoScale.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| OpenServiceMesh.injector.enablePodDisruptionBudget | bool | `false` | Enable Pod Disruption Budget |
| OpenServiceMesh.injector.podLabels | object | `{}` | Sidecar injector's pod labels |
| OpenServiceMesh.injector.replicaCount | int | `1` | Sidecar injector's replica count |
| OpenServiceMesh.injector.resource | object | `{"limits":{"cpu":"0.5","memory":"64M"},"requests":{"cpu":"0.3","memory":"64M"}}` | Sidecar injector's container resource parameters |
| OpenServiceMesh.maxDataPlaneConnections | int | `0` | Sets the max data plane connections allowed for an instance of osm-controller, set to 0 to not enforce limits |
| OpenServiceMesh.meshName | string | `"osm"` | Identifier for the instance of a service mesh within a cluster |
| OpenServiceMesh.osmController.autoScale | object | `{"enable":false,"maxReplicas":5,"minReplicas":1,"targetAverageUtilization":80}` | Auto scale configuration |
| OpenServiceMesh.osmController.autoScale.enable | bool | `false` | Enable Autoscale |
| OpenServiceMesh.osmController.autoScale.maxReplicas | int | `5` | Maximum replicas for autoscale |
| OpenServiceMesh.osmController.autoScale.minReplicas | int | `1` | Minimum replicas for autoscale |
| OpenServiceMesh.osmController.autoScale.targetAverageUtilization | int | `80` | Average target CPU utilization (%) |
| OpenServiceMesh.osmController.enablePodDisruptionBudget | bool | `false` | Enable Pod Disruption Budget |
| OpenServiceMesh.osmController.podLabels | object | `{}` | OSM controller's pod labels |
| OpenServiceMesh.osmController.replicaCount | int | `1` | OSM controller's replica count |
Expand Down
21 changes: 21 additions & 0 deletions charts/osm/templates/osm-controller-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.OpenServiceMesh.osmController.autoScale.enable }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: osm-controller-hpa
namespace: {{ include "osm.namespace" . }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: osm-controller
minReplicas: {{.Values.OpenServiceMesh.osmController.autoScale.minReplicas}}
maxReplicas: {{.Values.OpenServiceMesh.osmController.autoScale.maxReplicas}}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{.Values.OpenServiceMesh.osmController.autoScale.targetAverageUtilization}}
{{- end }}
21 changes: 21 additions & 0 deletions charts/osm/templates/osm-injector-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.OpenServiceMesh.injector.autoScale.enable }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: osm-injector-hpa
namespace: {{ include "osm.namespace" . }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: osm-injector
minReplicas: {{.Values.OpenServiceMesh.injector.autoScale.minReplicas}}
maxReplicas: {{.Values.OpenServiceMesh.injector.autoScale.maxReplicas}}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{.Values.OpenServiceMesh.injector.autoScale.targetAverageUtilization}}
{{- end }}
59 changes: 59 additions & 0 deletions charts/osm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,59 @@
"additionalProperties": false
}
}
},
"autoScale": {
"$id": "#/properties/definitions/properties/autoScale",
"type": "object",
"title": "The autoScale schema",
"description": "Autoscale configuration parameters",
"required": [
"enable"
],
"properties": {
"enable": {
"$id": "#/properties/definitions/properties/autoScale/properties/enable",
"type": "boolean",
"title": "Autoscale enable",
"description": "Indicates whether autoscale should be enabled or not.",
"examples": [
false
]
},
"minReplicas": {
"$id": "#/properties/definitions/properties/autoScale/properties/minReplicas",
"type": "integer",
"title": "Autoscale minimum replicas",
"description": "Indicates the minimum replicas for autoscale.",
"minimum": 1,
"maximum": 10,
"examples": [
1
]
},
"maxReplicas": {
"$id": "#/properties/definitions/properties/autoScale/properties/maxReplicas",
"type": "integer",
"title": "Autoscale maximum replicase",
"description": "Indicates the maximum replicas for autoscale.",
"minimum": 1,
"maximum": 10,
"examples": [
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
]
}
}
}
},
"properties": {
Expand Down Expand Up @@ -138,6 +191,9 @@
"examples": [
false
]
},
"autoScale": {
"$ref": "#/definitions/autoScale"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -596,6 +652,9 @@
"examples": [
false
]
},
"autoScale": {
"$ref": "#/definitions/autoScale"
}
},
"additionalProperties": false
Expand Down
20 changes: 20 additions & 0 deletions charts/osm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ OpenServiceMesh:
podLabels: {}
# -- Enable Pod Disruption Budget
enablePodDisruptionBudget: false
# -- Auto scale configuration
autoScale:
# -- Enable Autoscale
enable: false
# -- Minimum replicas for autoscale
minReplicas: 1
# -- Maximum replicas for autoscale
maxReplicas: 5
# -- Average target CPU utilization (%)
targetAverageUtilization: 80

#
# -- Prometheus parameters
Expand Down Expand Up @@ -207,6 +217,16 @@ OpenServiceMesh:
podLabels: {}
# -- Enable Pod Disruption Budget
enablePodDisruptionBudget: false
# -- Auto scale configuration
autoScale:
# -- Enable Autoscale
enable: false
# -- Minimum replicas for autoscale
minReplicas: 1
# -- Maximum replicas for autoscale
maxReplicas: 5
# -- Average target CPU utilization (%)
targetAverageUtilization: 80

# -- Run init container in privileged mode
enablePrivilegedInitContainer: false
Expand Down

0 comments on commit 3f79415

Please sign in to comment.