Skip to content

Commit

Permalink
azure: Remove unused StorageAccount
Browse files Browse the repository at this point in the history
We switched to managed boot diagnostics, so we no longer require a separate
storage account for that purpose.  We still need a storage account when
uploading images.

Signed-off-by: Jeremi Piotrowski <[email protected]>
  • Loading branch information
jepio committed Mar 5, 2025
1 parent 182efc2 commit dac7736
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
8 changes: 4 additions & 4 deletions platform/api/azure/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (a *API) getVMRG(rg string) string {
return vmrg
}

func (a *API) getVMParameters(name, sshkey, storageAccountURI string, userdata *conf.Conf, ip *armnetwork.PublicIPAddress, nic *armnetwork.Interface, managedIdentityID string) armcompute.VirtualMachine {
func (a *API) getVMParameters(name, sshkey string, userdata *conf.Conf, ip *armnetwork.PublicIPAddress, nic *armnetwork.Interface, managedIdentityID string) armcompute.VirtualMachine {
osProfile := armcompute.OSProfile{
AdminUsername: to.Ptr("core"),
ComputerName: &name,
Expand Down Expand Up @@ -197,7 +197,7 @@ func (a *API) getVMParameters(name, sshkey, storageAccountURI string, userdata *
return vm
}

func (a *API) CreateInstance(name, sshkey, resourceGroup, storageAccount string, userdata *conf.Conf, network Network, managedIdentityID string) (*Machine, error) {
func (a *API) CreateInstance(name, sshkey, resourceGroup string, userdata *conf.Conf, network Network, managedIdentityID string) (*Machine, error) {
// only VMs are created in the user supplied resource group, kola still manages a resource group
// for the gallery and storage account.
vmResourceGroup := a.getVMRG(resourceGroup)
Expand All @@ -220,7 +220,7 @@ func (a *API) CreateInstance(name, sshkey, resourceGroup, storageAccount string,
}

// Pass the managedIdentityID to getVMParameters
vmParams := a.getVMParameters(name, sshkey, fmt.Sprintf("https://%s.blob.core.windows.net/", storageAccount), userdata, ip, nic, managedIdentityID)
vmParams := a.getVMParameters(name, sshkey, userdata, ip, nic, managedIdentityID)
plog.Infof("Creating Instance %s", name)

clean := func() {
Expand Down Expand Up @@ -300,7 +300,7 @@ func (a *API) TerminateInstance(machine *Machine, resourceGroup string) error {
return err
}

func (a *API) GetConsoleOutput(name, resourceGroup, storageAccount string) ([]byte, error) {
func (a *API) GetConsoleOutput(name, resourceGroup string) ([]byte, error) {
vmResourceGroup := a.getVMRG(resourceGroup)
param := &armcompute.VirtualMachinesClientRetrieveBootDiagnosticsDataOptions{
SasURIExpirationTimeInMinutes: to.Ptr[int32](5),
Expand Down
3 changes: 1 addition & 2 deletions platform/machine/azure/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type cluster struct {
flight *flight
sshKey string
ResourceGroup string
StorageAccount string
Network azure.Network
ManagedIdentityID string // Add managed identity ID field to cluster struct
}
Expand All @@ -50,7 +49,7 @@ func (ac *cluster) NewMachine(userdata *conf.UserData) (platform.Machine, error)
}

// Pass the managed identity ID to the CreateInstance method
instance, err := ac.flight.Api.CreateInstance(ac.vmname(), ac.sshKey, ac.ResourceGroup, ac.StorageAccount, conf, ac.Network, ac.ManagedIdentityID)
instance, err := ac.flight.Api.CreateInstance(ac.vmname(), ac.sshKey, ac.ResourceGroup, conf, ac.Network, ac.ManagedIdentityID)
if err != nil {
return nil, err
}
Expand Down
6 changes: 0 additions & 6 deletions platform/machine/azure/flight.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,13 @@ func (af *flight) NewCluster(rconf *platform.RuntimeConfig) (platform.Cluster, e

if af.ImageResourceGroup != "" && af.ImageStorageAccount != "" {
ac.ResourceGroup = af.ImageResourceGroup
ac.StorageAccount = af.ImageStorageAccount
ac.Network = af.Network
} else {
ac.ResourceGroup, err = af.Api.CreateResourceGroup("kola-cluster")
if err != nil {
return nil, err
}

ac.StorageAccount, err = af.Api.CreateStorageAccount(ac.ResourceGroup)
if err != nil {
return nil, err
}

ac.Network, err = af.Api.PrepareNetworkResources(ac.ResourceGroup)
if err != nil {
ac.Destroy()
Expand Down
2 changes: 1 addition & 1 deletion platform/machine/azure/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (am *machine) ConsoleOutput() string {

func (am *machine) saveConsole() error {
var err error
am.console, err = am.cluster.flight.Api.GetConsoleOutput(am.ID(), am.ResourceGroup(), am.cluster.StorageAccount)
am.console, err = am.cluster.flight.Api.GetConsoleOutput(am.ID(), am.ResourceGroup())
if err != nil {
return err
}
Expand Down

0 comments on commit dac7736

Please sign in to comment.