gardener / autoscaler

Customised fork of cluster-autoscaler to support machine-controller-manager
Apache License 2.0
16 stars 25 forks source link

./hack/launch-local-ca.sh for dev productivity #337

Open elankath opened 4 days ago

elankath commented 4 days ago

What this PR does / why we need it:

This change is to assist developer productivity by providing a local CA launch script that copies its configuration from the gardener shoot CA in the control plane avoiding the necessity of developer painfully copying CA flags and making their custom script.

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Release note:

NONE
elankath commented 4 days ago

launch-local-ca.sh

This script requires ./hack/local-setup.sh to be run as prerequisite. It connects to the shoot control plane and copies the configuration of the shoot CA and generates the command to launch the local CA with the same configuration. It also generates a fast launch script at /tmp/fast-launch-ca.sh that can be used to expedite the local CA launch and also allow local editing of configuration params. All logs for the local CA are captured into /tmp/ca-local.log

Example Invocation

(⎈|garden--aws-ha-external:garden shoot--i034796--aw)cluster-autoscaler ➤ ./hack/launch-local-ca.sh                                                                         git:devprod*
NOTE: This script launches the local CA with the same configuration as that of the remote CA in the configured shoot's control plane
Targeting control plane of sap-landscape-dev:i034796:aw
Successfully targeted control plane of shoot "aw"
Downloaded CA Deployment JSON YAML into /tmp/ca-deploy.json

Creating fast launch script at /tmp/fast-launch-ca.sh
Launching local CA using following command in 5 secs. You may also launch using generated fast launch script at: /tmp/fast-launch-ca.sh
go run main.go --kubeconfig=/Users/I034796/go/src/k8s.io/autoscaler/cluster-autoscaler/dev/kubeconfigs/kubeconfig_target.yaml --address=:8085 --cloud-provider=mcm --stderrthreshold=info --skip-nodes-with-system-pods=false --skip-nodes-with-local-storage=false --expendable-pods-priority-cutoff=-10 --balance-similar-node-groups=true --ignore-taint=node.gardener.cloud/critical-components-not-ready --expander=priority --max-graceful-termination-sec=600 --max-node-provision-time=20m0s --scale-down-utilization-threshold=0.500000 --scale-down-unneeded-time=0s --scale-down-delay-after-add=0s --scale-down-delay-after-delete=0s --scale-down-delay-after-failure=0s --scan-interval=10s --ignore-daemonsets-utilization=false --v=3 --max-empty-bulk-delete=10 --new-pod-scale-up-delay=0s --max-nodes-total=4096 --nodes=1:2:shoot--i034796--aw.shoot--i034796--aw-a-z1 --nodes=0:3:shoot--i034796--aw.shoot--i034796--aw-b-z1 --nodes=1:2:shoot--i034796--aw.shoot--i034796--aw-c-z1 --feature-gates=InTreePluginAWSUnregister=true  2>&1 | tee /tmp/ca-local.log
I1121 15:23:58.787966   80166 main.go:647] Cluster Autoscaler 1.30.1
W1121 15:23:58.788799   80166 main.go:652] Error reading gardener autoscaler version, err: read VERSION: is a directory
I1121 15:23:58.788846   80166 client.go:47] Using kubeconfig file: /Users/I034796/go/src/k8s.io/autoscaler/cluster-autoscaler/dev/kubeconfigs/kubeconfig_target.yaml
I1121 15:24:00.121931   80166 leaderelection.go:250] attempting to acquire leader lease kube-system/cluster-autoscaler...
I1121 15:24:00.552012   80166 leaderelection.go:260] successfully acquired lease kube-system/cluster-autoscaler
I1121 15:24:00.552512   80166 client.go:47] Using kubeconfig file: /Users/I034796/go/src/k8s.io/autoscaler/cluster-autoscaler/dev/kubeconfigs/kubeconfig_target.yaml
...
I1121 15:24:00.984645   80166 cloud_provider_builder.go:30] Building mcm cloud provider.
...
I1121 15:24:23.470250   80166 static_autoscaler.go:567] No unschedulable pods