Commit Graph

460 Commits

Author SHA1 Message Date
Kubernetes Submit Queue 35b0103b36 Merge pull request https://github.com/kubernetes/contrib/pull/2430 from fate-grand-order/patch-3
Automatic merge from submit-queue

fix misspell "being" in drain.go
2017-02-28 05:43:08 -08:00
Kubernetes Submit Queue 4c9c346770 Merge pull request https://github.com/kubernetes/contrib/pull/2429 from MaciekPytel/ca_configmap_status
Automatic merge from submit-queue

Cluster-Autoscaler: Write status to configmap
2017-02-28 04:22:03 -08:00
fate-grand-order 82e148507f fix misspell "being" in drain.go 2017-02-28 18:20:06 +08:00
Maciej Pytel 497d2800ea Cluster-Autoscaler: Write status to configmap 2017-02-28 09:59:40 +01:00
Kubernetes Submit Queue 8f7a6d38ab Merge pull request https://github.com/kubernetes/contrib/pull/2428 from MaciekPytel/fix_ca_client_init
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.
2017-02-27 05:30:36 -08:00
Maciej Pytel 637e750246 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.
2017-02-27 14:13:54 +01:00
Kubernetes Submit Queue 067cb842b3 Merge pull request https://github.com/kubernetes/contrib/pull/2419 from mwielgus/dyn-fix
Automatic merge from submit-queue

Cluster-autoscaler: use listers from ListersRegistry

Fix after #2226.

cc: @mumoshu @fgrzadkowski @jszczepkowski @MaciekPytel
2017-02-26 17:05:51 -08:00
Marcin Wielgus 83fdeb184f Cluster-autoscaler: use listers from ListersRegistry 2017-02-24 20:40:53 +01:00
Kubernetes Submit Queue 8016f6a267 Merge pull request https://github.com/kubernetes/contrib/pull/2418 from mwielgus/ca-0.5-alpha1
Automatic merge from submit-queue

Cluster-autoscaler: bump version to 0.5.0-alpha1 in preparation for the next release

cc: @fgrzadkowski @jszczepkowski @MaciekPytel
2017-02-24 06:21:25 -08:00
Marcin Wielgus c766b8b0f8 Cluster-autoscaler: bump version to 0.5.0-alpha1 in preparation for the next release 2017-02-24 15:08:46 +01:00
Kubernetes Submit Queue 182ad90fff Merge pull request https://github.com/kubernetes/contrib/pull/2226 from mumoshu/dynamic-reconfiguration-via-configmap
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"
        }
      ]
    }
 ```
2017-02-24 05:03:53 -08:00
Yusuke Kuoka baee799524 cluster-autoscaler: Dynamic Reconfiguration via ConfigMaps
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`
2017-02-24 20:36:47 +09:00
Kubernetes Submit Queue 8a7674744c Merge pull request https://github.com/kubernetes/contrib/pull/2413 from MaciekPytel/ca_log_collector
Automatic merge from submit-queue

Cluster-autoscaler: implemented LogCollector
2017-02-23 09:09:05 -08:00
Maciej Pytel 585c46419d Cluster-autoscaler: implemented LogCollector 2017-02-23 17:57:59 +01:00
Kubernetes Submit Queue bd8e2b3a97 Merge pull request https://github.com/kubernetes/contrib/pull/2411 from mwielgus/expanded-drain
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
2017-02-23 08:44:32 -08:00
Marcin Wielgus 89a370de1a Cluster-autoscaler: expand half-deleted pod skip logic in drain 2017-02-23 16:43:32 +01:00
Kubernetes Submit Queue 7fc42e9419 Merge pull request https://github.com/kubernetes/contrib/pull/2409 from MaciekPytel/ca_status_string
Automatic merge from submit-queue

Cluster-autoscaler: readable status printing

Example output (github seems to slightly mess up tabs):
```
Health:      Healthy (ready=0 unready=1 notStarted=0 longNotStarted=0 registered=1)
             LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                     
             LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC                     
ScaleUp:     NoActivity (ready=0 registered=1)                                     
             LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                     
             LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC                     
ScaleDown:   NoCandidates (candidates=0)                                           
             LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                     
             LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC                     
                                                                                   
NodeGroups:                                                                        
  Name:        ng1                                                                 
  Health:      Unhealthy (ready=0 unready=1 notStarted=0 longNotStarted=0 registered=1 cloudProviderTarget=5 (min=5, max=5))
               LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                   
               LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC                   
  ScaleUp:     NoActivity (ready=0 cloudProviderTarget=5)                          
               LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                   
               LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC                   
  ScaleDown:   NoCandidates (candidates=0)                                         
               LastProbeTime:      0001-01-01 00:00:00 +0000 UTC                   
               LastTransitionTime: 0001-01-01 00:00:00 +0000 UTC
```
2017-02-23 06:38:58 -08:00
fate-grand-order 2f3b410844 fix missspell in clusterstate.go 2017-02-23 21:42:03 +08:00
Maciej Pytel b7e79af2d8 Cluster-autoscaler: readable status printing 2017-02-23 13:24:48 +01:00
Kubernetes Submit Queue da8af7bdec Merge pull request https://github.com/kubernetes/contrib/pull/2404 from mwielgus/drain-delete
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
2017-02-22 06:19:35 -08:00
Marcin Wielgus 1bb3a0aeb2 Merge branch 'master' into drain-delete 2017-02-22 14:22:56 +01:00
Marcin Wielgus e3395fdae7 Cluster-autoscaler: skip pods that are being deleted in node drain 2017-02-22 14:09:39 +01:00
Kubernetes Submit Queue 323f0ef57f Merge pull request https://github.com/kubernetes/contrib/pull/2401 from mwielgus/scaledown-status
Automatic merge from submit-queue

Cluster-autoscaler: GetStatus - scaleDown

Follow up of #2400. 

cc: @jszczepkowski @fgrzadkowski
2017-02-22 02:53:26 -08:00
Kubernetes Submit Queue df430322a6 Merge pull request https://github.com/kubernetes/contrib/pull/2370 from philk/fix-aws-asg-nodes
Automatic merge from submit-queue

Return correct ProviderID format from GetAsgNodes

This matches the way that the [gce does it][1] and fixes issues with the
[cluster state][2].

[1]: https://github.com/kubernetes/contrib/blob/master/cluster-autoscaler/cloudprovider/gce/gce_manager.go#L247
[2]: https://github.com/kubernetes/contrib/issues/2228#issuecomment-274896211
2017-02-21 18:56:21 -08:00
Phil Kates c2cb357e7d Return correct ProviderID format from GetAsgNodes
This matches the way that the [gce does it][1] and fixes issues with the
[cluster state][2].

1: https://github.com/kubernetes/contrib/blob/master/cluster-autoscaler/cloudprovider/gce/gce_manager.go#L247
2: https://github.com/kubernetes/contrib/issues/2228#issuecomment-274896211
2017-02-21 12:06:12 -08:00
Marcin Wielgus 8cfed0b474 Cluster-autoscaler: GetStatus - scaleDown 2017-02-21 19:56:07 +01:00
Kubernetes Submit Queue 4d9770939d Merge pull request https://github.com/kubernetes/contrib/pull/2400 from mwielgus/scaleup-status
Automatic merge from submit-queue

Cluster-autoscaler: getStatus() - scale up

Follow up on 2398.

cc: @jszczepkowski @fgrzadkowski
2017-02-21 07:38:08 -08:00
Marcin Wielgus 87f0d62b28 Cluster-autoscaler: scale up status 2017-02-21 16:21:36 +01:00
Kubernetes Submit Queue c90ff01538 Merge pull request https://github.com/kubernetes/contrib/pull/2398 from mwielgus/health-condition
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
2017-02-21 04:33:02 -08:00
Marcin Wielgus d9d5a751f5 Cluster-autoscaler: GetState() - health condition 2017-02-21 13:15:19 +01:00
Kubernetes Submit Queue fccb14efb3 Merge pull request https://github.com/kubernetes/contrib/pull/2396 from mwielgus/ca-api-ca
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.
2017-02-20 08:39:38 -08:00
Marcin Wielgus d42ef4e1ea Cluster-autoscaler: api type object for status reporting 2017-02-20 17:15:40 +01:00
Kubernetes Submit Queue b2c7228d19 Merge pull request https://github.com/kubernetes/contrib/pull/2146 from eastbanctech/feature/azure-autoscaling
Automatic merge from submit-queue

Support for Azure in cluster-autoscaler

See issue #2145
2017-01-20 11:19:11 -08:00
Oleg Atamanenko 451a779dfa Add support for Azure in cluster-autoscaler 2017-01-20 12:40:58 -05:00
Marcin Wielgus 44f1caea84 Merge pull request https://github.com/kubernetes/contrib/pull/2325 from mwielgus/godep_update_01
Cluster-autoscaler: godeps update
2017-01-20 15:48:17 +01:00
Marcin Wielgus 15025da6e7 Cluster-autoscaler: godep update 2017-01-20 15:23:01 +01:00
Marcin Wielgus ce45c33d29 Cluster-autoscaler: update CA code for godep refresh 2017-01-20 14:46:34 +01:00
Marcin Wielgus c57810d1b0 Merge pull request https://github.com/kubernetes/contrib/pull/2314 from mwielgus/enable-unready
Cluster-autoscaler: add NodeReadyPredicate and allow unready nodes in CA
2017-01-18 15:49:29 +01:00
Marcin Wielgus 1d19914f93 Merge branch 'master' into enable-unready 2017-01-18 15:10:50 +01:00
Marcin Wielgus b57ab3b48a Cluster-autoscaler: add NodeReadyPredicate and allow unready nodes in CA 2017-01-18 15:09:59 +01:00
Marcin Wielgus da2c6232aa Merge pull request https://github.com/kubernetes/contrib/pull/2315 from Wattpad/update-cluster-autoscaler-aws-docs
Cluster Autoscaler: update AWS docs to include expansion options
2017-01-18 00:20:06 +01:00
Marcin Wielgus 06c30c6768 Merge branch 'master' into update-cluster-autoscaler-aws-docs 2017-01-17 23:40:55 +01:00
Marcin Wielgus 06a3092956 Merge pull request https://github.com/kubernetes/contrib/pull/2318 from andrewsykim/cluster-autoscaler-fix-typos
cluster autoscaler: fix typos
2017-01-17 22:41:28 +01:00
andrewsykim 07c753ba9a cluster autoscaler: fix typos 2017-01-17 12:57:01 -05:00
andrewsykim 81f5d80fae Update AWS docs to include --expander option flag and other common notes and gotchas 2017-01-17 11:22:37 -05:00
Kubernetes Submit Queue d09041ebeb Merge pull request https://github.com/kubernetes/contrib/pull/2310 from mwielgus/use-decrease
Automatic merge from submit-queue

Cluster-autoscaler: decrease node group target size if no new nodes arrive in reasonable time

cc: @jszczepkowski @andrewsykim @fgrzadkowski
2017-01-17 01:38:16 -08:00
Marcin Wielgus f676a34a58 Cluster-autoscaler: decrease node group target size if no new nodes arrive in reasonable time 2017-01-16 23:16:03 +01:00
Kubernetes Submit Queue fc2d36d314 Merge pull request https://github.com/kubernetes/contrib/pull/2300 from mwielgus/decrease-size
Automatic merge from submit-queue

Cluster-autoscaler: decrease target size function in cloud provider interface

Sometimes the cloud provider has troubles with providing the requested amount of nodes either due to quota or to (temporary) technical limitations. In such a case CA should be able to change the previously made request without killing any of the existing nodes. 

@andrewsykim - will this PR work on AWS?

cc: @jszczepkowski @andrewsykim @fgrzadkowski
2017-01-16 06:48:06 -08:00
Marcin Wielgus cfc1117a17 Cluster-autoscaler: decrease target size function in cloud provider interface 2017-01-16 15:20:45 +01:00
Kubernetes Submit Queue 9ff22c97c1 Merge pull request https://github.com/kubernetes/contrib/pull/2299 from mwielgus/clean-at-begin
Automatic merge from submit-queue

Cluster-autoscaler: clear to be deleted taints only at the startup

We want to clean the taint only at the startup. Currently it will remove the taint also from nodes that have just been deleted but not marked as unready by node controller. 

cc: @jszczepkowski @fgrzadkowski
2017-01-13 05:51:38 -08:00