Skip to content

Commit

Permalink
Merge pull request #101 from zalando-incubator/vpa-0.12.0
Browse files Browse the repository at this point in the history
vpa: Update to version 0.12.0
  • Loading branch information
mikkeloscar authored Sep 19, 2023
2 parents 938e5d0 + 75c6f62 commit fbbd118
Show file tree
Hide file tree
Showing 13,204 changed files with 7,224,181 additions and 601,411 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
env:
GOPATH: ${{ github.workspace }}/go

permissions:
contents: read

jobs:
test-and-verify:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.5
go-version: 1.18.1

- uses: actions/checkout@v2
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
permissions:
contents: read

jobs:
changes:
permissions:
contents: read # for dorny/paths-filter to fetch a list of changed files
pull-requests: read # for dorny/paths-filter to read pull requests
outputs:
charts: ${{ steps.filter.outputs.charts }}
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
permissions:
contents: read

jobs:
release:
permissions:
contents: write # for helm/chart-releaser-action to push chart release and create a release
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
1 change: 0 additions & 1 deletion ZALANDO_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ changes around the OOMKill handling to improve this situation:
## Variuos small improvements

* Fix logging for memory saver mode ([#18](https://github.com/zalando-incubator/autoscaler/pull/18))
* Fix error logging for container metrics input ([#20](https://github.com/zalando-incubator/autoscaler/pull/20))
2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.18.1
FROM golang:1.19
LABEL maintainer="Marcin Wielgus <[email protected]>"

ENV GOPATH /gopath/
Expand Down
8 changes: 1 addition & 7 deletions charts/cluster-autoscaler/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ engine: gotpl
home: https://github.com/kubernetes/autoscaler
icon: https://github.com/kubernetes/kubernetes/raw/master/logo/logo.png
maintainers:
- email: [email protected]
name: yurrriq
- email: [email protected]
name: mgoodness
- email: [email protected]
name: gjtempleton
- email: [email protected]
name: sc250024
name: cluster-autoscaler
sources:
- https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
type: application
version: 9.18.0
version: 9.20.0
4 changes: 3 additions & 1 deletion charts/cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Though enough for the majority of installations, the default PodSecurityPolicy _
|-----|------|---------|-------------|
| additionalLabels | object | `{}` | Labels to add to each object of the chart. |
| affinity | object | `{}` | Affinity for pod assignment |
| autoDiscovery.clusterName | string | `nil` | Enable autodiscovery for `cloudProvider=aws`, for groups matching `autoDiscovery.tags`. Enable autodiscovery for `cloudProvider=clusterapi`, for groups matching `autoDiscovery.labels`. Enable autodiscovery for `cloudProvider=gce`, but no MIG tagging required. Enable autodiscovery for `cloudProvider=magnum`, for groups matching `autoDiscovery.roles`. |
| autoDiscovery.clusterName | string | `nil` | Enable autodiscovery for `cloudProvider=aws`, for groups matching `autoDiscovery.tags`. autoDiscovery.clusterName -- Enable autodiscovery for `cloudProvider=azure`, using tags defined in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/azure/README.md#auto-discovery-setup. Enable autodiscovery for `cloudProvider=clusterapi`, for groups matching `autoDiscovery.labels`. Enable autodiscovery for `cloudProvider=gce`, but no MIG tagging required. Enable autodiscovery for `cloudProvider=magnum`, for groups matching `autoDiscovery.roles`. |
| autoDiscovery.labels | list | `[]` | Cluster-API labels to match https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#configuring-node-group-auto-discovery |
| autoDiscovery.roles | list | `["worker"]` | Magnum node group roles to match. |
| autoDiscovery.tags | list | `["k8s.io/cluster-autoscaler/enabled","k8s.io/cluster-autoscaler/{{ .Values.autoDiscovery.clusterName }}"]` | ASG tags to match, run through `tpl`. |
Expand Down Expand Up @@ -356,13 +356,15 @@ Though enough for the majority of installations, the default PodSecurityPolicy _
| resources | object | `{}` | Pod resource requests and limits. |
| securityContext | object | `{}` | [Security context for pod](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) |
| service.annotations | object | `{}` | Annotations to add to service |
| service.create | bool | `true` | If `true`, a Service will be created. |
| service.externalIPs | list | `[]` | List of IP addresses at which the service is available. Ref: https://kubernetes.io/docs/user-guide/services/#external-ips. |
| service.labels | object | `{}` | Labels to add to service |
| service.loadBalancerIP | string | `""` | IP address to assign to load balancer (if supported). |
| service.loadBalancerSourceRanges | list | `[]` | List of IP CIDRs allowed access to load balancer (if supported). |
| service.portName | string | `"http"` | Name for service port. |
| service.servicePort | int | `8085` | Service port to expose. |
| service.type | string | `"ClusterIP"` | Type of service to create. |
| serviceMonitor.annotations | object | `{}` | Annotations to add to service monitor |
| serviceMonitor.enabled | bool | `false` | If true, creates a Prometheus Operator ServiceMonitor. |
| serviceMonitor.interval | string | `"10s"` | Interval that Prometheus scrapes Cluster Autoscaler metrics. |
| serviceMonitor.namespace | string | `"monitoring"` | Namespace which Prometheus is running in. |
Expand Down
12 changes: 12 additions & 0 deletions charts/cluster-autoscaler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ Return the appropriate apiVersion for podsecuritypolicy.
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for podDisruptionBudget.
*/}}
{{- define "podDisruptionBudget.apiVersion" -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if semverCompare "<1.21-0" $kubeTargetVersion -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the service account name used by the pod.
*/}}
Expand Down
7 changes: 7 additions & 0 deletions charts/cluster-autoscaler/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ spec:
{{- if .Values.autoDiscovery.clusterName }}
- --node-group-auto-discovery=asg:tag={{ tpl (join "," .Values.autoDiscovery.tags) . }}
{{- end }}
{{- if .Values.cloudConfigPath }}
- --cloud-config={{ .Values.cloudConfigPath }}
{{- end }}
{{- else if eq .Values.cloudProvider "gce" }}
{{- if .Values.autoscalingGroupsnamePrefix }}
{{- range .Values.autoscalingGroupsnamePrefix }}
Expand Down Expand Up @@ -91,6 +94,10 @@ spec:
{{- else if eq .Values.clusterAPIMode "single-kubeconfig"}}
- --kubeconfig={{ .Values.clusterAPIWorkloadKubeconfigPath }}
{{- end }}
{{- else if eq .Values.cloudProvider "azure" }}
{{- if .Values.autoDiscovery.clusterName }}
- --node-group-auto-discovery=label:cluster-autoscaler-enabled=true,cluster-autoscaler-name={{ .Values.autoDiscovery.clusterName }}
{{- end }}
{{- end }}
{{- if eq .Values.cloudProvider "magnum" }}
- --cloud-config={{ .Values.cloudConfigPath }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cluster-autoscaler/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.podDisruptionBudget -}}
apiVersion: policy/v1beta1
apiVersion: {{ template "podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ data:
{{- if kindIs "string" .Values.expanderPriorities }}
{{ .Values.expanderPriorities | indent 4 }}
{{- else }}
{{ toYaml .Values.expanderPriorities | indent 4 }}
{{- range $k,$v := .Values.expanderPriorities }}
{{ $k | int }}:
{{- toYaml $v | nindent 6 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions charts/cluster-autoscaler/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.service.create }}
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -35,3 +36,4 @@ spec:
selector:
{{ include "cluster-autoscaler.instance-name" . | indent 4 }}
type: "{{ .Values.service.type }}"
{{- end }}
2 changes: 2 additions & 0 deletions charts/cluster-autoscaler/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ metadata:
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
annotations:
{{ toYaml .Values.serviceMonitor.annotations | indent 4 }}
labels:
{{- range $key, $value := .Values.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
Expand Down
7 changes: 6 additions & 1 deletion charts/cluster-autoscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
affinity: {}

autoDiscovery:
# cloudProviders `aws`, `gce`, `magnum` and `clusterapi` are supported by auto-discovery at this time
# cloudProviders `aws`, `gce`, `azure`, `magnum` and `clusterapi` are supported by auto-discovery at this time
# AWS: Set tags as described in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md#auto-discovery-setup

# autoDiscovery.clusterName -- Enable autodiscovery for `cloudProvider=aws`, for groups matching `autoDiscovery.tags`.
# autoDiscovery.clusterName -- Enable autodiscovery for `cloudProvider=azure`, using tags defined in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/azure/README.md#auto-discovery-setup.
# Enable autodiscovery for `cloudProvider=clusterapi`, for groups matching `autoDiscovery.labels`.
# Enable autodiscovery for `cloudProvider=gce`, but no MIG tagging required.
# Enable autodiscovery for `cloudProvider=magnum`, for groups matching `autoDiscovery.roles`.
Expand Down Expand Up @@ -306,6 +307,8 @@ securityContext: {}
# runAsGroup: 1001

service:
# service.create -- If `true`, a Service will be created.
create: true
# service.annotations -- Annotations to add to service
annotations: {}
# service.labels -- Labels to add to service
Expand Down Expand Up @@ -339,6 +342,8 @@ serviceMonitor:
release: prometheus-operator
# serviceMonitor.path -- The path to scrape for metrics; autoscaler exposes `/metrics` (this is standard)
path: /metrics
# serviceMonitor.annotations -- Annotations to add to service monitor
annotations: {}

## Custom PrometheusRule to be defined
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE=gcr.io/distroless/static:latest-amd64
ARG BASEIMAGE=gcr.io/distroless/static:nonroot-amd64
FROM $BASEIMAGE
LABEL maintainer="Marcin Wielgus <[email protected]>"

COPY cluster-autoscaler-amd64 /cluster-autoscaler
WORKDIR /
CMD ["/cluster-autoscaler"]
3 changes: 2 additions & 1 deletion cluster-autoscaler/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASEIMAGE=gcr.io/distroless/static:latest-arm64
ARG BASEIMAGE=gcr.io/distroless/static:nonroot-arm64
FROM $BASEIMAGE
LABEL maintainer="Marcin Wielgus <[email protected]>"

COPY cluster-autoscaler-arm64 /cluster-autoscaler
WORKDIR /
CMD ["/cluster-autoscaler"]
21 changes: 18 additions & 3 deletions cluster-autoscaler/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ this document:
* [How to?](#how-to)
* [I'm running cluster with nodes in multiple zones for HA purposes. Is that supported by Cluster Autoscaler?](#im-running-cluster-with-nodes-in-multiple-zones-for-ha-purposes-is-that-supported-by-cluster-autoscaler)
* [How can I monitor Cluster Autoscaler?](#how-can-i-monitor-cluster-autoscaler)
* [How can I see all the events from Cluster Autoscaler?](#how-can-i-see-all-events-from-cluster-autoscaler)
* [How can I scale my cluster to just 1 node?](#how-can-i-scale-my-cluster-to-just-1-node)
* [How can I scale a node group to 0?](#how-can-i-scale-a-node-group-to-0)
* [How can I prevent Cluster Autoscaler from scaling down a particular node?](#how-can-i-prevent-cluster-autoscaler-from-scaling-down-a-particular-node)
Expand Down Expand Up @@ -267,6 +268,16 @@ respectively under `/metrics` and `/health-check`.
Metrics are provided in Prometheus format and their detailed description is
available [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/proposals/metrics.md).

### How can I see all events from Cluster Autoscaler?

By default, the Cluster Autoscaler will deduplicate similar events that occur within a 5 minute
window. This is done to improve scalability performance where many similar events might be
triggered in a short timespan, such as when there are too many unscheduled pods.

In some cases, such as for debugging or when scalability of events is not an issue, you might
want to see all the events coming from the Cluster Autoscaler. In these scenarios you should
use the `--record-duplicated-events` command line flag.

### How can I scale my cluster to just 1 node?

Prior to version 0.6, Cluster Autoscaler was not touching nodes that were running important
Expand Down Expand Up @@ -408,6 +419,7 @@ spec:
run: overprovisioning
spec:
priorityClassName: overprovisioning
terminationGracePeriodSeconds: 0
containers:
- name: reserve-resources
image: k8s.gcr.io/pause
Expand All @@ -433,10 +445,10 @@ spec:
app: overprovisioning-autoscaler
spec:
containers:
- image: k8s.gcr.io/cluster-proportional-autoscaler-amd64:1.1.2
- image: k8s.gcr.io/cluster-proportional-autoscaler-amd64:1.8.1
name: autoscaler
command:
- ./cluster-proportional-autoscaler
- /cluster-proportional-autoscaler
- --namespace=default
- --configmap=overprovisioning-autoscaler
- --default-params={"linear":{"coresPerReplica":1}}
Expand Down Expand Up @@ -720,7 +732,7 @@ The following startup parameters are supported for cluster autoscaler:
| `scale-down-candidates-pool-min-count` | Minimum number of nodes that are considered as additional non empty candidates<br>for scale down when some candidates from previous iteration are no longer valid.<br>When calculating the pool size for additional candidates we take<br>`max(#nodes * scale-down-candidates-pool-ratio, scale-down-candidates-pool-min-count)` | 50
| `scan-interval` | How often cluster is reevaluated for scale up or down | 10 seconds
| `max-nodes-total` | Maximum number of nodes in all node groups. Cluster autoscaler will not grow the cluster beyond this number. | 0
| `cores-total` | Minimum and maximum number of cores in cluster, in the format <min>:<max>. Cluster autoscaler will not scale the cluster beyond these numbers. | 320000
| `cores-total` | Minimum and maximum number of cores in cluster, in the format \<min>:\<max>. Cluster autoscaler will not scale the cluster beyond these numbers. | 320000
| `memory-total` | Minimum and maximum number of gigabytes of memory in cluster, in the format \<min>:\<max>. Cluster autoscaler will not scale the cluster beyond these numbers. | 6400000
| `gpu-total` | Minimum and maximum number of different GPUs in cluster, in the format <gpu_type>:\<min>:\<max>. Cluster autoscaler will not scale the cluster beyond these numbers. Can be passed multiple times. CURRENTLY THIS FLAG ONLY WORKS ON GKE. | ""
| `cloud-provider` | Cloud provider type. | gce
Expand All @@ -742,6 +754,7 @@ The following startup parameters are supported for cluster autoscaler:
| `max-failing-time` | Maximum time from last recorded successful autoscaler run before automatic restart | 15 minutes
| `balance-similar-node-groups` | Detect similar node groups and balance the number of nodes between them | false
| `balancing-ignore-label` | Define a node label that should be ignored when considering node group similarity. One label per flag occurrence. | ""
| `balancing-label` | Define a node label to use when comparing node group similarity. If set, all other comparison logic is disabled, and only labels are considered when comparing groups. One label per flag occurrence. | ""
| `node-autoprovisioning-enabled` | Should CA autoprovision node groups when needed | false
| `max-autoprovisioned-node-group-count` | The maximum number of autoprovisioned groups in the cluster | 15
| `unremovable-node-recheck-timeout` | The timeout before we check again a node that couldn't be removed before | 5 minutes
Expand All @@ -759,6 +772,8 @@ The following startup parameters are supported for cluster autoscaler:
| `daemonset-eviction-for-empty-nodes` | Whether DaemonSet pods will be gracefully terminated from empty nodes | false
| `daemonset-eviction-for-occupied-nodes` | Whether DaemonSet pods will be gracefully terminated from non-empty nodes | true
| `feature-gates` | A set of key=value pairs that describe feature gates for alpha/experimental features. | ""
| `cordon-node-before-terminating` | Should CA cordon nodes before terminating during downscale process | false
| `record-duplicated-events` | Enable the autoscaler to print duplicated events within a 5 minute window. | false
# Troubleshooting:
Expand Down
7 changes: 7 additions & 0 deletions cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ You should also take a look at the notes and "gotchas" for your specific cloud p
* [BizflyCloud](./cloudprovider/bizflycloud/README.md)
* [Vultr](./cloudprovider/vultr/README.md)
* [TencentCloud](./cloudprovider/tencentcloud/README.md)
* [Scaleway](./cloudprovider/scaleway/README.md)
* [Rancher](./cloudprovider/rancher/README.md)
* [Kamatera](./cloudprovider/kamatera/README.md)

# Releases

Expand Down Expand Up @@ -177,3 +180,7 @@ Supported cloud providers:
* Cluster API https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md
* Vultr https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/vultr/README.md
* TencentCloud https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/tencentcloud/README.md
* BaiduCloud https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/baiducloud/README.md
* Huawei Cloud https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/huaweicloud/README.md
* Rancher https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/rancher/README.md
* Kamatera https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/kamatera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
defaultAdjustmentType = "TotalCapacity"
)

//autoScaling define the interface usage in alibaba-cloud-sdk-go.
// autoScaling define the interface usage in alibaba-cloud-sdk-go.
type autoScaling interface {
DescribeScalingGroups(req *ess.DescribeScalingGroupsRequest) (*ess.DescribeScalingGroupsResponse, error)
DescribeScalingConfigurations(req *ess.DescribeScalingConfigurationsRequest) (*ess.DescribeScalingConfigurationsResponse, error)
Expand Down Expand Up @@ -95,7 +95,7 @@ func getEssClient(cfg *cloudConfig) (client *ess.Client, err error) {
return
}

//autoScalingWrapper will serve as the
// autoScalingWrapper will serve as the
type autoScalingWrapper struct {
autoScaling
cfg *cloudConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ spec:
app: cluster-autoscaler
spec:
priorityClassName: system-cluster-critical
serviceAccountName: admin
serviceAccountName: cluster-autoscaler
containers:
- image: registry.cn-hangzhou.aliyuncs.com/acs/autoscaler:v1.3.1
name: cluster-autoscaler
Expand Down Expand Up @@ -162,9 +162,9 @@ spec:
key: access-key-secret
- name: REGION_ID
valueFrom:
secretKeyRef:
name: cloud-config
key: region-id
secretKeyRef:
name: cloud-config
key: region-id
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs/ca-certificates.crt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ __NOTE:__ Please see [the README](README.md#IAM-Policy) for more information on
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeScalingActivities",
"autoscaling:DescribeTags",
"ec2:DescribeInstanceTypes",
"ec2:DescribeLaunchTemplateVersions"
],
Expand Down
4 changes: 3 additions & 1 deletion cluster-autoscaler/cloudprovider/aws/OWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
approvers:
- Jeffwan
- jaypipes
- gjtempleton
- drmorr0
emeritus_approvers:
- Jeffwan
Loading

0 comments on commit fbbd118

Please sign in to comment.