Fixes remaining imports per #15319
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
deploymentUtil "k8s.io/kubernetes/pkg/util/deployment"
|
||||
deploymentutil "k8s.io/kubernetes/pkg/util/deployment"
|
||||
)
|
||||
|
||||
type DeploymentController struct {
|
||||
@@ -125,23 +125,23 @@ func (d *DeploymentController) reconcileRollingUpdateDeployment(deployment exten
|
||||
}
|
||||
|
||||
func (d *DeploymentController) getOldRCs(deployment extensions.Deployment) ([]*api.ReplicationController, error) {
|
||||
return deploymentUtil.GetOldRCs(deployment, d.client)
|
||||
return deploymentutil.GetOldRCs(deployment, d.client)
|
||||
}
|
||||
|
||||
// Returns an RC that matches the intent of the given deployment.
|
||||
// It creates a new RC if required.
|
||||
func (d *DeploymentController) getNewRC(deployment extensions.Deployment) (*api.ReplicationController, error) {
|
||||
existingNewRC, err := deploymentUtil.GetNewRC(deployment, d.client)
|
||||
existingNewRC, err := deploymentutil.GetNewRC(deployment, d.client)
|
||||
if err != nil || existingNewRC != nil {
|
||||
return existingNewRC, err
|
||||
}
|
||||
// new RC does not exist, create one.
|
||||
namespace := deployment.ObjectMeta.Namespace
|
||||
podTemplateSpecHash := deploymentUtil.GetPodTemplateSpecHash(deployment.Spec.Template)
|
||||
podTemplateSpecHash := deploymentutil.GetPodTemplateSpecHash(deployment.Spec.Template)
|
||||
rcName := fmt.Sprintf("deploymentrc-%d", podTemplateSpecHash)
|
||||
newRCTemplate := deploymentUtil.GetNewRCTemplate(deployment)
|
||||
newRCTemplate := deploymentutil.GetNewRCTemplate(deployment)
|
||||
// Add podTemplateHash label to selector.
|
||||
newRCSelector := deploymentUtil.CloneAndAddLabel(deployment.Spec.Selector, deployment.Spec.UniqueLabelKey, podTemplateSpecHash)
|
||||
newRCSelector := deploymentutil.CloneAndAddLabel(deployment.Spec.Selector, deployment.Spec.UniqueLabelKey, podTemplateSpecHash)
|
||||
|
||||
newRC := api.ReplicationController{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@@ -180,7 +180,7 @@ func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationControlle
|
||||
maxSurge = util.GetValueFromPercent(maxSurge, deployment.Spec.Replicas)
|
||||
}
|
||||
// Find the total number of pods
|
||||
currentPodCount := deploymentUtil.GetReplicaCountForRCs(allRCs)
|
||||
currentPodCount := deploymentutil.GetReplicaCountForRCs(allRCs)
|
||||
maxTotalPods := deployment.Spec.Replicas + maxSurge
|
||||
if currentPodCount >= maxTotalPods {
|
||||
// Cannot scale up.
|
||||
@@ -196,7 +196,7 @@ func (d *DeploymentController) reconcileNewRC(allRCs []*api.ReplicationControlle
|
||||
}
|
||||
|
||||
func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationController, oldRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment extensions.Deployment) (bool, error) {
|
||||
oldPodsCount := deploymentUtil.GetReplicaCountForRCs(oldRCs)
|
||||
oldPodsCount := deploymentutil.GetReplicaCountForRCs(oldRCs)
|
||||
if oldPodsCount == 0 {
|
||||
// Cant scale down further
|
||||
return false, nil
|
||||
@@ -211,7 +211,7 @@ func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControll
|
||||
// Check if we can scale down.
|
||||
minAvailable := deployment.Spec.Replicas - maxUnavailable
|
||||
// Find the number of ready pods.
|
||||
readyPodCount, err := deploymentUtil.GetAvailablePodsForRCs(d.client, allRCs)
|
||||
readyPodCount, err := deploymentutil.GetAvailablePodsForRCs(d.client, allRCs)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("could not find available pods: %v", err)
|
||||
}
|
||||
@@ -243,8 +243,8 @@ func (d *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControll
|
||||
}
|
||||
|
||||
func (d *DeploymentController) updateDeploymentStatus(allRCs []*api.ReplicationController, newRC *api.ReplicationController, deployment extensions.Deployment) error {
|
||||
totalReplicas := deploymentUtil.GetReplicaCountForRCs(allRCs)
|
||||
updatedReplicas := deploymentUtil.GetReplicaCountForRCs([]*api.ReplicationController{newRC})
|
||||
totalReplicas := deploymentutil.GetReplicaCountForRCs(allRCs)
|
||||
updatedReplicas := deploymentutil.GetReplicaCountForRCs([]*api.ReplicationController{newRC})
|
||||
newDeployment := deployment
|
||||
// TODO: Reconcile this with API definition. API definition talks about ready pods, while this just computes created pods.
|
||||
newDeployment.Status = extensions.DeploymentStatus{
|
||||
|
Reference in New Issue
Block a user