github.com/openshift/installer@v1.4.17/pkg/asset/machines/machineconfig/multipath.go (about)

     1  package machineconfig
     2  
     3  import (
     4  	"fmt"
     5  
     6  	igntypes "github.com/coreos/ignition/v2/config/v3_2/types"
     7  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     8  
     9  	mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
    10  	"github.com/openshift/installer/pkg/asset/ignition"
    11  )
    12  
    13  // ForMultipathEnabled creates the MachineConfig to enable multipath.
    14  func ForMultipathEnabled(role string) (*mcfgv1.MachineConfig, error) {
    15  	var (
    16  		kernelArgsMultipath = []string{"rd.multipath=default", "root=/dev/disk/by-label/dm-mpath-root"}
    17  	)
    18  
    19  	ignConfig := igntypes.Config{
    20  		Ignition: igntypes.Ignition{
    21  			Version: igntypes.MaxVersion.String(),
    22  		},
    23  	}
    24  
    25  	rawExt, err := ignition.ConvertToRawExtension(ignConfig)
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	return &mcfgv1.MachineConfig{
    31  		TypeMeta: metav1.TypeMeta{
    32  			APIVersion: "machineconfiguration.openshift.io/v1",
    33  			Kind:       "MachineConfig",
    34  		},
    35  		ObjectMeta: metav1.ObjectMeta{
    36  			Name: fmt.Sprintf("99-%s-multipath", role),
    37  			Labels: map[string]string{
    38  				"machineconfiguration.openshift.io/role": role,
    39  			},
    40  		},
    41  		Spec: mcfgv1.MachineConfigSpec{
    42  			Config:          rawExt,
    43  			KernelArguments: kernelArgsMultipath,
    44  		},
    45  	}, nil
    46  }