Skip to content

Commit

Permalink
Merge pull request kubernetes-retired/contrib#2437 from mwielgus/dep-…
Browse files Browse the repository at this point in the history
…update-1.5

Automatic merge from submit-queue

Cluster-autoscaler: godep update

Sync with k8s 1.6.

cc: @jszczepkowski @MaciekPytel @piosz
  • Loading branch information
Kubernetes Submit Queue authored Mar 2, 2017
2 parents 7542e18 + 380ed10 commit 1c983bc
Show file tree
Hide file tree
Showing 1,143 changed files with 207,219 additions and 37,148 deletions.
1,154 changes: 637 additions & 517 deletions cluster-autoscaler/Godeps/Godeps.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cluster-autoscaler/config/dynamic/config_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package dynamic
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kube_record "k8s.io/client-go/tools/record"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"
)

// ConfigFetcher fetches the up-to-date dynamic configuration from the apiserver
Expand Down
6 changes: 3 additions & 3 deletions cluster-autoscaler/config/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"strconv"

"k8s.io/apimachinery/pkg/runtime/schema"
kube_rest "k8s.io/kubernetes/pkg/client/restclient"
kube_client_cmd "k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
kube_client_cmd_api "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
kube_rest "k8s.io/client-go/rest"
kube_client_cmd "k8s.io/client-go/tools/clientcmd"
kube_client_cmd_api "k8s.io/client-go/tools/clientcmd/api"
)

// This code was borrowed from Heapster to push the work forward and contains some functionality
Expand Down
5 changes: 2 additions & 3 deletions cluster-autoscaler/core/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ package core
import (
"time"

kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"

kube_record "k8s.io/client-go/tools/record"
"k8s.io/contrib/cluster-autoscaler/config/dynamic"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
)

// AutoscalerOptions is the whole set of options for configuring an autoscaler
Expand Down
16 changes: 7 additions & 9 deletions cluster-autoscaler/core/autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ limitations under the License.
package core

import (
"fmt"
"testing"
"time"

"k8s.io/contrib/cluster-autoscaler/config/dynamic"

"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
"k8s.io/kubernetes/pkg/client/testing/core"

. "k8s.io/contrib/cluster-autoscaler/utils/test"

"fmt"
"github.com/stretchr/testify/assert"
core "k8s.io/client-go/testing"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
"time"
. "k8s.io/contrib/cluster-autoscaler/utils/test"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
)

func TestNewAutoscalerStatic(t *testing.T) {
Expand Down
13 changes: 6 additions & 7 deletions cluster-autoscaler/core/autoscaling_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ limitations under the License.
package core

import (
"k8s.io/contrib/cluster-autoscaler/cloudprovider/builder"
"k8s.io/contrib/cluster-autoscaler/expander"
"k8s.io/contrib/cluster-autoscaler/simulator"

kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"
"time"

kube_record "k8s.io/client-go/tools/record"
"k8s.io/contrib/cluster-autoscaler/cloudprovider"
"k8s.io/contrib/cluster-autoscaler/cloudprovider/builder"
"k8s.io/contrib/cluster-autoscaler/clusterstate"
"k8s.io/contrib/cluster-autoscaler/expander"
"k8s.io/contrib/cluster-autoscaler/expander/factory"
"time"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
)

// AutoscalingContext contains user-configurable constant and configuration-related objects passed to
Expand Down
8 changes: 3 additions & 5 deletions cluster-autoscaler/core/dynamic_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ import (
"fmt"
"time"

"github.com/golang/glog"
kube_record "k8s.io/client-go/tools/record"
"k8s.io/contrib/cluster-autoscaler/config/dynamic"
"k8s.io/contrib/cluster-autoscaler/metrics"

kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"

"github.com/golang/glog"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
)

// DynamicAutoscaler is a variant of autoscaler which supports dynamic reconfiguration at runtime
Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/core/scale_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kube_record "k8s.io/client-go/tools/record"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"

"github.com/golang/glog"
Expand Down Expand Up @@ -344,7 +344,7 @@ func drainNode(node *apiv1.Node, pods []*apiv1.Pod, client kube_client.Interface
maxGraceful64 := int64(maxGratefulTerminationSec)
for _, pod := range pods {
recorder.Eventf(pod, apiv1.EventTypeNormal, "ScaleDown", "deleting pod for node scale down")
err := client.Core().Pods(pod.Namespace).Delete(pod.Name, &apiv1.DeleteOptions{
err := client.Core().Pods(pod.Namespace).Delete(pod.Name, &metav1.DeleteOptions{
GracePeriodSeconds: &maxGraceful64,
})
if err != nil {
Expand Down
9 changes: 4 additions & 5 deletions cluster-autoscaler/core/scale_down_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ import (
"testing"
"time"

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
core "k8s.io/client-go/testing"
"k8s.io/contrib/cluster-autoscaler/cloudprovider/test"
"k8s.io/contrib/cluster-autoscaler/clusterstate"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
. "k8s.io/contrib/cluster-autoscaler/utils/test"

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
batchv1 "k8s.io/kubernetes/pkg/apis/batch/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
"k8s.io/kubernetes/pkg/client/testing/core"

"github.com/stretchr/testify/assert"
)
Expand Down
10 changes: 4 additions & 6 deletions cluster-autoscaler/core/scale_up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/runtime"
core "k8s.io/client-go/testing"
"k8s.io/contrib/cluster-autoscaler/cloudprovider/test"
"k8s.io/contrib/cluster-autoscaler/clusterstate"
"k8s.io/contrib/cluster-autoscaler/estimator"
"k8s.io/contrib/cluster-autoscaler/expander/random"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
. "k8s.io/contrib/cluster-autoscaler/utils/test"

"k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
"k8s.io/kubernetes/pkg/client/testing/core"

"github.com/stretchr/testify/assert"
"k8s.io/contrib/cluster-autoscaler/estimator"
)

func TestScaleUpOK(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kube_record "k8s.io/client-go/tools/record"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_record "k8s.io/kubernetes/pkg/client/record"

"github.com/golang/glog"
"k8s.io/contrib/cluster-autoscaler/simulator"
Expand Down Expand Up @@ -266,7 +266,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) {
// ExitCleanUp removes status configmap.
func (a *StaticAutoscaler) ExitCleanUp() {
maps := a.AutoscalingContext.ClientSet.CoreV1().ConfigMaps(StatusConfigMapNamespace)
err := maps.Delete(StatusConfigMapName, &apiv1.DeleteOptions{})
err := maps.Delete(StatusConfigMapName, &metav1.DeleteOptions{})
if err != nil {
// Nothing else we could do at this point
glog.Error("Failed to delete status configmap")
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/estimator/binpacking_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package estimator
import (
"sort"

"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/contrib/cluster-autoscaler/simulator"
"k8s.io/kubernetes/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/estimator/binpacking_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"testing"
"time"

"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/contrib/cluster-autoscaler/simulator"
. "k8s.io/contrib/cluster-autoscaler/utils/test"
"k8s.io/kubernetes/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"

Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/estimator/estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"math"

"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/estimator/estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package estimator
import (
"testing"

"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"

Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/expander/waste/waste.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package waste

import (
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/contrib/cluster-autoscaler/expander"
"k8s.io/contrib/cluster-autoscaler/expander/random"
"k8s.io/kubernetes/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/expander/waste/waste_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
. "k8s.io/contrib/cluster-autoscaler/utils/test"

"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/contrib/cluster-autoscaler/expander"
"k8s.io/kubernetes/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
Expand Down
8 changes: 4 additions & 4 deletions cluster-autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kube_flag "k8s.io/apiserver/pkg/util/flag"
"k8s.io/contrib/cluster-autoscaler/config"
"k8s.io/contrib/cluster-autoscaler/config/dynamic"
"k8s.io/contrib/cluster-autoscaler/core"
"k8s.io/contrib/cluster-autoscaler/estimator"
"k8s.io/contrib/cluster-autoscaler/expander"
"k8s.io/contrib/cluster-autoscaler/metrics"
"k8s.io/contrib/cluster-autoscaler/simulator"
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kube_leaderelection "k8s.io/kubernetes/pkg/client/leaderelection"
"k8s.io/kubernetes/pkg/client/leaderelection/resourcelock"
kube_flag "k8s.io/kubernetes/pkg/util/flag"

"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/pflag"
"k8s.io/contrib/cluster-autoscaler/estimator"
"k8s.io/contrib/cluster-autoscaler/metrics"
"k8s.io/contrib/cluster-autoscaler/simulator"
)

// MultiStringFlag is a flag for passing multiple parameters using same flag
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/simulator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"math/rand"
"time"

"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
Expand Down
5 changes: 3 additions & 2 deletions cluster-autoscaler/simulator/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package simulator
import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/contrib/cluster-autoscaler/utils/drain"
api "k8s.io/kubernetes/pkg/api"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)

Expand All @@ -33,7 +34,7 @@ import (
func GetRequiredPodsForNode(nodename string, client kube_client.Interface) ([]*apiv1.Pod, error) {

podListResult, err := client.Core().Pods(apiv1.NamespaceAll).List(
apiv1.ListOptions{FieldSelector: fields.SelectorFromSet(fields.Set{"spec.nodeName": nodename}).String()})
metav1.ListOptions{FieldSelector: fields.SelectorFromSet(fields.Set{"spec.nodeName": nodename}).String()})
if err != nil {
return []*apiv1.Pod{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion cluster-autoscaler/simulator/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
core "k8s.io/client-go/testing"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/kubelet/types"

"github.com/stretchr/testify/assert"
Expand Down
16 changes: 15 additions & 1 deletion cluster-autoscaler/simulator/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
kube_util "k8s.io/contrib/cluster-autoscaler/utils/kubernetes"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
kube_client "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
informers "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm"
"k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
"k8s.io/kubernetes/plugin/pkg/scheduler/factory"
Expand All @@ -42,7 +43,20 @@ func NewPredicateChecker(kubeClient kube_client.Interface) (*PredicateChecker, e
if err != nil {
return nil, err
}
schedulerConfigFactory := factory.NewConfigFactory(kubeClient, "", apiv1.DefaultHardPodAffinitySymmetricWeight, apiv1.DefaultFailureDomains)
informerFactory := informers.NewSharedInformerFactory(kubeClient, 0)

schedulerConfigFactory := factory.NewConfigFactory(
"cluster-autoscaler",
kubeClient,
informerFactory.Core().V1().Nodes(),
informerFactory.Core().V1().PersistentVolumes(),
informerFactory.Core().V1().PersistentVolumeClaims(),
informerFactory.Core().V1().ReplicationControllers(),
informerFactory.Extensions().V1beta1().ReplicaSets(),
informerFactory.Core().V1().Services(),
apiv1.DefaultHardPodAffinitySymmetricWeight,
)

predicates, err := schedulerConfigFactory.GetPredicates(provider.FitPredicateKeys)
predicates["ready"] = isNodeReadyAndSchedulablePredicate
if err != nil {
Expand Down
Loading

0 comments on commit 1c983bc

Please sign in to comment.