in pkg/clusters/nodepools.go [169:213]
func (m *nodePoolMigrator) isUpgradeRequired(ctx context.Context) (bool, error) {
var (
errors error
required bool
)
for _, url := range m.nodePool.InstanceGroupUrls {
res := instanceGroupManagerRegex.FindStringSubmatch(url)
if res == nil {
errors = multierr.Append(errors, fmt.Errorf("unable to parse location and name information from InstanceGroup URL (%s) for NodePool %s", url, m.ResourcePath()))
continue
}
igm, err := m.clients.Compute.GetInstanceGroupManager(ctx, m.projectID, res[1], res[2])
if err != nil {
errors = multierr.Append(errors, fmt.Errorf("error retrieving InstanceGroupManagers (%s) for NodePool %s: %w", url, m.ResourcePath(), err))
continue
}
it, err := m.clients.Compute.GetInstanceTemplate(ctx, m.projectID, getName(igm.InstanceTemplate))
if err != nil {
errors = multierr.Append(errors, fmt.Errorf("error retrieving GetInstanceTemplateResp %s for NodePool %s: %w", igm.InstanceTemplate, m.ResourcePath(), err))
continue
}
missing := true
for _, ni := range it.Properties.NetworkInterfaces {
if ni.Subnetwork != "" {
missing = false
break
}
}
if missing {
required = true
break
}
}
if errors != nil && !required {
return required, fmt.Errorf("error(s) encountered obtaining an InstanceTemplate for NodePool %s: %w", m.ResourcePath(), errors)
}
if errors != nil {
log.Infof("Error(s) retrieving InstanceTemplate(s) for NodePool %s: %v", m.ResourcePath(), errors)
}
return required, nil
}