Skip to content

Commit 8171b63

Browse files
bgartzijlebon
authored andcommitted
gcloud: Enable TDX_CAPABLE
Previous work: #3547 Previous work: #3871 Fixes: coreos/fedora-coreos-tracker#1814 Fixes: https://issues.redhat.com/browse/COS-3111
1 parent d3ec501 commit 8171b63

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

mantle/cmd/kola/options.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func init() {
125125
sv(&kola.GCPOptions.ServiceAcct, "gcp-service-account", "", "GCP service account to attach to instance (default project default)")
126126
bv(&kola.GCPOptions.ServiceAuth, "gcp-service-auth", false, "for non-interactive auth when running within GCP")
127127
sv(&kola.GCPOptions.JSONKeyFile, "gcp-json-key", "", "use a service account's JSON key for authentication (default \"~/"+auth.GCPConfigPath+"\")")
128-
sv(&kola.GCPOptions.ConfidentialType, "gcp-confidential-type", "", "create confidential instances: sev, sev_snp")
128+
sv(&kola.GCPOptions.ConfidentialType, "gcp-confidential-type", "", "create confidential instances: sev, sev_snp, tdx")
129129

130130
// openstack-specific options
131131
sv(&kola.OpenStackOptions.ConfigPath, "openstack-config-file", "", "Path to a clouds.yaml formatted OpenStack config file. The underlying library defaults to ./clouds.yaml")
@@ -250,7 +250,11 @@ func syncOptionsImpl(useCosa bool) error {
250250
if kola.GCPOptions.ConfidentialType != "" {
251251
// https://cloud.google.com/compute/confidential-vm/docs/locations
252252
fmt.Printf("Setting instance type for confidential computing\n")
253-
kola.GCPOptions.MachineType = "n2d-standard-2"
253+
if kola.GCPOptions.ConfidentialType == "tdx" {
254+
kola.GCPOptions.MachineType = "c3-standard-4"
255+
} else {
256+
kola.GCPOptions.MachineType = "n2d-standard-2"
257+
}
254258
} else {
255259
kola.GCPOptions.MachineType = "n1-standard-1"
256260
}

mantle/platform/api/gcloud/compute.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (a *API) mkinstance(userdata, name string, keys []*agent.Key, opts platform
150150
if a.options.ConfidentialType != "" {
151151
ConfidentialType := strings.ToUpper(a.options.ConfidentialType)
152152
ConfidentialType = strings.Replace(ConfidentialType, "-", "_", -1)
153-
if ConfidentialType == "SEV" || ConfidentialType == "SEV_SNP" {
153+
if ConfidentialType == "SEV" || ConfidentialType == "SEV_SNP" || ConfidentialType == "TDX" {
154154
fmt.Printf("Using confidential type for confidential computing %s\n", ConfidentialType)
155155
instance.ConfidentialInstanceConfig = &compute.ConfidentialInstanceConfig{
156156
ConfidentialInstanceType: ConfidentialType,
@@ -159,7 +159,7 @@ func (a *API) mkinstance(userdata, name string, keys []*agent.Key, opts platform
159159
OnHostMaintenance: "TERMINATE",
160160
}
161161
} else {
162-
return nil, fmt.Errorf("Does not support confidential type %s, should be: sev, sev_snp\n", a.options.ConfidentialType)
162+
return nil, fmt.Errorf("Does not support confidential type %s, should be: sev, sev_snp, tdx\n", a.options.ConfidentialType)
163163
}
164164
}
165165
// metal instances can only have a TERMINATE maintenance policy

mantle/platform/api/gcloud/image.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ func (a *API) CreateImage(spec *ImageSpec, overwrite bool) (*compute.Operation,
111111
{
112112
Type: "IDPF",
113113
},
114+
// https://cloud.google.com/blog/products/identity-security/confidential-vms-on-intel-cpus-your-datas-new-intelligent-defense
115+
{
116+
Type: "TDX_CAPABLE",
117+
},
114118
}
115119

116120
if spec.Architecture == "" {

0 commit comments

Comments
 (0)