From c3c73de331704c427db1f80ee9573cd5a52e035a Mon Sep 17 00:00:00 2001 From: JoshVanL Date: Thu, 21 Jun 2018 17:41:25 +0100 Subject: [PATCH] Make use of type constants and compare type not name --- pkg/tarmak/interfaces/interfaces.go | 1 + pkg/tarmak/provider/amazon/amazon.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/tarmak/interfaces/interfaces.go b/pkg/tarmak/interfaces/interfaces.go index 27a033b679..d6270aa26b 100644 --- a/pkg/tarmak/interfaces/interfaces.go +++ b/pkg/tarmak/interfaces/interfaces.go @@ -251,6 +251,7 @@ type InstancePool interface { Validate() error MinCount() int MaxCount() int + InstanceType() string } type Volume interface { diff --git a/pkg/tarmak/provider/amazon/amazon.go b/pkg/tarmak/provider/amazon/amazon.go index ca9884d1fd..eede919859 100644 --- a/pkg/tarmak/provider/amazon/amazon.go +++ b/pkg/tarmak/provider/amazon/amazon.go @@ -523,9 +523,9 @@ func (a *Amazon) VerifyInstanceTypes(instancePools []interfaces.InstancePool) er result = multierror.Append(result, err) } - switch instance.Name() { + switch instance.InstanceType() { - case "master": + case clusterv1alpha1.InstancePoolTypeMaster: found := false for _, s := range a.nonMasterType() { if s == instanceType { @@ -539,7 +539,7 @@ func (a *Amazon) VerifyInstanceTypes(instancePools []interfaces.InstancePool) er } break - case "etcd", "vault": + case clusterv1alpha1.InstancePoolTypeEtcd, clusterv1alpha1.InstancePoolTypeVault: if a.awsInstanceBurstable(instanceType) { a.tarmak.Log().Warnf("Burstable type '%s' is not advised for instance '%s'", instanceType, instance.Name()) }