Ensure machine types are configured prior to setup
@@ -346,15 +346,11 @@ func newGCEProvider(cfg *config.ProviderConfig) (Provider, error) {
mtName = cfg.Get("MACHINE_TYPE")
}
- cfg.Set("MACHINE_TYPE", mtName)
-
premiumMTName := defaultGCEPremiumMachineType
if cfg.IsSet("PREMIUM_MACHINE_TYPE") {
premiumMTName = cfg.Get("PREMIUM_MACHINE_TYPE")
}
- cfg.Set("PREMIUM_MACHINE_TYPE", premiumMTName)
-
nwName := defaultGCENetwork
if cfg.IsSet("NETWORK") {
nwName = cfg.Get("NETWORK")
@@ -620,6 +616,8 @@ func newGCEProvider(cfg *config.ProviderConfig) (Provider, error) {
SkipStopPoll: skipStopPoll,
Site: site,
AcceleratorConfig: defaultAcceleratorConfig,
+ MachineType: mtName,
+ PremiumMachineType: premiumMTName,
},
backoffRetryMax: backoffRetryMax,
@@ -812,19 +810,22 @@ func (p *gceProvider) Setup(ctx gocontext.Context) error {
continue
}
+ key := gceMtKey(zoneName, machineType)
logger.WithFields(logrus.Fields{
"zone": zoneName,
"machine_type": machineType,
+ "key": key,
}).Debug("finding machine type self link")
err = p.backoffRetry(ctx, func() error {
p.apiRateLimit(ctx)
+
mt, mtErr := p.client.MachineTypes.
Get(p.projectID, zoneName, machineType).
Context(ctx).
Do()
if mtErr == nil {
- p.machineTypeSelfLinks[gceMtKey(zoneName, machineType)] = mt.SelfLink
+ p.machineTypeSelfLinks[key] = mt.SelfLink
return nil
}
return mtErr
