Skip to content

Commit

Permalink
Make updateMode configurable and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
avorima committed Mar 9, 2023
1 parent 3feca5c commit 29e2554
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 38 deletions.
21 changes: 8 additions & 13 deletions charts/cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,24 +320,19 @@ Though enough for the majority of installations, the default PodSecurityPolicy _
### VerticalPodAutoscaler
The chart can install a [`VerticalPodAutoscaler`](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md) for the Deployment if needed. A VPA can help minimize wasted resources when usage spikes periodically.
The following example snippet can be used to install a [`autoscaling.k8s.io/v1` VPA](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go).
The chart can install a [`VerticalPodAutoscaler`](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md) for the Deployment if needed. A VPA can help minimize wasted resources when usage spikes periodically or remediate containers that are being OOMKilled.
The following example snippet can be used to install VPA that allows scaling down from the default recommendations of the deployment template:
```yaml
vpa:
enabled: true
apiVersion: v1
containerPolicy:
minAllowed:
cpu: 50m
memory: 150Mi
maxAllowed:
cpu: 100m
memory: 300Mi
cpu: 20m
memory: 50Mi
```

Supported VPA versions are `v1` and `v1beta2`.

## Values

| Key | Type | Default | Description |
Expand Down Expand Up @@ -433,7 +428,7 @@ Supported VPA versions are `v1` and `v1beta2`.
| tolerations | list | `[]` | List of node taints to tolerate (requires Kubernetes >= 1.6). |
| topologySpreadConstraints | list | `[]` | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains. (requires Kubernetes >= 1.19). |
| updateStrategy | object | `{}` | [Deployment update strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) |
| vpa | object | `{"apiVersion":"v1","containerPolicy":{},"enabled":false}` | Configure a VerticalPodAutoscaler for the cluster-autoscaler Deployment. |
| vpa.apiVersion | string | `"v1"` | APIVersion of the VerticalPodAutoscaler. The template only supports v1 and v1beta2. |
| vpa.containerPolicy | object | `{}` | Configure the containerPolicy of the cluster-autoscaler container. Content is rendered as YAML. |
| vpa | object | `{"containerPolicy":{},"enabled":false,"updateMode":"Auto"}` | Configure a VerticalPodAutoscaler for the cluster-autoscaler Deployment. |
| vpa.containerPolicy | object | `{}` | [ContainerResourcePolicy](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L159). The containerName is always et to the deployment's container name. This value is required if VPA is enabled. |
| vpa.enabled | bool | `false` | If true, creates a VerticalPodAutoscaler. |
| vpa.updateMode | string | `"Auto"` | [UpdateMode](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L124) |
15 changes: 5 additions & 10 deletions charts/cluster-autoscaler/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,17 @@ Though enough for the majority of installations, the default PodSecurityPolicy _

### VerticalPodAutoscaler

The chart can install a [`VerticalPodAutoscaler`](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md) for the Deployment if needed. A VPA can help minimize wasted resources when usage spikes periodically.
The following example snippet can be used to install a [`autoscaling.k8s.io/v1` VPA](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go).
The chart can install a [`VerticalPodAutoscaler`](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md) for the Deployment if needed. A VPA can help minimize wasted resources when usage spikes periodically or remediate containers that are being OOMKilled.

The following example snippet can be used to install VPA that allows scaling down from the default recommendations of the deployment template:

```yaml
vpa:
enabled: true
apiVersion: v1
containerPolicy:
minAllowed:
cpu: 50m
memory: 150Mi
maxAllowed:
cpu: 100m
memory: 300Mi
cpu: 20m
memory: 50Mi
```

Supported VPA versions are `v1` and `v1beta2`.

{{ template "chart.valuesSection" . }}
4 changes: 2 additions & 2 deletions charts/cluster-autoscaler/templates/vpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.vpa.enabled -}}
apiVersion: "autoscaling.k8s.io/{{ .Values.vpa.apiVersion }}"
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
labels:
Expand All @@ -12,7 +12,7 @@ spec:
kind: Deployment
name: {{ template "cluster-autoscaler.fullname" . }}
updatePolicy:
updateMode: "Auto"
updateMode: {{ .Values.vpa.updateMode | quote }}
resourcePolicy:
containerPolicies:
- containerName: {{ template "cluster-autoscaler.name" . }}
Expand Down
16 changes: 3 additions & 13 deletions charts/cluster-autoscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,7 @@ updateStrategy: {}
vpa:
# vpa.enabled -- If true, creates a VerticalPodAutoscaler.
enabled: false
# vpa.apiVersion -- APIVersion of the VerticalPodAutoscaler. The template only supports v1 and v1beta2.
apiVersion: v1
# vpa.containerPolicy -- Configure the containerPolicy of the cluster-autoscaler container. Content is rendered as YAML.
# vpa.updateMode -- [UpdateMode](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L124)
updateMode: "Auto"
# vpa.containerPolicy -- [ContainerResourcePolicy](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L159). The containerName is always et to the deployment's container name. This value is required if VPA is enabled.
containerPolicy: {}
# minAllowed:
# cpu: 50m
# memory: 150Mi
# maxAllowed:
# cpu: 100m
# memory: 300Mi
# controlledResources:
# - cpu
# - memory
# controlledValues: RequestsAndLimits

0 comments on commit 29e2554

Please sign in to comment.