Skip to content

Commit

Permalink
Sync the VPA fork with the upstream/vpa-release-1.2 (#321)
Browse files Browse the repository at this point in the history
* Sync the vertical-pod-autoscaler/ dir with the content from upstream/vpa-release-1.2 branch

I used:
```
git checkout upstream/vpa-release-1.2 vertical-pod-autoscaler/
```

* Bump the VPA version to 1.2.1

* vpa-recommender: Prevent `nil pointer dereference`

* Nit: Unify logging

* `go mod vendor`
  • Loading branch information
ialidzhikov authored Aug 14, 2024
1 parent f838d65 commit d9666fe
Show file tree
Hide file tree
Showing 674 changed files with 55,937 additions and 1,183 deletions.
20 changes: 20 additions & 0 deletions vertical-pod-autoscaler/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ Name | Type | Description | Default
`recommendation-margin-fraction` | Float64 | Fraction of usage added as the safety margin to the recommended request | 0.15
`pod-recommendation-min-cpu-millicores` | Float64 | Minimum CPU recommendation for a pod | 25
`pod-recommendation-min-memory-mb` | Float64 | Minimum memory recommendation for a pod | 250
`target-cpu-percentile` | Float64 | CPU usage percentile that will be used as a base for CPU target recommendation | 0.9
`recommendation-lower-bound-cpu-percentile` | Float64 | CPU usage percentile that will be used for the lower bound on CPU recommendation | 0.5
`recommendation-upper-bound-cpu-percentile` | Float64 | CPU usage percentile that will be used for the upper bound on CPU recommendation | 0.95
`target-memory-percentile` | Float64 | Memory usage percentile that will be used as a base for memory target recommendation | 0.9
`recommendation-lower-bound-memory-percentile` | Float64 | Memory usage percentile that will be used for the lower bound on memory recommendation | 0.5
`recommendation-upper-bound-memory-percentile` | Float64 | Memory usage percentile that will be used for the upper bound on memory recommendation | 0.95
`checkpoints-timeout` | Duration | Timeout for writing checkpoints since the start of the recommender's main loop | time.Minute
`min-checkpoints` | Int | Minimum number of checkpoints to write per recommender's main loop | 10
`memory-saver` | Bool | If true, only track pods which have an associated VPA | false
Expand Down Expand Up @@ -197,6 +203,13 @@ Name | Type | Description | Default
`memory-histogram-decay-half-life` | Duration | The amount of time it takes a historical memory usage sample to lose half of its weight. In other words, a fresh usage sample is twice as 'important' as one with age equal to the half life period. | model.DefaultMemoryHistogramDecayHalfLife
`cpu-histogram-decay-half-life` | Duration | The amount of time it takes a historical CPU usage sample to lose half of its weight. | model.DefaultCPUHistogramDecayHalfLife
`cpu-integer-post-processor-enabled` | Bool | Enable the CPU integer recommendation post processor | false
`leader-elect` | Bool | Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability. | false
`leader-elect-lease-duration` | Duration | The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled. | 15s
`leader-elect-renew-deadline` | Duration | The interval between attempts by the acting master to renew a leadership slot before it stops leading. This must be less than the lease duration. This is only applicable if leader election is enabled. | 10s
`leader-elect-resource-lock` | String | The type of resource object that is used for locking during leader election. Supported options are 'leases', 'endpointsleases' and 'configmapsleases'. | "leases"
`leader-elect-resource-name` | String | The name of resource object that is used for locking during leader election. | "vpa-recommender"
`leader-elect-resource-namespace` | String | The namespace of resource object that is used for locking during leader election. | "kube-system"
`leader-elect-retry-period` | Duration | The duration the clients should wait between attempting acquisition and renewal of a leadership. This is only applicable if leader election is enabled. | 2s

### What are the parameters to VPA updater?

Expand All @@ -218,3 +231,10 @@ Name | Type | Description | Default
`kube-api-burst` | Float64 | QPS burst limit when making requests to Kubernetes apiserver | 10.0
`use-admission-controller-status` | Bool | If true, updater will only evict pods when admission controller status is valid. | true
`vpa-object-namespace` | String | Namespace to search for VPA objects. Empty means all namespaces will be used. | apiv1.NamespaceAll
`leader-elect` | Bool | Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability. | false
`leader-elect-lease-duration` | Duration | The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled. | 15s
`leader-elect-renew-deadline` | Duration | The interval between attempts by the acting master to renew a leadership slot before it stops leading. This must be less than the lease duration. This is only applicable if leader election is enabled. | 10s
`leader-elect-resource-lock` | String | The type of resource object that is used for locking during leader election. Supported options are 'leases', 'endpointsleases' and 'configmapsleases'. | "leases"
`leader-elect-resource-name` | String | The name of resource object that is used for locking during leader election. | "vpa-updater"
`leader-elect-resource-namespace` | String | The namespace of resource object that is used for locking during leader election. | "kube-system"
`leader-elect-retry-period` | Duration | The duration the clients should wait between attempting acquisition and renewal of a leadership. This is only applicable if leader election is enabled. | 2s
3 changes: 2 additions & 1 deletion vertical-pod-autoscaler/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ approvers:
- kgolab
- jbartosik
- krzysied
- voelzmo
reviewers:
- kwiesmueller
- kgolab
Expand All @@ -12,4 +13,4 @@ reviewers:
emeritus_approvers:
- schylek # 2022-09-30
labels:
- vertical-pod-autoscaler
- area/vertical-pod-autoscaler
24 changes: 21 additions & 3 deletions vertical-pod-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [Starting multiple recommenders](#starting-multiple-recommenders)
- [Using CPU management with static policy](#using-cpu-management-with-static-policy)
- [Controlling eviction behavior based on scaling direction and resource](#controlling-eviction-behavior-based-on-scaling-direction-and-resource)
- [Limiting which namespaces are used](#limiting-which-namespaces-are-used)
- [Known limitations](#known-limitations)
- [Related links](#related-links)

Expand Down Expand Up @@ -50,12 +51,15 @@ procedure described below.

# Installation

The current default version is Vertical Pod Autoscaler 0.14.0
The current default version is Vertical Pod Autoscaler 1.2.0

### Compatibility

| VPA version | Kubernetes version |
|-----------------|--------------------|
| 1.2.0 | 1.27+ |
| 1.1.2 | 1.25+ |
| 1.1.1 | 1.25+ |
| 1.0 | 1.25+ |
| 0.14 | 1.25+ |
| 0.13 | 1.25+ |
Expand Down Expand Up @@ -374,6 +378,16 @@ vpa-post-processor.kubernetes.io/{containerName}_integerCPU=true
```
Note that this doesn't prevent scaling down entirely, as Pods may get recreated for different reasons, resulting in a new recommendation being applied. See [the original AEP](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/4831-control-eviction-behavior) for more context and usage information.

### Limiting which namespaces are used

By default the VPA will run against all namespaces. You can limit that behaviour by setting the following options:

1. `ignored-vpa-object-namespaces` - A comma separated list of namespaces to ignore
1. `vpa-object-namespace` - A single namespace to monitor

These options cannot be used together and are mutually exclusive.


# Known limitations

* Whenever VPA updates the pod resources, the pod is recreated, which causes all
Expand All @@ -384,8 +398,12 @@ vpa-post-processor.kubernetes.io/{containerName}_integerCPU=true
recreated. This can be partly
addressed by using VPA together with [Cluster Autoscaler](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#basics).
* VPA does not update resources of pods which are not run under a controller.
* Vertical Pod Autoscaler **should not be used with the [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-resource-metrics) (HPA) on CPU or memory** at this moment.
However, you can use VPA with [HPA on custom and external metrics](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#scaling-on-custom-metrics).
* Vertical Pod Autoscaler **should not be used with the [Horizontal Pod
Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-resource-metrics)
(HPA) on the same resource metric (CPU or memory)** at this moment. However, you can use [VPA with
HPA on separate resource metrics](https://github.com/kubernetes/autoscaler/issues/6247) (e.g. VPA
on memory and HPA on CPU) as well as with [HPA on custom and external
metrics](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#scaling-on-custom-metrics).
* The VPA admission controller is an admission webhook. If you add other admission webhooks
to your cluster, it is important to analyze how they interact and whether they may conflict
with each other. The order of admission controllers is defined by a flag on API server.
Expand Down
4 changes: 2 additions & 2 deletions vertical-pod-autoscaler/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ sure nothing we care about will break if we do.
[groups.yaml](https://github.com/kubernetes/k8s.io/blob/master/groups/sig-autoscaling/groups.yaml)
under k8s-infra-staging-autoscaling.
* Permissions to add images to
`k8s.gcr.io/images/k8s-staging-autoscaling/images.yaml` are governed by
[OWNERS file](https://github.com/kubernetes/k8s.io/blob/master/k8s.gcr.io/images/k8s-staging-autoscaling/OWNERS).
[`k8s.io/registry.k8s.io/images/k8s-staging-autoscaling/images.yaml`](https://github.com/kubernetes/k8s.io/blob/main/registry.k8s.io/images/k8s-staging-autoscaling/images.yaml) are governed by
[OWNERS file](https://github.com/kubernetes/k8s.io/blob/main/registry.k8s.io/images/k8s-staging-autoscaling/OWNERS).
* Permissions to add tags to
[kubernetes/autoscaler](https://github.com/kubernetes/autoscaler) and create
releases in the repo you must be:
Expand Down
2 changes: 1 addition & 1 deletion vertical-pod-autoscaler/common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ limitations under the License.
package common

// VerticalPodAutoscalerVersion is the version of VPA.
const VerticalPodAutoscalerVersion = "1.1.0-dev"
const VerticalPodAutoscalerVersion = "1.2.1"
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ spec:
runAsUser: 65534 # nobody
containers:
- name: admission-controller
image: registry.k8s.io/autoscaling/vpa-admission-controller:1.0.0
image: registry.k8s.io/autoscaling/vpa-admission-controller:1.2.0
imagePullPolicy: Always
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args: ["--v=4", "--stderrthreshold=info", "--reload-cert"]
volumeMounts:
- name: tls-certs
mountPath: "/etc/tls-certs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
runAsUser: 65534 # nobody
containers:
- name: recommender
image: registry.k8s.io/autoscaling/vpa-recommender:1.0.0
image: registry.k8s.io/autoscaling/vpa-recommender:1.2.0
imagePullPolicy: Always
args:
- --recommender-name=performance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
runAsUser: 65534 # nobody
containers:
- name: recommender
image: registry.k8s.io/autoscaling/vpa-recommender:1.0.0
image: registry.k8s.io/autoscaling/vpa-recommender:1.2.0
imagePullPolicy: Always
args:
- --recommender-name=frugal
Expand Down
2 changes: 1 addition & 1 deletion vertical-pod-autoscaler/deploy/recommender-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
runAsUser: 65534 # nobody
containers:
- name: recommender
image: registry.k8s.io/autoscaling/vpa-recommender:1.0.0
image: registry.k8s.io/autoscaling/vpa-recommender:1.2.0
imagePullPolicy: Always
resources:
limits:
Expand Down
2 changes: 1 addition & 1 deletion vertical-pod-autoscaler/deploy/updater-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
runAsUser: 65534 # nobody
containers:
- name: updater
image: registry.k8s.io/autoscaling/vpa-updater:1.0.0
image: registry.k8s.io/autoscaling/vpa-updater:1.2.0
imagePullPolicy: Always
env:
- name: NAMESPACE
Expand Down
74 changes: 74 additions & 0 deletions vertical-pod-autoscaler/deploy/vpa-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,77 @@ subjects:
- kind: ServiceAccount
name: vpa-updater
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: system:leader-locking-vpa-updater
namespace: kube-system
rules:
- apiGroups:
- "coordination.k8s.io"
resources:
- leases
verbs:
- create
- apiGroups:
- "coordination.k8s.io"
resourceNames:
- vpa-updater
resources:
- leases
verbs:
- get
- watch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: system:leader-locking-vpa-updater
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: system:leader-locking-vpa-updater
subjects:
- kind: ServiceAccount
name: vpa-updater
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: system:leader-locking-vpa-recommender
namespace: kube-system
rules:
- apiGroups:
- "coordination.k8s.io"
resources:
- leases
verbs:
- create
- apiGroups:
- "coordination.k8s.io"
resourceNames:
- vpa-recommender
resources:
- leases
verbs:
- get
- watch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: system:leader-locking-vpa-recommender
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: system:leader-locking-vpa-recommender
subjects:
- kind: ServiceAccount
name: vpa-recommender
namespace: kube-system
Loading

0 comments on commit d9666fe

Please sign in to comment.