github.com/openshift/installer@v1.4.17/pkg/asset/machines/machineconfig/hyperthreading.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  // ForHyperthreadingDisabled creates the MachineConfig to disable hyperthreading.
    14  // RHCOS ships with pivot.service to override the kernel arguments for hosts.
    15  func ForHyperthreadingDisabled(role string) (*mcfgv1.MachineConfig, error) {
    16  	ignConfig := igntypes.Config{
    17  		Ignition: igntypes.Ignition{
    18  			Version: igntypes.MaxVersion.String(),
    19  		},
    20  	}
    21  
    22  	rawExt, err := ignition.ConvertToRawExtension(ignConfig)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  
    27  	return &mcfgv1.MachineConfig{
    28  		TypeMeta: metav1.TypeMeta{
    29  			APIVersion: "machineconfiguration.openshift.io/v1",
    30  			Kind:       "MachineConfig",
    31  		},
    32  		ObjectMeta: metav1.ObjectMeta{
    33  			Name: fmt.Sprintf("99-%s-disable-hyperthreading", role),
    34  			Labels: map[string]string{
    35  				"machineconfiguration.openshift.io/role": role,
    36  			},
    37  		},
    38  		Spec: mcfgv1.MachineConfigSpec{
    39  			Config:          rawExt,
    40  			KernelArguments: []string{"nosmt", "smt-enabled=off"},
    41  		},
    42  	}, nil
    43  }