Skip to content

Commit

Permalink
make trusted launch opt-in
Browse files Browse the repository at this point in the history
  • Loading branch information
jepio committed Apr 17, 2024
1 parent 67775a2 commit 1354004
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func init() {
sv(&kola.AzureOptions.DiskController, "azure-disk-controller", "default", "Use a specific disk-controller for storage (default \"default\", also \"nvme\" and \"scsi\")")
sv(&kola.AzureOptions.ResourceGroup, "azure-resource-group", "", "Deploy resources in an existing resource group")
sv(&kola.AzureOptions.AvailabilitySet, "azure-availability-set", "", "Deploy instances with an existing availibity set")
bv(&kola.AzureOptions.TrustedLaunch, "azure-trusted-launch", false, "Enable trusted launch for VMs (default \"false\")")

// do-specific options
sv(&kola.DOOptions.ConfigPath, "do-config-file", "", "DigitalOcean config file (default \"~/"+auth.DOConfigPath+"\")")
Expand Down
11 changes: 7 additions & 4 deletions platform/api/azure/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"io"
"io/ioutil"
"regexp"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
Expand Down Expand Up @@ -153,9 +152,13 @@ func (a *API) getVMParameters(name, userdata, sshkey, storageAccountURI string,
},
}

if a.Opts.HyperVGeneration == string(compute.HyperVGenerationTypeV2) &&
(a.Opts.UseGallery || strings.Contains(a.Opts.DiskURI, "galleries")) &&
a.Opts.Board == "amd64-usr" {
if a.Opts.TrustedLaunch {
if a.Opts.HyperVGeneration != string(compute.HyperVGenerationTypeV2) {
plog.Warningf("TrustedLaunch is only supported for HyperVGeneration v2; ignoring")
}
if a.Opts.Board != "amd64-usr" {
plog.Warningf("TrustedLaunch is only supported for amd64-usr; ignoring")
}
vm.SecurityProfile = &compute.SecurityProfile{
SecurityType: compute.SecurityTypesTrustedLaunch,
UefiSettings: &compute.UefiSettings{
Expand Down
1 change: 1 addition & 0 deletions platform/api/azure/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Options struct {
UseGallery bool
UseIdentity bool
UsePrivateIPs bool
TrustedLaunch bool

DiskController string

Expand Down

0 comments on commit 1354004

Please sign in to comment.