Skip to content

Commit

Permalink
remove min/maxAllowed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gardener CI/CD committed Sep 27, 2024
1 parent 28d0e18 commit 142b56a
Show file tree
Hide file tree
Showing 16 changed files with 2 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ metadata:
name: {{ include "name" . }}-vpa
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.global.vpa.resourcePolicy }}
resourcePolicy:
containerPolicies:
- containerName: '*'
minAllowed:
memory: {{ required ".Values.global.vpa.resourcePolicy.minAllowed.memory is required" .Values.global.vpa.resourcePolicy.minAllowed.memory }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: Deployment
Expand Down
3 changes: 0 additions & 3 deletions charts/gardener-extension-admission-azure/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ global:
healthPort: 8081
vpa:
enabled: true
resourcePolicy:
minAllowed:
memory: 64Mi
updatePolicy:
updateMode: "Auto"
webhookConfig:
Expand Down
7 changes: 0 additions & 7 deletions charts/gardener-extension-provider-azure/templates/vpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ metadata:
name: {{ include "name" . }}-vpa
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.vpa.resourcePolicy }}
resourcePolicy:
containerPolicies:
- containerName: '*'
minAllowed:
memory: {{ required ".Values.vpa.resourcePolicy.minAllowed.memory is required" .Values.vpa.resourcePolicy.minAllowed.memory }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: Deployment
Expand Down
3 changes: 0 additions & 3 deletions charts/gardener-extension-provider-azure/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ maxSurge: 50%
resources: {}
vpa:
enabled: true
resourcePolicy:
minAllowed:
memory: 64Mi
updatePolicy:
updateMode: "Auto"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ spec:
resourcePolicy:
containerPolicies:
- containerName: azure-cloud-controller-manager
minAllowed:
memory: {{ .Values.resources.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.maxAllowed.memory }}
controlledValues: RequestsOnly
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ resources:
tlsCipherSuites: []
secrets:
server: cloud-controller-manager-server
vpa:
resourcePolicy:
maxAllowed:
cpu: 4
memory: 10G

# TODO(rfranzke): Remove this field after August 2024.
gep19Monitoring: false
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ spec:
resourcePolicy:
containerPolicies:
- containerName: azure-csi-snapshot-controller
minAllowed:
memory: {{ .Values.csiSnapshotController.resources.requests.memory }}
controlledValues: RequestsOnly
targetRef:
apiVersion: apps/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ spec:
resourcePolicy:
containerPolicies:
- containerName: azure-csi-snapshot-validation
minAllowed:
memory: {{ .Values.csiSnapshotValidationWebhook.resources.requests.memory }}
controlledValues: RequestsOnly
targetRef:
apiVersion: apps/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,16 @@ spec:
resourcePolicy:
containerPolicies:
- containerName: azure-csi-driver
minAllowed:
{{- if eq .role "disk" }}
{{- if .Values.resources.csiDriverDisk }}
memory: {{ .Values.resources.csiDriverDisk.requests.memory }}
{{- end }}
{{- end }}
{{- if eq .role "file" }}
{{- if .Values.resources.csiDriverFile }}
memory: {{ .Values.resources.csiDriverFile.requests.memory }}
{{- end }}
{{- end }}
maxAllowed:
{{- if eq .role "disk" }}
{{- if .Values.vpa.resourcePolicy.csiDriverDisk }}
memory: {{ .Values.vpa.resourcePolicy.csiDriverDisk.maxAllowed.memory }}
cpu: {{ .Values.vpa.resourcePolicy.csiDriverDisk.maxAllowed.cpu }}
{{- end }}
{{- end }}
{{- if eq .role "file" }}
{{- if .Values.vpa.resourcePolicy.csiDriverFile }}
memory: {{ .Values.vpa.resourcePolicy.csiDriverFile.maxAllowed.memory }}
cpu: {{ .Values.vpa.resourcePolicy.csiDriverFile.maxAllowed.cpu }}
{{- end }}
{{- end }}
controlledValues: RequestsOnly
- containerName: azure-csi-provisioner
minAllowed:
memory: {{ .Values.resources.provisioner.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.provisioner.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.provisioner.maxAllowed.memory }}
controlledValues: RequestsOnly
- containerName: azure-csi-attacher
minAllowed:
memory: {{ .Values.resources.attacher.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.attacher.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.attacher.maxAllowed.memory }}
controlledValues: RequestsOnly
- containerName: azure-csi-snapshotter
minAllowed:
memory: {{ .Values.resources.snapshotter.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.snapshotter.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.snapshotter.maxAllowed.memory }}
controlledValues: RequestsOnly
- containerName: azure-csi-resizer
minAllowed:
memory: {{ .Values.resources.resizer.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.resizer.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.resizer.maxAllowed.memory }}
controlledValues: RequestsOnly
- containerName: azure-csi-liveness-probe
minAllowed:
memory: {{ .Values.resources.livenessProbe.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.livenessProbe.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.livenessProbe.maxAllowed.memory }}
controlledValues: RequestsOnly
targetRef:
apiVersion: apps/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,6 @@ resources:
cpu: 11m
memory: 40Mi

vpa:
resourcePolicy:
csiDriverDisk:
maxAllowed:
cpu: 800m
memory: 4G
csiDriverFile:
maxAllowed:
cpu: 800m
memory: 4G
provisioner:
maxAllowed:
cpu: 800m
memory: 4G
attacher:
maxAllowed:
cpu: 500m
memory: 4G
snapshotter:
maxAllowed:
cpu: 700m
memory: 3G
resizer:
maxAllowed:
cpu: 700m
memory: 3G
livenessProbe:
maxAllowed:
cpu: 500m
memory: 2G

csiSnapshotController:
replicas: 1
podAnnotations: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ spec:
containerPolicies:
- containerName: cloud-node-manager
controlledValues: RequestsOnly
minAllowed:
memory: 25Mi
targetRef:
apiVersion: apps/v1
kind: DaemonSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,10 @@ spec:
resourcePolicy:
containerPolicies:
- containerName: csi-driver
minAllowed:
{{- if eq .role "disk" }}
{{- if .Values.resources.csiDriverDisk }}
memory: {{ .Values.resources.csiDriverDisk.requests.memory }}
{{- end }}
{{- end }}
{{- if eq .role "file" }}
{{- if .Values.resources.csiDriverFile }}
memory: {{ .Values.resources.csiDriverFile.requests.memory }}
{{- end }}
{{- end }}
maxAllowed:
{{- if eq .role "disk" }}
{{- if .Values.vpa.resourcePolicy.csiDriverDisk }}
memory: {{ .Values.vpa.resourcePolicy.csiDriverDisk.maxAllowed.memory }}
cpu: {{ .Values.vpa.resourcePolicy.csiDriverDisk.maxAllowed.cpu }}
{{- end }}
{{- end }}
{{- if eq .role "file" }}
{{- if .Values.resources.csiDriverFile }}
memory: {{ .Values.vpa.resourcePolicy.csiDriverFile.maxAllowed.memory }}
cpu: {{ .Values.vpa.resourcePolicy.csiDriverFile.maxAllowed.cpu }}
{{- end }}
{{- end }}
controlledValues: RequestsOnly
- containerName: csi-node-driver-registrar
minAllowed:
memory: {{ .Values.resources.nodeDriverRegistrar.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.nodeDriverRegistrar.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.nodeDriverRegistrar.maxAllowed.memory }}
controlledValues: RequestsOnly
- containerName: csi-liveness-probe
minAllowed:
memory: {{ .Values.resources.livenessProbe.requests.memory }}
maxAllowed:
cpu: {{ .Values.vpa.resourcePolicy.livenessProbe.maxAllowed.cpu }}
memory: {{ .Values.vpa.resourcePolicy.livenessProbe.maxAllowed.memory }}
controlledValues: RequestsOnly
targetRef:
apiVersion: apps/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,3 @@ resources:
requests:
cpu: 11m
memory: 32Mi

vpa:
resourcePolicy:
csiDriverDisk:
maxAllowed:
cpu: 2
memory: 4G
csiDriverFile:
maxAllowed:
cpu: 2
memory: 4G
nodeDriverRegistrar:
maxAllowed:
cpu: 1
memory: 3G
livenessProbe:
maxAllowed:
cpu: 1
memory: 3G
2 changes: 1 addition & 1 deletion example/controller-registration.yaml

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions pkg/webhook/controlplane/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
vpaautoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"
Expand Down Expand Up @@ -73,23 +72,13 @@ func (e *ensurer) EnsureMachineControllerManagerDeployment(_ context.Context, _

// EnsureMachineControllerManagerVPA ensures that the machine-controller-manager VPA conforms to the provider requirements.
func (e *ensurer) EnsureMachineControllerManagerVPA(_ context.Context, _ gcontext.GardenContext, newObj, _ *vpaautoscalingv1.VerticalPodAutoscaler) error {
var (
minAllowed = corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("64Mi"),
}
maxAllowed = corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("2"),
corev1.ResourceMemory: resource.MustParse("5G"),
}
)

if newObj.Spec.ResourcePolicy == nil {
newObj.Spec.ResourcePolicy = &vpaautoscalingv1.PodResourcePolicy{}
}

newObj.Spec.ResourcePolicy.ContainerPolicies = extensionswebhook.EnsureVPAContainerResourcePolicyWithName(
newObj.Spec.ResourcePolicy.ContainerPolicies,
machinecontrollermanager.ProviderSidecarVPAContainerPolicy(azure.Name, minAllowed, maxAllowed),
machinecontrollermanager.ProviderSidecarVPAContainerPolicy(azure.Name, nil, nil),
)
return nil
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/webhook/controlplane/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -542,13 +541,6 @@ var _ = Describe("Ensurer", func() {
Expect(vpa.Spec.ResourcePolicy.ContainerPolicies).To(ConsistOf(vpaautoscalingv1.ContainerResourcePolicy{
ContainerName: "machine-controller-manager-provider-azure",
ControlledValues: &ccv,
MinAllowed: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("64Mi"),
},
MaxAllowed: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("2"),
corev1.ResourceMemory: resource.MustParse("5G"),
},
}))
})
})
Expand Down

0 comments on commit 142b56a

Please sign in to comment.