github.com/openshift/installer@v1.4.17/pkg/nodejoiner/monitoraddnodes.go (about)

     1  package nodejoiner
     2  
     3  import (
     4  	"context"
     5  
     6  	agentpkg "github.com/openshift/installer/pkg/agent"
     7  	"github.com/openshift/installer/pkg/asset/agent/workflow"
     8  )
     9  
    10  // NewMonitorAddNodesCommand creates a new command for monitor add nodes.
    11  func NewMonitorAddNodesCommand(directory, kubeconfigPath string, ips []string) error {
    12  	err := saveParams(directory, kubeconfigPath)
    13  	if err != nil {
    14  		return err
    15  	}
    16  
    17  	// sshKey is not required parameter for monitor-add-nodes
    18  	sshKey := ""
    19  
    20  	clusters := []*agentpkg.Cluster{}
    21  	ctx := context.Background()
    22  	for _, ip := range ips {
    23  		cluster, err := agentpkg.NewCluster(ctx, directory, ip, kubeconfigPath, sshKey, workflow.AgentWorkflowTypeAddNodes)
    24  		if err != nil {
    25  			return err
    26  		}
    27  		clusters = append(clusters, cluster)
    28  	}
    29  	agentpkg.MonitorAddNodes(ctx, clusters, ips)
    30  
    31  	return nil
    32  }