Skip to content

Commit

Permalink
pkg/asset/machines/worker: Default to MachineSets only where we need …
Browse files Browse the repository at this point in the history
…them

And not for additional zones.  This will keep us from consuming more
NAT gateways and associated EIPs than we need, once subsequent work
ties those resources to Machine(Set) consumption.  This means that
pools where replicas is unset or zero will receive no MachineSets, but
creating MachineSets later on is something we want to be easy anyway,
so I don't see a need to require the installer to inject a template
MachineSet into the cluster.
  • Loading branch information
wking committed Mar 28, 2019
1 parent 4697901 commit 549a704
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,15 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
mpool.InstanceType = awsDefaultWorkerMachineType(installconfig)
mpool.Set(ic.Platform.AWS.DefaultMachinePlatform)
mpool.Set(pool.Platform.AWS)
if len(mpool.Zones) == 0 {
if pool.Replicas != nil && *pool.Replicas > 0 && len(mpool.Zones) == 0 {
azs, err := aws.AvailabilityZones(ic.Platform.AWS.Region)
if err != nil {
return errors.Wrap(err, "failed to fetch availability zones")
}
mpool.Zones = azs
if int(*pool.Replicas) < len(mpool.Zones) {
mpool.Zones = azs[:*pool.Replicas]
}
}
pool.Platform.AWS = &mpool
sets, err := aws.MachineSets(clusterID.InfraID, ic, &pool, string(*rhcosImage), "worker", "worker-user-data")
Expand Down

0 comments on commit 549a704

Please sign in to comment.