-
Notifications
You must be signed in to change notification settings - Fork 250
GCP - Add exception for onHostMaintenance Migrate on confidential compute n2d instances #1406
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
base: main
Are you sure you want to change the base?
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -229,6 +229,10 @@ var gcpConfidentialTypeMachineSeriesSupportingSEV = []string{"n2d", "c2d", "c3d" | |||||||
| var gcpConfidentialTypeMachineSeriesSupportingSEVSNP = []string{"n2d"} | ||||||||
| var gcpConfidentialTypeMachineSeriesSupportingTDX = []string{"c3"} | ||||||||
|
|
||||||||
| // GCP onHostMaintenance Migrate with Confidential Compute is supported only on certain series: | ||||||||
| // reference: https://cloud.google.com/confidential-computing/confidential-vm/docs/troubleshoot-live-migration | ||||||||
| var gcpConfidentialTypeMachineSeriesSupportingOnHostMaintenanceMigrate = []string{"n2d"} | ||||||||
|
|
||||||||
| // defaultInstanceTypeForCloudProvider returns the default instance type for the given cloud provider and architecture. | ||||||||
| // If the cloud provider is not supported, an empty string is returned. | ||||||||
| // If the architecture is not supported, the default instance type for AMD64 is returned as a fallback. | ||||||||
|
|
@@ -1325,14 +1329,15 @@ func validateShieldedInstanceConfig(providerSpec *machinev1beta1.GCPMachineProvi | |||||||
| func validateGCPConfidentialComputing(providerSpec *machinev1beta1.GCPMachineProviderSpec) field.ErrorList { | ||||||||
| var errs field.ErrorList | ||||||||
| if providerSpec.ConfidentialCompute != "" && providerSpec.ConfidentialCompute != machinev1beta1.ConfidentialComputePolicyDisabled { | ||||||||
| // Get machine series | ||||||||
| machineSeries := strings.Split(providerSpec.MachineType, "-")[0] | ||||||||
| // Check on host maintenance | ||||||||
| if providerSpec.OnHostMaintenance != machinev1beta1.TerminateHostMaintenanceType { | ||||||||
| if providerSpec.OnHostMaintenance != machinev1beta1.TerminateHostMaintenanceType && !slices.Contains(gcpConfidentialTypeMachineSeriesSupportingOnHostMaintenanceMigrate, machineSeries) { | ||||||||
|
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. This condition would let SEV-SNP n2d machines to be configured with Could you rewrite the condition so this configuration is only accepted for AMD-SEV? (i.e.
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. OK i see
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. OK with last commit i think
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. Machine types should be only checked for SEV:
Suggested change
Or something like that. This way we can also get rid of the SEV-SNP specific check for maintenance type below. |
||||||||
| errs = append(errs, field.Invalid(field.NewPath("providerSpec", "onHostMaintenance"), | ||||||||
| providerSpec.OnHostMaintenance, | ||||||||
| fmt.Sprintf("ConfidentialCompute %s requires OnHostMaintenance to be set to %s, the current value is: %s", providerSpec.ConfidentialCompute, machinev1beta1.TerminateHostMaintenanceType, providerSpec.OnHostMaintenance))) | ||||||||
| } | ||||||||
| // Check machine series supports confidential computing | ||||||||
| machineSeries := strings.Split(providerSpec.MachineType, "-")[0] | ||||||||
| switch providerSpec.ConfidentialCompute { | ||||||||
| case machinev1beta1.ConfidentialComputePolicyEnabled, machinev1beta1.ConfidentialComputePolicySEV: | ||||||||
| if !slices.Contains(gcpConfidentialTypeMachineSeriesSupportingSEV, machineSeries) { | ||||||||
|
|
@@ -1348,6 +1353,12 @@ func validateGCPConfidentialComputing(providerSpec *machinev1beta1.GCPMachinePro | |||||||
| fmt.Sprintf("ConfidentialCompute %s requires a machine type in the following series: %s", providerSpec.ConfidentialCompute, strings.Join(gcpConfidentialTypeMachineSeriesSupportingSEVSNP, `,`))), | ||||||||
| ) | ||||||||
| } | ||||||||
| // Check on host maintenance for ConfidentialComputePolicySEVSNP | ||||||||
| if providerSpec.OnHostMaintenance != machinev1beta1.TerminateHostMaintenanceType { | ||||||||
| errs = append(errs, field.Invalid(field.NewPath("providerSpec", "onHostMaintenance"), | ||||||||
| providerSpec.OnHostMaintenance, | ||||||||
| fmt.Sprintf("ConfidentialCompute %s requires OnHostMaintenance to be set to %s, the current value is: %s", providerSpec.ConfidentialCompute, machinev1beta1.TerminateHostMaintenanceType, providerSpec.OnHostMaintenance))) | ||||||||
| } | ||||||||
| case machinev1beta1.ConfidentialComputePolicyTDX: | ||||||||
| if !slices.Contains(gcpConfidentialTypeMachineSeriesSupportingTDX, machineSeries) { | ||||||||
| errs = append(errs, field.Invalid(field.NewPath("providerSpec", "machineType"), | ||||||||
|
|
||||||||
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.
c3dis also supported now.