// DeleteNodes deletes the nodes from the group.
DeleteNodes deletes the nodes from the group.
// DeleteNodes deletes the nodes from the group .
func (mig *GkeMig) DeleteNodes(nodes []*apiv1.Node) error {
	size, err := mig.gkeManager.GetMigSize(mig)
	if err != nil {
		return err
	}
	if int(size) <= mig.MinSize() {
		return fmt.Errorf("min size reached, nodes will not be deleted")
	}
	refs := make([]*gce.GceRef, 0, len(nodes))
	for _, node := range nodes {
		belongs, err := mig.Belongs(node)
		if err != nil {
			return err
		}
		if !belongs {
			return fmt.Errorf("%s belong to a different mig than %s", node.Name, mig.Id())
		}
		gceref, err := gce.GceRefFromProviderId(node.Spec.ProviderID)
		if err != nil {
			return err
		}
		refs = append(refs, gceref)
	}
	return mig.gkeManager.DeleteInstances(refs)
}
func ( mig * GkeMig ) DeleteNodes ( nodes [ ] * apiv1 . Node ) error { size , err := mig . gkeManager . GetMigSize ( mig ) if err != nil { return err } if int ( size ) <= mig . MinSize ( ) { return fmt . Errorf ( " " ) } refs := make ( [ ] * gce . GceRef , 0 , len ( nodes ) ) for _ , node := range nodes { belongs , err := mig . Belongs ( node ) if err != nil { return err } if ! belongs { return fmt . Errorf ( " " , node . Name , mig . Id ( ) ) } gceref , err := gce . GceRefFromProviderId ( node . Spec . ProviderID ) if err != nil { return err } refs = append ( refs , gceref ) } return mig . gkeManager . DeleteInstances ( refs ) }
DeleteNodes deletes the nodes from the group.
DeleteNodes deletes the nodes from the group .