Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for vm boot diagnostic profile #136

Merged
merged 4 commits into from
Mar 29, 2024
Merged
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
3 changes: 3 additions & 0 deletions kubernetes/machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ providerSpec:
machineSet:
id: <string>
Kind: <string>
diagnosticsProfile:
enabled: false
# storageURI: <string>
resourceGroup: <resource-group-name>
subnetInfo:
# vnetResourceGroup: <vnet-resource-group-name>
Expand Down
12 changes: 12 additions & 0 deletions pkg/azure/api/providerspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ type AzureVirtualMachineProperties struct {
// 3. Only `Flexible` variant of VMSS is currently supported. It is strongly recommended that consumers turn-off any
// autoscaling capabilities as it interferes with the lifecycle management of MCM and auto-scaling capabilities offered by Cluster-Autoscaler.
VirtualMachineScaleSet *AzureSubResource `json:"virtualMachineScaleSet,omitempty"`
// DiagnosticsProfile specifies if boot metrics are enabled and where they are stored
// For additional information see: [https://learn.microsoft.com/en-us/azure/virtual-machines/boot-diagnostics]
DiagnosticsProfile *AzureDiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
// Deprecated: Use either AvailabilitySet or VirtualMachineScaleSet instead
MachineSet *AzureMachineSetConfig `json:"machineSet,omitempty"`
}
Expand Down Expand Up @@ -266,3 +269,12 @@ type AzureSubnetInfo struct {
// SubnetName is the name of the subnet which is unique within a resource group.
SubnetName string `json:"subnetName,omitempty"`
}

// AzureDiagnosticsProfile specifies boot diagnostic options
type AzureDiagnosticsProfile struct {
// Enabled configures boot diagnostics to be stored or not
Enabled bool `json:"enabled,omitempty"`
// StorageURI is the URI of the storage account to use for storing console output and screenshot.
// If not specified azure managed storage will be used.
StorageURI *string `json:"storageURI,omitempty"`
}
13 changes: 13 additions & 0 deletions pkg/azure/provider/helpers/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ func createVMCreationParams(providerSpec api.AzureProviderSpec, imageRef armcomp
},
AvailabilitySet: getAvailabilitySet(providerSpec.Properties.AvailabilitySet),
VirtualMachineScaleSet: getVirtualMachineScaleSet(providerSpec.Properties.VirtualMachineScaleSet),
DiagnosticsProfile: getDiagnosticsProfile(providerSpec.Properties.DiagnosticsProfile),
},
Tags: vmTags,
Zones: getZonesFromProviderSpec(providerSpec),
Expand Down Expand Up @@ -727,3 +728,15 @@ func getZonesFromProviderSpec(spec api.AzureProviderSpec) []*string {
}
return zones
}

func getDiagnosticsProfile(profile *api.AzureDiagnosticsProfile) *armcompute.DiagnosticsProfile {
if profile == nil {
return nil
}
return &armcompute.DiagnosticsProfile{
BootDiagnostics: &armcompute.BootDiagnostics{
Enabled: to.Ptr(profile.Enabled),
StorageURI: profile.StorageURI,
},
}
}