Commit f756e43e authored by deads2k's avatar deads2k

convert rolling updater to generated client

parent 11c4de45
...@@ -25,20 +25,24 @@ import ( ...@@ -25,20 +25,24 @@ import (
"k8s.io/kubernetes/pkg/apis/apps" "k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
appsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/unversioned"
batchclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
extensionsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
"k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/watch" "k8s.io/kubernetes/pkg/watch"
) )
// ControllerHasDesiredReplicas returns a condition that will be true if and only if // ControllerHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a controller's ReplicaSelector equals the Replicas count. // the desired replica count for a controller's ReplicaSelector equals the Replicas count.
func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc { func ControllerHasDesiredReplicas(rcClient coreclient.ReplicationControllersGetter, controller *api.ReplicationController) wait.ConditionFunc {
// If we're given a controller where the status lags the spec, it either means that the controller is stale, // If we're given a controller where the status lags the spec, it either means that the controller is stale,
// or that the rc manager hasn't noticed the update yet. Polling status.Replicas is not safe in the latter case. // or that the rc manager hasn't noticed the update yet. Polling status.Replicas is not safe in the latter case.
desiredGeneration := controller.Generation desiredGeneration := controller.Generation
return func() (bool, error) { return func() (bool, error) {
ctrl, err := c.ReplicationControllers(controller.Namespace).Get(controller.Name) ctrl, err := rcClient.ReplicationControllers(controller.Namespace).Get(controller.Name)
if err != nil { if err != nil {
return false, err return false, err
} }
...@@ -52,7 +56,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro ...@@ -52,7 +56,7 @@ func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationContro
// ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if // ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count. // the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count.
func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc { func ReplicaSetHasDesiredReplicas(rsClient extensionsclient.ReplicaSetsGetter, replicaSet *extensions.ReplicaSet) wait.ConditionFunc {
// If we're given a ReplicaSet where the status lags the spec, it either means that the // If we're given a ReplicaSet where the status lags the spec, it either means that the
// ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet. // ReplicaSet is stale, or that the ReplicaSet manager hasn't noticed the update yet.
...@@ -60,7 +64,7 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions. ...@@ -60,7 +64,7 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.
desiredGeneration := replicaSet.Generation desiredGeneration := replicaSet.Generation
return func() (bool, error) { return func() (bool, error) {
rs, err := c.ReplicaSets(replicaSet.Namespace).Get(replicaSet.Name) rs, err := rsClient.ReplicaSets(replicaSet.Namespace).Get(replicaSet.Name)
if err != nil { if err != nil {
return false, err return false, err
} }
...@@ -73,10 +77,10 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions. ...@@ -73,10 +77,10 @@ func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.
} }
} }
func PetSetHasDesiredPets(c AppsInterface, petset *apps.PetSet) wait.ConditionFunc { func PetSetHasDesiredPets(psClient appsclient.PetSetsGetter, petset *apps.PetSet) wait.ConditionFunc {
// TODO: Differentiate between 0 pets and a really quick scale down using generation. // TODO: Differentiate between 0 pets and a really quick scale down using generation.
return func() (bool, error) { return func() (bool, error) {
ps, err := c.PetSets(petset.Namespace).Get(petset.Name) ps, err := psClient.PetSets(petset.Namespace).Get(petset.Name)
if err != nil { if err != nil {
return false, err return false, err
} }
...@@ -86,10 +90,9 @@ func PetSetHasDesiredPets(c AppsInterface, petset *apps.PetSet) wait.ConditionFu ...@@ -86,10 +90,9 @@ func PetSetHasDesiredPets(c AppsInterface, petset *apps.PetSet) wait.ConditionFu
// JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count // JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count
// for a job equals the current active counts or is less by an appropriate successful/unsuccessful count. // for a job equals the current active counts or is less by an appropriate successful/unsuccessful count.
func JobHasDesiredParallelism(c BatchInterface, job *batch.Job) wait.ConditionFunc { func JobHasDesiredParallelism(jobClient batchclient.JobsGetter, job *batch.Job) wait.ConditionFunc {
return func() (bool, error) { return func() (bool, error) {
job, err := c.Jobs(job.Namespace).Get(job.Name) job, err := jobClient.Jobs(job.Namespace).Get(job.Name)
if err != nil { if err != nil {
return false, err return false, err
} }
...@@ -112,7 +115,7 @@ func JobHasDesiredParallelism(c BatchInterface, job *batch.Job) wait.ConditionFu ...@@ -112,7 +115,7 @@ func JobHasDesiredParallelism(c BatchInterface, job *batch.Job) wait.ConditionFu
// DeploymentHasDesiredReplicas returns a condition that will be true if and only if // DeploymentHasDesiredReplicas returns a condition that will be true if and only if
// the desired replica count for a deployment equals its updated replicas count. // the desired replica count for a deployment equals its updated replicas count.
// (non-terminated pods that have the desired template spec). // (non-terminated pods that have the desired template spec).
func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.Deployment) wait.ConditionFunc { func DeploymentHasDesiredReplicas(dClient extensionsclient.DeploymentsGetter, deployment *extensions.Deployment) wait.ConditionFunc {
// If we're given a deployment where the status lags the spec, it either // If we're given a deployment where the status lags the spec, it either
// means that the deployment is stale, or that the deployment manager hasn't // means that the deployment is stale, or that the deployment manager hasn't
// noticed the update yet. Polling status.Replicas is not safe in the latter // noticed the update yet. Polling status.Replicas is not safe in the latter
...@@ -120,7 +123,7 @@ func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions. ...@@ -120,7 +123,7 @@ func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.
desiredGeneration := deployment.Generation desiredGeneration := deployment.Generation
return func() (bool, error) { return func() (bool, error) {
deployment, err := c.Deployments(deployment.Namespace).Get(deployment.Name) deployment, err := dClient.Deployments(deployment.Namespace).Get(deployment.Name)
if err != nil { if err != nil {
return false, err return false, err
} }
......
...@@ -27,6 +27,7 @@ import ( ...@@ -27,6 +27,7 @@ import (
"github.com/renstrom/dedent" "github.com/renstrom/dedent"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/meta"
...@@ -177,24 +178,25 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -177,24 +178,25 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
return err return err
} }
client, err := f.Client() clientset, err := f.ClientSet()
if err != nil { if err != nil {
return err return err
} }
coreClient := clientset.Core()
var newRc *api.ReplicationController var newRc *api.ReplicationController
// fetch rc // fetch rc
oldRc, err := client.ReplicationControllers(cmdNamespace).Get(oldName) oldRc, err := coreClient.ReplicationControllers(cmdNamespace).Get(oldName)
if err != nil { if err != nil {
if !errors.IsNotFound(err) || len(image) == 0 || len(args) > 1 { if !errors.IsNotFound(err) || len(image) == 0 || len(args) > 1 {
return err return err
} }
// We're in the middle of a rename, look for an RC with a source annotation of oldName // We're in the middle of a rename, look for an RC with a source annotation of oldName
newRc, err := kubectl.FindSourceController(client, cmdNamespace, oldName) newRc, err := kubectl.FindSourceController(coreClient, cmdNamespace, oldName)
if err != nil { if err != nil {
return err return err
} }
return kubectl.Rename(client, newRc, oldName) return kubectl.Rename(coreClient, newRc, oldName)
} }
var keepOldName bool var keepOldName bool
...@@ -248,10 +250,10 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -248,10 +250,10 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
// than the old rc. This selector is the hash of the rc, with a suffix to provide uniqueness for // than the old rc. This selector is the hash of the rc, with a suffix to provide uniqueness for
// same-image updates. // same-image updates.
if len(image) != 0 { if len(image) != 0 {
codec := api.Codecs.LegacyCodec(client.APIVersion()) codec := api.Codecs.LegacyCodec(clientset.CoreClient.APIVersion())
keepOldName = len(args) == 1 keepOldName = len(args) == 1
newName := findNewName(args, oldRc) newName := findNewName(args, oldRc)
if newRc, err = kubectl.LoadExistingNextReplicationController(client, cmdNamespace, newName); err != nil { if newRc, err = kubectl.LoadExistingNextReplicationController(coreClient, cmdNamespace, newName); err != nil {
return err return err
} }
if newRc != nil { if newRc != nil {
...@@ -274,7 +276,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -274,7 +276,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
} }
config.PullPolicy = api.PullPolicy(pullPolicy) config.PullPolicy = api.PullPolicy(pullPolicy)
} }
newRc, err = kubectl.CreateNewControllerFromCurrentController(client, codec, config) newRc, err = kubectl.CreateNewControllerFromCurrentController(coreClient, codec, config)
if err != nil { if err != nil {
return err return err
} }
...@@ -287,7 +289,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -287,7 +289,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
} }
// If new image is same as old, the hash may not be distinct, so add a suffix. // If new image is same as old, the hash may not be distinct, so add a suffix.
oldHash += "-orig" oldHash += "-orig"
oldRc, err = kubectl.UpdateExistingReplicationController(client, oldRc, cmdNamespace, newRc.Name, deploymentKey, oldHash, out) oldRc, err = kubectl.UpdateExistingReplicationController(coreClient, coreClient, oldRc, cmdNamespace, newRc.Name, deploymentKey, oldHash, out)
if err != nil { if err != nil {
return err return err
} }
...@@ -296,7 +298,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -296,7 +298,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
if rollback { if rollback {
keepOldName = len(args) == 1 keepOldName = len(args) == 1
newName := findNewName(args, oldRc) newName := findNewName(args, oldRc)
if newRc, err = kubectl.LoadExistingNextReplicationController(client, cmdNamespace, newName); err != nil { if newRc, err = kubectl.LoadExistingNextReplicationController(coreClient, cmdNamespace, newName); err != nil {
return err return err
} }
...@@ -310,7 +312,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -310,7 +312,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
filename, oldName) filename, oldName)
} }
updater := kubectl.NewRollingUpdater(newRc.Namespace, client) updater := kubectl.NewRollingUpdater(newRc.Namespace, coreClient, coreClient)
// To successfully pull off a rolling update the new and old rc have to differ // To successfully pull off a rolling update the new and old rc have to differ
// by at least one selector. Every new pod should have the selector and every // by at least one selector. Every new pod should have the selector and every
...@@ -367,7 +369,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -367,7 +369,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
if err != nil { if err != nil {
return err return err
} }
client.ReplicationControllers(config.NewRc.Namespace).Update(config.NewRc) coreClient.ReplicationControllers(config.NewRc.Namespace).Update(config.NewRc)
} }
err = updater.Update(config) err = updater.Update(config)
if err != nil { if err != nil {
...@@ -380,7 +382,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg ...@@ -380,7 +382,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
} else { } else {
message = fmt.Sprintf("rolling updated to %q", newRc.Name) message = fmt.Sprintf("rolling updated to %q", newRc.Name)
} }
newRc, err = client.ReplicationControllers(cmdNamespace).Get(newRc.Name) newRc, err = coreClient.ReplicationControllers(cmdNamespace).Get(newRc.Name)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
fed_clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset" fed_clientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_internalclientset"
"k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apimachinery/registered" "k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient" "k8s.io/kubernetes/pkg/client/restclient"
client "k8s.io/kubernetes/pkg/client/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd" "k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
...@@ -28,6 +29,7 @@ import ( ...@@ -28,6 +29,7 @@ import (
func NewClientCache(loader clientcmd.ClientConfig) *ClientCache { func NewClientCache(loader clientcmd.ClientConfig) *ClientCache {
return &ClientCache{ return &ClientCache{
clients: make(map[unversioned.GroupVersion]*client.Client), clients: make(map[unversioned.GroupVersion]*client.Client),
clientsets: make(map[unversioned.GroupVersion]*internalclientset.Clientset),
configs: make(map[unversioned.GroupVersion]*restclient.Config), configs: make(map[unversioned.GroupVersion]*restclient.Config),
fedClientSets: make(map[unversioned.GroupVersion]fed_clientset.Interface), fedClientSets: make(map[unversioned.GroupVersion]fed_clientset.Interface),
loader: loader, loader: loader,
...@@ -39,6 +41,7 @@ func NewClientCache(loader clientcmd.ClientConfig) *ClientCache { ...@@ -39,6 +41,7 @@ func NewClientCache(loader clientcmd.ClientConfig) *ClientCache {
type ClientCache struct { type ClientCache struct {
loader clientcmd.ClientConfig loader clientcmd.ClientConfig
clients map[unversioned.GroupVersion]*client.Client clients map[unversioned.GroupVersion]*client.Client
clientsets map[unversioned.GroupVersion]*internalclientset.Clientset
fedClientSets map[unversioned.GroupVersion]fed_clientset.Interface fedClientSets map[unversioned.GroupVersion]fed_clientset.Interface
configs map[unversioned.GroupVersion]*restclient.Config configs map[unversioned.GroupVersion]*restclient.Config
defaultConfig *restclient.Config defaultConfig *restclient.Config
...@@ -95,6 +98,40 @@ func (c *ClientCache) ClientConfigForVersion(version *unversioned.GroupVersion) ...@@ -95,6 +98,40 @@ func (c *ClientCache) ClientConfigForVersion(version *unversioned.GroupVersion)
return &config, nil return &config, nil
} }
// ClientSetForVersion initializes or reuses a clientset for the specified version, or returns an
// error if that is not possible
func (c *ClientCache) ClientSetForVersion(version *unversioned.GroupVersion) (*internalclientset.Clientset, error) {
if version != nil {
if clientset, ok := c.clientsets[*version]; ok {
return clientset, nil
}
}
config, err := c.ClientConfigForVersion(version)
if err != nil {
return nil, err
}
clientset, err := internalclientset.NewForConfig(config)
if err != nil {
return nil, err
}
c.clientsets[*config.GroupVersion] = clientset
// `version` does not necessarily equal `config.Version`. However, we know that if we call this method again with
// `version`, we should get a client based on the same config we just found. There's no guarantee that a client
// is copiable, so create a new client and save it in the cache.
if version != nil {
configCopy := *config
clientset, err := internalclientset.NewForConfig(&configCopy)
if err != nil {
return nil, err
}
c.clientsets[*version] = clientset
}
return clientset, nil
}
// ClientForVersion initializes or reuses a client for the specified version, or returns an // ClientForVersion initializes or reuses a client for the specified version, or returns an
// error if that is not possible // error if that is not possible
func (c *ClientCache) ClientForVersion(version *unversioned.GroupVersion) (*client.Client, error) { func (c *ClientCache) ClientForVersion(version *unversioned.GroupVersion) (*client.Client, error) {
......
...@@ -431,12 +431,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { ...@@ -431,12 +431,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return restclient.RESTClientFor(clientConfig) return restclient.RESTClientFor(clientConfig)
}, },
ClientSet: func() (*internalclientset.Clientset, error) { ClientSet: func() (*internalclientset.Clientset, error) {
cfg, err := clients.ClientConfigForVersion(nil) return clients.ClientSetForVersion(nil)
if err != nil {
return nil, err
}
return internalclientset.NewForConfig(cfg)
}, },
ClientConfig: func() (*restclient.Config, error) { ClientConfig: func() (*restclient.Config, error) {
return clients.ClientConfigForVersion(nil) return clients.ClientConfigForVersion(nil)
...@@ -706,19 +701,19 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { ...@@ -706,19 +701,19 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
}, },
Scaler: func(mapping *meta.RESTMapping) (kubectl.Scaler, error) { Scaler: func(mapping *meta.RESTMapping) (kubectl.Scaler, error) {
mappingVersion := mapping.GroupVersionKind.GroupVersion() mappingVersion := mapping.GroupVersionKind.GroupVersion()
client, err := clients.ClientForVersion(&mappingVersion) clientset, err := clients.ClientSetForVersion(&mappingVersion)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return kubectl.ScalerFor(mapping.GroupVersionKind.GroupKind(), client) return kubectl.ScalerFor(mapping.GroupVersionKind.GroupKind(), clientset)
}, },
Reaper: func(mapping *meta.RESTMapping) (kubectl.Reaper, error) { Reaper: func(mapping *meta.RESTMapping) (kubectl.Reaper, error) {
mappingVersion := mapping.GroupVersionKind.GroupVersion() mappingVersion := mapping.GroupVersionKind.GroupVersion()
client, err := clients.ClientForVersion(&mappingVersion) clientset, err := clients.ClientSetForVersion(&mappingVersion)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return kubectl.ReaperFor(mapping.GroupVersionKind.GroupKind(), client) return kubectl.ReaperFor(mapping.GroupVersionKind.GroupKind(), clientset)
}, },
HistoryViewer: func(mapping *meta.RESTMapping) (kubectl.HistoryViewer, error) { HistoryViewer: func(mapping *meta.RESTMapping) (kubectl.HistoryViewer, error) {
mappingVersion := mapping.GroupVersionKind.GroupVersion() mappingVersion := mapping.GroupVersionKind.GroupVersion()
......
...@@ -27,6 +27,11 @@ import ( ...@@ -27,6 +27,11 @@ import (
"k8s.io/kubernetes/pkg/apis/apps" "k8s.io/kubernetes/pkg/apis/apps"
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
appsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/unversioned"
batchclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
extensionsclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/util/wait"
...@@ -44,10 +49,10 @@ type Scaler interface { ...@@ -44,10 +49,10 @@ type Scaler interface {
ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (updatedResourceVersion string, err error) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint) (updatedResourceVersion string, err error)
} }
func ScalerFor(kind unversioned.GroupKind, c client.Interface) (Scaler, error) { func ScalerFor(kind unversioned.GroupKind, c *internalclientset.Clientset) (Scaler, error) {
switch kind { switch kind {
case api.Kind("ReplicationController"): case api.Kind("ReplicationController"):
return &ReplicationControllerScaler{c}, nil return &ReplicationControllerScaler{c.Core()}, nil
case extensions.Kind("ReplicaSet"): case extensions.Kind("ReplicaSet"):
return &ReplicaSetScaler{c.Extensions()}, nil return &ReplicaSetScaler{c.Extensions()}, nil
case extensions.Kind("Job"), batch.Kind("Job"): case extensions.Kind("Job"), batch.Kind("Job"):
...@@ -155,7 +160,7 @@ func (precondition *ScalePrecondition) ValidateReplicationController(controller ...@@ -155,7 +160,7 @@ func (precondition *ScalePrecondition) ValidateReplicationController(controller
} }
type ReplicationControllerScaler struct { type ReplicationControllerScaler struct {
c client.Interface c coreclient.ReplicationControllersGetter
} }
// ScaleSimple does a simple one-shot attempt at scaling. It returns the // ScaleSimple does a simple one-shot attempt at scaling. It returns the
...@@ -253,7 +258,7 @@ func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions ...@@ -253,7 +258,7 @@ func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions
} }
type ReplicaSetScaler struct { type ReplicaSetScaler struct {
c client.ExtensionsInterface c extensionsclient.ReplicaSetsGetter
} }
// ScaleSimple does a simple one-shot attempt at scaling. It returns the // ScaleSimple does a simple one-shot attempt at scaling. It returns the
...@@ -324,7 +329,7 @@ func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error { ...@@ -324,7 +329,7 @@ func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error {
} }
type PetSetScaler struct { type PetSetScaler struct {
c client.AppsInterface c appsclient.PetSetsGetter
} }
// ScaleSimple does a simple one-shot attempt at scaling. It returns the // ScaleSimple does a simple one-shot attempt at scaling. It returns the
...@@ -377,7 +382,7 @@ func (scaler *PetSetScaler) Scale(namespace, name string, newSize uint, precondi ...@@ -377,7 +382,7 @@ func (scaler *PetSetScaler) Scale(namespace, name string, newSize uint, precondi
} }
type JobScaler struct { type JobScaler struct {
c client.BatchInterface c batchclient.JobsGetter
} }
// ScaleSimple is responsible for updating job's parallelism. It returns the // ScaleSimple is responsible for updating job's parallelism. It returns the
...@@ -445,7 +450,7 @@ func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions ...@@ -445,7 +450,7 @@ func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions
} }
type DeploymentScaler struct { type DeploymentScaler struct {
c client.ExtensionsInterface c extensionsclient.DeploymentsGetter
} }
// ScaleSimple is responsible for updating a deployment's desired replicas // ScaleSimple is responsible for updating a deployment's desired replicas
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment