Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add VerticalPodAutoscaler to csi controller pod #2536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions deploy/example/vpa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Vertical pod autoscaler to Azure disk CSI controller pods
## Prerequisites: install vertical pod autoscaler
You should install Vertical Pod Autoscaler first, please refer to the [vertical-pod-autoscaler](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md)

## Create a VPA corresponding to CSI controller deployment
> create a VPA for CSI controller
```console
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/azuredisk-csi-driver/master/deploy/example/vpa/vertical-pod-autoscaler.yaml
```
> check the VPA config and current recommended resource requests
```
kubectl get vpa -n kube-system
NAME MODE CPU MEM PROVIDED AGE
csi-azuredisk-controller Auto 15m 43690666 True 8s

kubectl describe vpa csi-azuredisk-controller -n kube-system
Name: csi-azuredisk-controller
Namespace: kube-system
Labels: <none>
Annotations: <none>
API Version: autoscaling.k8s.io/v1
Kind: VerticalPodAutoscaler
Metadata:
Creation Timestamp: 2024-09-25T02:54:36Z
Generation: 1
Resource Version: 417864
UID: 6c393ae3-2f17-4efe-974c-2f0d1f4c635a
Spec:
Resource Policy:
Container Policies:
Container Name: *
Max Allowed:
Cpu: 15m
Memory: 50Gi
Target Ref:
API Version: apps/v1
Kind: Deployment
Name: csi-azuredisk-controller
Update Policy:
Update Mode: Auto
Status:
Conditions:
Last Transition Time: 2024-09-25T02:55:13Z
Status: True
Type: RecommendationProvided
Recommendation:
Container Recommendations:
Container Name: azuredisk
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 15m
Memory: 43690666
Uncapped Target:
Cpu: 23m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 55999064
Container Name: csi-attacher
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 11m
Memory: 43690666
Uncapped Target:
Cpu: 11m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 86115636
Container Name: csi-provisioner
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 11m
Memory: 43690666
Uncapped Target:
Cpu: 11m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 55999064
Container Name: csi-resizer
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 11m
Memory: 43690666
Uncapped Target:
Cpu: 11m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 55999064
Container Name: csi-snapshotter
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 11m
Memory: 43690666
Uncapped Target:
Cpu: 11m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 55999064
Container Name: liveness-probe
Lower Bound:
Cpu: 10m
Memory: 43690666
Target:
Cpu: 11m
Memory: 43690666
Uncapped Target:
Cpu: 11m
Memory: 43690666
Upper Bound:
Cpu: 15m
Memory: 43690666
Events: <none>
```
30 changes: 30 additions & 0 deletions deploy/example/vpa/install-vpa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

set -o errexit
set -o nounset
set -o pipefail
set +o xtrace

repo="https://github.com/kubernetes/autoscaler.git"
echo "Installing VPA ..."
git clone $repo
cd autoscaler/vertical-pod-autoscaler
./hack/vpa-up.sh
./pkg/admission-controller/gencerts.sh
cd ../..
rm -rf autoscaler

echo 'VPA installed successfully.'
29 changes: 29 additions & 0 deletions deploy/example/vpa/uninstall-vpa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

set -o errexit
set -o nounset
set -o pipefail
set +o xtrace

repo="https://github.com/kubernetes/autoscaler.git"
echo "Uninstalling VPA ..."
git clone $repo
cd autoscaler/vertical-pod-autoscaler
./hack/vpa-down.sh
cd ../..
rm -rf autoscaler

echo 'VPA uninstalled successfully.'
16 changes: 16 additions & 0 deletions deploy/example/vpa/vertical-pod-autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
andyzhangx marked this conversation as resolved.
Show resolved Hide resolved
metadata:
name: csi-azuredisk-controller
namespace: kube-system
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: csi-azuredisk-controller
resourcePolicy:
containerPolicies:
- containerName: '*'
maxAllowed:
memory: 50Gi
controlledResources: ["memory"]
2 changes: 1 addition & 1 deletion hack/verify-yamllint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [[ "${deployDirNum}" != "${helmDirNum}" ]]; then
exit 1
fi

for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml" "deploy/example/snapshot/*.yaml" "deploy/example/cloning/*.yaml" "deploy/example/rawblock/*.yaml" "deploy/example/windows/*.yaml" "deploy/example/sharedisk/*.yaml" "deploy/example/modifyvolume/*.yaml" "docs/known-issues/node-shutdown-recovery/*.yaml"
for path in "deploy/*.yaml" "deploy/example/*.yaml" "deploy/example/metrics/*.yaml" "deploy/example/snapshot/*.yaml" "deploy/example/cloning/*.yaml" "deploy/example/rawblock/*.yaml" "deploy/example/windows/*.yaml" "deploy/example/sharedisk/*.yaml" "deploy/example/modifyvolume/*.yaml" "docs/known-issues/node-shutdown-recovery/*.yaml" "deploy/example/vpa/*.yaml"
do
echo "checking yamllint under path: $path ..."
yamllint -f parsable $path | grep -v "line too long" > $LOG
Expand Down
Loading