Skip to content

Commit 1b057c3

Browse files
authored
Merge pull request kubernetes#3032 from tweks/vpa-cr-api
Add ControlledResources to VPA v1 API
2 parents e816740 + 2cfdb76 commit 1b057c3

File tree

9 files changed

+64
-9
lines changed

9 files changed

+64
-9
lines changed

vertical-pod-autoscaler/deploy/vpa-v1-crd.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ spec:
4646
type: array
4747
items:
4848
type: object
49+
properties:
50+
containerName:
51+
type: string
52+
mode:
53+
type: string
54+
enum: ["Auto", "Off"]
55+
minAllowed:
56+
type: object
57+
maxAllowed:
58+
type: object
59+
controlledResources:
60+
type: array
61+
items:
62+
type: string
63+
enum: ["cpu", "memory"]
4964
---
5065
apiVersion: apiextensions.k8s.io/v1beta1
5166
kind: CustomResourceDefinition

vertical-pod-autoscaler/examples/hamster.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ spec:
1414
apiVersion: "apps/v1"
1515
kind: Deployment
1616
name: hamster
17+
resourcePolicy:
18+
containerPolicies:
19+
- containerName: '*'
20+
minAllowed:
21+
cpu: 100m
22+
memory: 50Mi
23+
maxAllowed:
24+
cpu: 1
25+
memory: 500Mi
26+
controlledResources: ["cpu", "memory"]
1727
---
1828
apiVersion: apps/v1
1929
kind: Deployment
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/

vertical-pod-autoscaler/hack/update-codegen.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
2828
${CODEGEN_PKG}/generate-groups.sh all \
2929
k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis \
3030
"autoscaling.k8s.io:v1 autoscaling.k8s.io:v1beta2 autoscaling.k8s.io:v1beta1 poc.autoscaling.k8s.io:v1alpha1" \
31-
--output-base "$(dirname ${BASH_SOURCE})/../../../.."
31+
--output-base "$(dirname ${BASH_SOURCE})/../../../.." \
32+
--go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt
3233

3334
# To use your own boilerplate text append:
3435
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt

vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ type ContainerResourcePolicy struct {
147147
// for the container. The default is no maximum.
148148
// +optional
149149
MaxAllowed v1.ResourceList `json:"maxAllowed,omitempty" protobuf:"bytes,4,rep,name=maxAllowed,casttype=ResourceList,castkey=ResourceName"`
150+
151+
// Specifies the type of recommendations that will be computed
152+
// (and possibly applied) by VPA.
153+
// If not specified, the default of [ResourceCPU, ResourceMemory] will be used.
154+
ControlledResources *[]v1.ResourceName `json:"controlledResources,omitempty" patchStrategy:"merge" protobuf:"bytes,5,rep,name=controlledResources"`
150155
}
151156

152157
const (

vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/zz_generated.deepcopy.go

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta1/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)