Commit Graph

951 Commits

Author SHA1 Message Date
Marcin Wielgus 5b4441083a Cluster-autoscaler: include PodDisruptionBudget in drain - part 1/2 2017-03-06 17:15:04 +01:00
Kubernetes Submit Queue adbcee67df Merge pull request https://github.com/kubernetes/contrib/pull/2438 from MaciekPytel/ca_statusmap_events
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.
2017-03-06 04:07:19 -08:00
Maciej Pytel d3bf5d3d51 Cluster-Autoscaler: log events on status configmap 2017-03-06 12:21:24 +01:00
Kubernetes Submit Queue 7ca1dfe33a Merge pull request https://github.com/kubernetes/contrib/pull/2446 from MaciekPytel/ca_fix_unused_param
Automatic merge from submit-queue

Cluster-Autoscaler: fix ignoring node groups config

This bug makes CA pretty much useless.

@mwielgus please review
2017-03-03 08:50:14 -08:00
Maciej Pytel c87d10f042 Cluster-Autoscaler: fix ignoring node groups config 2017-03-03 17:21:24 +01:00
Kubernetes Submit Queue 5f44e025f1 Merge pull request https://github.com/kubernetes/contrib/pull/2445 from mwielgus/precheck
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
2017-03-03 05:57:06 -08:00
Marcin Wielgus 1cd861227a Cluster-autoscaler: precheck that the api server link is ok 2017-03-03 14:39:23 +01:00
Kubernetes Submit Queue 25592dac77 Merge pull request https://github.com/kubernetes/contrib/pull/2432 from MaciekPytel/ca_status_map_flag
Automatic merge from submit-queue

Cluster-Autoscaler: add flag to disable status configmap
2017-03-02 07:30:23 -08:00
Kubernetes Submit Queue 2e180c4c95 Merge pull request https://github.com/kubernetes/contrib/pull/2439 from mwielgus/mwielgus-owners-hack
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.
2017-03-02 07:20:44 -08:00
Maciej Pytel 84f19c1e1e Cluster-Autoscaler: add map to disable status configmap 2017-03-02 15:35:00 +01:00
Kubernetes Submit Queue 5caf10a9c5 Merge pull request https://github.com/kubernetes/contrib/pull/2437 from mwielgus/dep-update-1.5
Automatic merge from submit-queue

Cluster-autoscaler: godep update

Sync with k8s 1.6.

cc: @jszczepkowski @MaciekPytel @piosz
2017-03-02 06:30:40 -08:00
Marcin Wielgus 2ffaddb7c0 Cluster-autoscaler: lint 2017-03-02 15:15:07 +01:00
Marcin Wielgus f648a575e6 Cluster-autoscaler: update godeps 2017-03-02 14:54:19 +01:00
Marcin Wielgus 72a47dc2b2 Cluster-autoscaler: update code for 1.6 k8s sync 2017-03-02 14:34:49 +01:00
Maciej Pytel 4cab3d70bf Cluster-Autoscaler: added wrapper script to pass signals
Running directly through "/bin/sh -c" ignores signals and
only finishes once it gets SIGKILL, so we have no chance
for cleanup.
2017-02-28 17:39:29 +01:00
Maciej Pytel d0196c9e1b Cluster-Autoscaler: Delete status configmap on exit 2017-02-28 17:19:23 +01:00
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
Mik Vyatskov 1bd1ab9572 Set verbosity levels for addon-resizer 2017-01-26 13:46:49 +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