Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/asset/installconfig/azure/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ func (c *Client) GetVirtualMachineSku(ctx context.Context, name, region string)

// GetDiskEncryptionSet retrieves the specified disk encryption set.
func (c *Client) GetDiskEncryptionSet(ctx context.Context, subscriptionID, groupName, diskEncryptionSetName string) (*azenc.DiskEncryptionSet, error) {
if c.ssn.Credentials.SubscriptionID != subscriptionID {
return nil, fmt.Errorf("different subscription from resource group subscription. Azure does not support cross subscription encryption sets")
}
client := azenc.NewDiskEncryptionSetsClientWithBaseURI(c.ssn.Environment.ResourceManagerEndpoint, subscriptionID)
client.Authorizer = c.ssn.Authorizer
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
Expand All @@ -327,7 +330,6 @@ func (c *Client) GetDiskEncryptionSet(ctx context.Context, subscriptionID, group
if err != nil {
return nil, fmt.Errorf("failed to get disk encryption set: %w", err)
}

return &diskEncryptionSet, nil
}

Expand Down
15 changes: 15 additions & 0 deletions pkg/asset/installconfig/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ func (a *InstallConfig) finishGCP() error {
return nil
}

// finishAzure set defaults for Azure platform.
func (a *InstallConfig) finishAzure() error {
if a.Config.Azure.DefaultMachinePlatform.OSDisk.SubscriptionID == "" {
session, err := a.Azure.Session()
if err != nil {
return err
}
a.Config.Azure.DefaultMachinePlatform.OSDisk.SubscriptionID = session.Credentials.SubscriptionID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, subscriptionID must be set, otherwise installer exited with error:

$ ./openshift-install create manifests --dir ipi4
INFO ipFamily is not specified in install-config; defaulting to "IPv4" 
ERROR failed to fetch Master Machines: failed to load asset "Install Config": failed to create install config: invalid "install-config.yaml" file: [controlPlane.platform.azure.defaultMachinePlatform.osDisk.diskEncryptionSet.subscriptionID: Required value: subscription ID is required, compute[0].platform.azure.defaultMachinePlatform.osDisk.diskEncryptionSet.subscriptionID: Required value: subscription ID is required] 

}
return nil
}

// finishAWS set defaults for AWS Platform before the config validation.
func (a *InstallConfig) finishAWS() error {
// Set the Default Edge Compute pool when the subnets in AWS Local Zones are defined,
Expand Down Expand Up @@ -194,6 +206,9 @@ func (a *InstallConfig) finish(ctx context.Context, filename string) error {
}
if a.Config.Azure != nil {
a.Azure = icazure.NewMetadata(a.Config.Azure, a.Config.ControlPlane, &a.Config.Compute[0])
if err := a.finishAzure(); err != nil {
return err
}
}
if a.Config.GCP != nil {
if err := a.finishGCP(); err != nil {
Expand Down