Skip to content

Commit 2488b27

Browse files
Merge pull request #1420 from fangge1212/amd_sev_snp
OCPCLOUD-3072: Support AMD SEV-SNP on AWS
2 parents fb6dcee + cc4318f commit 2488b27

File tree

54 files changed

+963
-5413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+963
-5413
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/onsi/ginkgo/v2 v2.23.4
2020
github.com/onsi/gomega v1.37.0
2121
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250711173707-dc2a20e5a5f8
22-
github.com/openshift/api v0.0.0-20250901120840-a638ff2e96fb
22+
github.com/openshift/api v0.0.0-20251009093019-7837a801e8c1
2323
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
2424
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20250718085303-e712b1ebf374
2525
github.com/openshift/cluster-control-plane-machine-set-operator v0.0.0-20250424110138-1dbf0c7a5d51

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ github.com/opencontainers/selinux v1.11.1 h1:nHFvthhM0qY8/m+vfhJylliSshm8G1jJ2jD
457457
github.com/opencontainers/selinux v1.11.1/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
458458
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250711173707-dc2a20e5a5f8 h1:D+Qga9nujuIcrAjcAuKPukoUcVBl6ZDEbtgNLgKKlgY=
459459
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250711173707-dc2a20e5a5f8/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
460-
github.com/openshift/api v0.0.0-20250901120840-a638ff2e96fb h1:L5A3091VKSyOJb0nJto/pQyyHueoaW+4sXLO5fHrTBE=
461-
github.com/openshift/api v0.0.0-20250901120840-a638ff2e96fb/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
460+
github.com/openshift/api v0.0.0-20251009093019-7837a801e8c1 h1:YDyN6zwe8H/bdYAp3kQekpjknSAGK4CjKOfYtk3261M=
461+
github.com/openshift/api v0.0.0-20251009093019-7837a801e8c1/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
462462
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee h1:tOtrrxfDEW8hK3eEsHqxsXurq/D6LcINGfprkQC3hqY=
463463
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee/go.mod h1:zhRiYyNMk89llof2qEuGPWPD+joQPhCRUc2IK0SB510=
464464
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20250718085303-e712b1ebf374 h1:ldUi0e64kdYJC2+ucB24GRXIXfMnI3NpSkcnalPqBGo=

pkg/webhooks/machine_webhook.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,35 @@ func validateAWS(m *machinev1beta1.Machine, config *admissionConfig) (bool, []st
868868
)
869869
}
870870

871+
if providerSpec.CPUOptions != nil {
872+
if *providerSpec.CPUOptions == (machinev1beta1.CPUOptions{}) {
873+
errs = append(
874+
errs,
875+
field.Invalid(
876+
field.NewPath("providerSpec", "CPUOptions"),
877+
"{}",
878+
"At least one field must be set if cpuOptions is provided",
879+
),
880+
)
881+
}
882+
883+
if providerSpec.CPUOptions.ConfidentialCompute != nil {
884+
switch *providerSpec.CPUOptions.ConfidentialCompute {
885+
case machinev1beta1.AWSConfidentialComputePolicyDisabled, machinev1beta1.AWSConfidentialComputePolicySEVSNP:
886+
// Valid values
887+
default:
888+
errs = append(
889+
errs,
890+
field.Invalid(
891+
field.NewPath("providerSpec", "CPUOptions", "ConfidentialCompute"),
892+
providerSpec.CPUOptions.ConfidentialCompute,
893+
fmt.Sprintf("Allowed values are %s, %s and omitted", machinev1beta1.AWSConfidentialComputePolicyDisabled, machinev1beta1.AWSConfidentialComputePolicySEVSNP),
894+
),
895+
)
896+
}
897+
}
898+
}
899+
871900
if len(errs) > 0 {
872901
return false, warnings, errs
873902
}

pkg/webhooks/machine_webhook_test.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2610,6 +2610,52 @@ func TestValidateAWSProviderSpec(t *testing.T) {
26102610
expectedOk: false,
26112611
expectedError: "providerSpec.metadataServiceOptions.authentication: Invalid value: \"Boom\": Allowed values are either 'Optional' or 'Required'",
26122612
},
2613+
{
2614+
testCase: "with cpuOptions empty",
2615+
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {
2616+
p.CPUOptions = &machinev1beta1.CPUOptions{}
2617+
},
2618+
expectedOk: false,
2619+
expectedError: "providerSpec.CPUOptions: Invalid value: \"{}\": At least one field must be set if cpuOptions is provided",
2620+
},
2621+
{
2622+
testCase: "with confidentialCompute set to AMD SEV-SNP",
2623+
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {
2624+
p.CPUOptions = &machinev1beta1.CPUOptions{
2625+
ConfidentialCompute: ptr.To(machinev1beta1.AWSConfidentialComputePolicySEVSNP),
2626+
}
2627+
},
2628+
expectedOk: true,
2629+
},
2630+
{
2631+
testCase: "with confidentialCompute disabled",
2632+
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {
2633+
p.CPUOptions = &machinev1beta1.CPUOptions{
2634+
ConfidentialCompute: ptr.To(machinev1beta1.AWSConfidentialComputePolicyDisabled),
2635+
}
2636+
},
2637+
expectedOk: true,
2638+
},
2639+
{
2640+
testCase: "with confidentialCompute set to invalid value",
2641+
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {
2642+
p.CPUOptions = &machinev1beta1.CPUOptions{
2643+
ConfidentialCompute: ptr.To(machinev1beta1.AWSConfidentialComputePolicy("invalid")),
2644+
}
2645+
},
2646+
expectedOk: false,
2647+
expectedError: "providerSpec.CPUOptions.ConfidentialCompute: Invalid value: \"invalid\": Allowed values are Disabled, AMDEncryptedVirtualizationNestedPaging and omitted",
2648+
},
2649+
{
2650+
testCase: "with confidentialCompute empty",
2651+
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {
2652+
p.CPUOptions = &machinev1beta1.CPUOptions{
2653+
ConfidentialCompute: ptr.To(machinev1beta1.AWSConfidentialComputePolicy("")),
2654+
}
2655+
},
2656+
expectedOk: false,
2657+
expectedError: "providerSpec.CPUOptions.ConfidentialCompute: Invalid value: \"\": Allowed values are Disabled, AMDEncryptedVirtualizationNestedPaging and omitted",
2658+
},
26132659
{
26142660
testCase: "with invalid GroupVersionKind",
26152661
modifySpec: func(p *machinev1beta1.AWSMachineProviderConfig) {

vendor/github.com/openshift/api/.ci-operator.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/Dockerfile.ocp

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/Makefile

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/config/v1/types_apiserver.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/config/v1/types_cluster_operator.go

Lines changed: 14 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/openshift/api/config/v1/types_cluster_version.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)