Automatic merge from submit-queue
Cluster-Autoscaler events on status configmap
Write events on status configmap on scale up / scale down. Moved writing to status configmap to a separate file (clusterstate/utils/status.go) to clean up and also allow reasonably isolated unittests.
Automatic merge from submit-queue
Cluster-autoscaler: precheck that the api server link is ok
The logs from leader election are super vague. An explicit check is needed to let the user know that the connection could not be established.
cc: @jszczepkowski @MaciekPytel
Automatic merge from submit-queue
Add mwilegus to /hack/OWNERS
Cluster Autoscaler is an actively developer project and from time to time we have to add couple flags to it. It would be good to be able to have an approval rights for verify-flags.
Automatic merge from submit-queue
Cluster-Autoscaler: fix segfault
StaticAutoscaler.kubeClient was uninitialized,
leading to segfaults when trying to use it. It was
also a duplicate since the client is already available
through AutoscalingContext.
StaticAutoscaler.kubeClient was uninitialized,
leading to segfaults when trying to use it. It was
also a duplicate since the client is already available
through AutoscalingContext.
Automatic merge from submit-queue
Cluster-autoscaler: use listers from ListersRegistry
Fix after #2226.
cc: @mumoshu @fgrzadkowski @jszczepkowski @MaciekPytel
Automatic merge from submit-queue
Cluster-autoscaler: bump version to 0.5.0-alpha1 in preparation for the next release
cc: @fgrzadkowski @jszczepkowski @MaciekPytel
Automatic merge from submit-queue
cluster-autoscaler: Dynamic Reconfiguration via ConfigMaps
This is the first iteration to address #2181.
Please read the discussion in the issue to see more context.
@andrewsykim @Raffo @mwielgus Would you mind reviewing this? 🙇
TODOs:
- [x] Add unit tests
Non-TODOs:
- Automatic creation of configmaps filled with defaults, like cluster-proportional-autoscaler does with `--configmap` with `--default-params`. IMHO doing so is a completely orthogonal issue therefore won't be addressed in this PR.
---
This PR adds a new optional flag named `configmap` to specify the name of a configmap containing node group specs.
The configmap is polled every `scan-interval` seconds to reconfigure cluster-autoscaler dynamically at runtime.
Example usage:
```
./cluster-autoscaler --v=4 --cloud-provider=aws --skip-nodes-with-local-storage=false --logtostderr --leader-elect=false --configmap=cluster-autoscaler --logtostderr
```
The configmap would look like:
```yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: cluster-autoscaler
namespace: kube-system
data:
settings: |-
{
"nodeGroups": [
{
"minSize": 1,
"maxSize": 2,
"name": "kubeawstest-nodepool1-AutoScaleWorker-1VWD4GAVG35L5"
}
]
}
```
Adds a new optional flag named `configmap` to specify the name of a configmap containing node group specs.
The configmap is polled every `scan-interval` seconds to reconfigure cluster-autoscaler dynamically at runtime.
Example usage:
```
./cluster-autoscaler --v=4 --cloud-provider=aws --skip-nodes-with-local-storage=false --logtostderr --leader-elect=false --configmap=cluster-autoscaler --logtostderr
```
The configmap would look like:
```yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: cluster-autoscaler
namespace: kube-system
data:
settings: |-
{
"nodeGroups": [
{
"minSize": 1,
"maxSize": 2,
"name": "kubeawstest-nodepool1-AutoScaleWorker-1VWD4GAVG35L5"
}
]
}
```
Other notes:
* Make namespace defaults to "kube-system"
according to https://github.com/kubernetes/contrib/pull/2226#discussion_r94144267
* Trigger a full-recreate on a configuration change
according to https://github.com/kubernetes/contrib/pull/2226#issuecomment-269617410
* Introduced `autoscaler/` and moved all the dynamic/recreatable-at-runtime parts of autoscaler into there (Update: the package is now named `core` according to https://github.com/kubernetes/contrib/pull/2226#issuecomment-273071663)
* Extracted the core of CA(=`func Run()` in `main.go`) into `Autoscaler`
* `DynamicAutoscaler` is a wrapper around `Autoscaler` which achieves reconfiguration of CA by recreating an `Autoscaler` instance on a configmap change.
* Moved `scale_down*.go`, `scale_up*.go` and `utils*.go` into the `autoscaler` package accordingly because they seemed to be meant to be collocated in the same package as the core of CA (which is now implemented as `Autoscaler`)
* Moved the `createEventRecorder` func from the `main` package to the `utils/kubernetes` package to make it importable from both `main` and `autoscaler`
Automatic merge from submit-queue
Cluster-autoscaler: expand half-deleted pod skip logic in drain
We should not immediately discard deleting nodes from drain to considering a node as empty immediately after the pod deletion was started.
cc: @jszczepkowski @fgrzadkowski @maciekpytel
Automatic merge from submit-queue
Cluster-autoscaler: skip pods that are being deleted in node drain
Pods that are still running but are being deleted should not be deleted/moved in CA.
This also fixes CA against the change in K8S after which the node controller stopped hard-deleting pods (it just sets deletionTimestamp) from unready nodes. With this PR CA will see nodes with all pods under deletion as empty.
cc: @jszczepkowski @gmarek @maciekpytel
Automatic merge from submit-queue
Cluster-autoscaler: GetState() - health condition
This PR is the 1st out of 3 providing ClusterAutoscalerStatus object populated with the current CA state.
cc: @jszczepkowski @fgrzadkowski
Automatic merge from submit-queue
Cluster-autoscaler: api type object for status reporting
As the PR with api (https://github.com/kubernetes/kubernetes/pull/40513) rose some controversy I would like to add it temporarily add it to CA codebase so that CA can use the struct to build the status information. If the PR is approved the api struct will simply be replaced with the one from K8S codebase. If not - a http endpoint using these structs will be exposed in CA.