Merge pull request #286 from mwielgus/exist-no-error
Do not return error from exist
This commit is contained in:
commit
021a2fdf5d
|
|
@ -204,8 +204,8 @@ func (asg *Asg) TargetSize() (int, error) {
|
|||
|
||||
// Exist checks if the node group really exists on the cloud provider side. Allows to tell the
|
||||
// theoretical node group from the real one.
|
||||
func (asg *Asg) Exist() (bool, error) {
|
||||
return true, nil
|
||||
func (asg *Asg) Exist() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Create creates the node group on the cloud provider side.
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ type NodeGroup interface {
|
|||
|
||||
// Exist checks if the node group really exists on the cloud provider side. Allows to tell the
|
||||
// theoretical node group from the real one. Implementation required.
|
||||
Exist() (bool, error)
|
||||
Exist() bool
|
||||
|
||||
// Create creates the node group on the cloud provider side. Implementation optional.
|
||||
Create() error
|
||||
|
|
|
|||
|
|
@ -316,8 +316,8 @@ func (mig *Mig) Nodes() ([]string, error) {
|
|||
|
||||
// Exist checks if the node group really exists on the cloud provider side. Allows to tell the
|
||||
// theoretical node group from the real one.
|
||||
func (mig *Mig) Exist() (bool, error) {
|
||||
return mig.exist, nil
|
||||
func (mig *Mig) Exist() bool {
|
||||
return mig.exist
|
||||
}
|
||||
|
||||
// Create creates the node group on the cloud provider side.
|
||||
|
|
@ -344,13 +344,8 @@ func (mig *Mig) Autoprovisioned() bool {
|
|||
|
||||
// TemplateNodeInfo returns a node template for this node group.
|
||||
func (mig *Mig) TemplateNodeInfo() (*schedulercache.NodeInfo, error) {
|
||||
|
||||
var node *apiv1.Node
|
||||
exists, err := mig.Exist()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if exists {
|
||||
if mig.Exist() {
|
||||
template, err := mig.gceManager.templates.getMigTemplate(mig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -225,8 +225,8 @@ func (nodeGroup *NodeGroup) TemplateNodeInfo() (*schedulercache.NodeInfo, error)
|
|||
}
|
||||
|
||||
// Exist checks if the node group really exists on the cloud provider side.
|
||||
func (nodeGroup *NodeGroup) Exist() (bool, error) {
|
||||
return true, nil
|
||||
func (nodeGroup *NodeGroup) Exist() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Create creates the node group on the cloud provider side.
|
||||
|
|
|
|||
|
|
@ -175,8 +175,8 @@ func (tng *TestNodeGroup) IncreaseSize(delta int) error {
|
|||
|
||||
// Exist checks if the node group really exists on the cloud provider side. Allows to tell the
|
||||
// theoretical node group from the real one.
|
||||
func (tng *TestNodeGroup) Exist() (bool, error) {
|
||||
return true, nil
|
||||
func (tng *TestNodeGroup) Exist() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Create creates the node group on the cloud provider side.
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ func ScaleUp(context *AutoscalingContext, unschedulablePods []*apiv1.Pod, nodes
|
|||
}
|
||||
}
|
||||
if context.AutoscalingOptions.NodeAutoprovisioningEnabled {
|
||||
if exist, err := bestOption.NodeGroup.Exist(); err == nil && !exist {
|
||||
if !bestOption.NodeGroup.Exist() {
|
||||
err := bestOption.NodeGroup.Create()
|
||||
if err != nil {
|
||||
return false, errors.ToAutoscalerError(errors.CloudProviderError, err)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ nextoption:
|
|||
|
||||
optionScore := supressedUnfitness * priceSubScore
|
||||
|
||||
if exist, err := option.NodeGroup.Exist(); err != nil && !exist {
|
||||
if !option.NodeGroup.Exist() {
|
||||
optionScore *= notExistCoeficient
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func (f *FakeNodeGroup) Nodes() ([]string, error) { return []string{},
|
|||
func (f *FakeNodeGroup) TemplateNodeInfo() (*schedulercache.NodeInfo, error) {
|
||||
return nil, cloudprovider.ErrNotImplemented
|
||||
}
|
||||
func (f *FakeNodeGroup) Exist() (bool, error) { return true, nil }
|
||||
func (f *FakeNodeGroup) Exist() bool { return true }
|
||||
func (f *FakeNodeGroup) Create() error { return cloudprovider.ErrAlreadyExist }
|
||||
func (f *FakeNodeGroup) Delete() error { return cloudprovider.ErrNotImplemented }
|
||||
func (f *FakeNodeGroup) Autoprovisioned() bool { return false }
|
||||
|
|
|
|||
Loading…
Reference in New Issue