func (j *jujuCloudProvider) Refresh() error {
	// Juju does not have a NodeGroup concept. Currently, a "node group" is added on startup for each
	// --nodes option passed to the autoscaler command
	// The units making up these node groups can change dynamically if a juju admin adds
	// or removes units outside of the autoscaler
	// The loop below calls the refresh function for each node group (which updates state to include any externally added or removed nodes),
	// and updates the target size to match the current size of the node group
	klog.Infof("refreshing node groups")
	for _, node := range j.nodeGroups {
		// Cast the cloudprovider.NodeGroup interface to the underlying juju NodeGroup struct
		jujuNodeGroup, ok := node.(*NodeGroup)
		if ok {
			klog.Infof("updating node group %s target", jujuNodeGroup.id)
			jujuNodeGroup.manager.refresh()
			jujuNodeGroup.target = len(jujuNodeGroup.manager.units)
		}
	}

	return nil
}
// Refresh is called before every main loop and can be used to dynamically
// update cloud provider state. In particular the list of node groups returned
// by NodeGroups() can change as a result of CloudProvider.Refresh().
Refresh is called before every main loop and can be used to dynamically
update cloud provider state. In particular the list of node groups returned
by NodeGroups() can change as a result of CloudProvider.Refresh().
// Refresh is called before every main loop and can be used to dynamically // update cloud provider state . In particular the list of node groups returned // by NodeGroups () can change as a result of CloudProvider . Refresh () .
func (j *jujuCloudProvider) Refresh() error {
	klog.Infof("refreshing node groups")
	for _, node := range j.nodeGroups {
		jujuNodeGroup, ok := node.(*NodeGroup)
		if ok {
			klog.Infof("updating node group %s target", jujuNodeGroup.id)
			jujuNodeGroup.manager.refresh()
			jujuNodeGroup.target = len(jujuNodeGroup.manager.units)
		}
	}
	return nil
}
func ( j * jujuCloudProvider ) Refresh ( ) error { klog . Infof ( " " ) for _ , node := range j . nodeGroups { jujuNodeGroup , ok := node . ( * NodeGroup ) if ok { klog . Infof ( " " , jujuNodeGroup . id ) jujuNodeGroup . manager . refresh ( ) jujuNodeGroup . target = len ( jujuNodeGroup . manager . units ) } } return nil }
Refresh is called before every main loop and can be used to dynamically
update cloud provider state.
Refresh is called before every main loop and can be used to dynamically update cloud provider state .
// Juju does not have a NodeGroup concept. Currently, a "node group" is added on startup for each // --nodes option passed to the autoscaler command // The units making up these node groups can change dynamically if a juju admin adds // or removes units outside of the autoscaler // The loop below calls the refresh function for each node group (which updates state to include any externally added or removed nodes), // and updates the target size to match the current size of the node group // Cast the cloudprovider.NodeGroup interface to the underlying juju NodeGroup struct