-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MULTIARCH-3964: Power VS: Control SMT level with machineconfig #7704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| package machineconfig | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| ignutil "github.com/coreos/ignition/v2/config/util" | ||
| igntypes "github.com/coreos/ignition/v2/config/v3_2/types" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| "github.com/openshift/installer/pkg/asset/ignition" | ||
| mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1" | ||
| ) | ||
|
|
||
| // ForPowerSMT sets the SMT level for Power machines. | ||
| func ForPowerSMT(role string, smtLevel string) (*mcfgv1.MachineConfig, error) { | ||
| powerSMTUnit, err := createPowerSMTUnit(smtLevel) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| ignConfig := igntypes.Config{ | ||
| Ignition: igntypes.Ignition{ | ||
| Version: igntypes.MaxVersion.String(), | ||
| }, | ||
| Systemd: igntypes.Systemd{ | ||
| Units: []igntypes.Unit{ | ||
| { | ||
| Contents: &powerSMTUnit, | ||
| Name: fmt.Sprintf("99-%s-powersmt.service", role), | ||
| Enabled: ignutil.BoolToPtr(true), | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| rawExt, err := ignition.ConvertToRawExtension(ignConfig) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know in the MCO we also just json.Marshal ignition usually rather than
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All other machineconfigs in the installer do this, but I could add test in a follow up if you'd like! |
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return &mcfgv1.MachineConfig{ | ||
| TypeMeta: metav1.TypeMeta{ | ||
| APIVersion: "machineconfiguration.openshift.io/v1", | ||
| Kind: "MachineConfig", | ||
| }, | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: fmt.Sprintf("99-%s-powersmt", role), | ||
| Labels: map[string]string{ | ||
| "machineconfiguration.openshift.io/role": role, | ||
| }, | ||
| }, | ||
| Spec: mcfgv1.MachineConfigSpec{ | ||
| Config: rawExt, | ||
| }, | ||
| }, nil | ||
| } | ||
|
|
||
| func createPowerSMTUnit(smtLevel string) (string, error) { | ||
| unit := `[Unit] | ||
| Description=Set SMT | ||
| After=network-online.target | ||
| Before= crio.service | ||
| [Service] | ||
| Type=oneshot | ||
| RemainAfterExit=yes | ||
| ExecStart=/usr/sbin/ppc64_cpu --smt=%s | ||
| [Install] | ||
| WantedBy=multi-user.target` | ||
| return fmt.Sprintf(unit, smtLevel), nil | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,11 @@ type MachinePool struct { | |
| // +optional | ||
| ProcType machinev1.PowerVSProcessorType `json:"procType,omitempty"` | ||
|
|
||
| // SMTLevel specifies the level of SMT to set the control plane and worker nodes to. | ||
| // | ||
| // +optional | ||
| SMTLevel string `json:"smtLevel,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Values in the machine pools would typically correspond to values set in the machinesets to be handleded by the machine api operator. (There is day 2 support for machine pools on hive in some platforms.) |
||
|
|
||
| // SysType defines the system type for instance. | ||
| // | ||
| // +optional | ||
|
|
@@ -53,6 +58,9 @@ func (a *MachinePool) Set(required *MachinePool) { | |
| if required.ProcType != "" { | ||
| a.ProcType = required.ProcType | ||
| } | ||
| if required.SMTLevel != "" { | ||
| a.SMTLevel = required.SMTLevel | ||
| } | ||
| if required.SysType != "" { | ||
| a.SysType = required.SysType | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is 3.2 right here? I know the MCO just added support for 3.4 recently I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently all other machineconfigs in the installer are still using 3.2 types. I will keep it here for now but thanks for the info!!