config

package
v0.0.0-...-9e87b0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultV5VMSKU = "Standard_D2ds_v5"
)

Variables

View Source
var (
	Config         = mustLoadConfig()
	Azure          = mustNewAzureClient()
	VMIdentityName = "abe2e-vm-identity"

	DefaultPollUntilDoneOptions = &runtime.PollUntilDoneOptions{
		Frequency: time.Second,
	}
	VMSSHPublicKey, VMSSHPrivateKey, SysSSHPublicKey, SysSSHPrivateKey []byte
	VMSSHPrivateKeyFileName, SysSSHPrivateKeyFileName                  string
)
View Source
var (
	VHDUbuntu2204Gen2Arm64Containerd = &Image{
		Name:    "2204gen2arm64containerd",
		OS:      OSUbuntu,
		Arch:    "arm64",
		Distro:  datamodel.AKSUbuntuArm64Containerd2204Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDUbuntu2204Gen2Containerd = &Image{
		Name:    "2204gen2containerd",
		OS:      OSUbuntu,
		Arch:    "amd64",
		Distro:  datamodel.AKSUbuntuContainerd2204Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDUbuntu2204FIPSContainerd = &Image{
		Name:                "2204fipscontainerd",
		OS:                  OSUbuntu,
		Arch:                "amd64",
		Distro:              datamodel.AKSUbuntuFipsContainerd2204,
		Gallery:             imageGalleryLinux,
		UnsupportedLocalDns: true,

		UnsupportedSecureTLSBootstrapping: true,
		UnsupportedGen2:                   true,
	}
	VHDUbuntu2204Gen2FIPSContainerd = &Image{
		Name:                "2204gen2fipscontainerd",
		OS:                  OSUbuntu,
		Arch:                "amd64",
		Distro:              datamodel.AKSUbuntuFipsContainerd2204Gen2,
		Gallery:             imageGalleryLinux,
		UnsupportedLocalDns: true,

		UnsupportedSecureTLSBootstrapping: true,
	}
	VHDUbuntu2204Gen2FIPSTLContainerd = &Image{
		Name:                "2204gen2fipsTLcontainerd",
		OS:                  OSUbuntu,
		Arch:                "amd64",
		Distro:              datamodel.AKSUbuntuFipsContainerd2204TLGen2,
		Gallery:             imageGalleryLinux,
		UnsupportedLocalDns: true,

		UnsupportedSecureTLSBootstrapping: true,
	}
	VHDAzureLinuxV2Gen2Arm64 = &Image{
		Name:    "AzureLinuxV2gen2arm64",
		OS:      OSAzureLinux,
		Arch:    "arm64",
		Distro:  datamodel.AKSAzureLinuxV2Arm64Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDAzureLinuxV2Gen2 = &Image{
		Name:    "AzureLinuxV2gen2",
		OS:      OSAzureLinux,
		Arch:    "amd64",
		Distro:  datamodel.AKSAzureLinuxV2Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDAzureLinuxV3Gen2 = &Image{
		Name:    "AzureLinuxV3gen2",
		OS:      OSAzureLinux,
		Arch:    "amd64",
		Distro:  datamodel.AKSAzureLinuxV3Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDAzureLinux3OSGuard = &Image{
		Name:                "AzureLinuxOSGuardOSGuardV3gen2fipsTL",
		OS:                  OSAzureLinux,
		Arch:                "amd64",
		Distro:              datamodel.AKSAzureLinuxV3OSGuardGen2FIPSTL,
		Gallery:             imageGalleryLinux,
		UnsupportedLocalDns: true,

		UnsupportedSecureTLSBootstrapping: true,
	}
	VHDCBLMarinerV2Gen2Arm64 = &Image{
		Name:    "CBLMarinerV2gen2arm64",
		OS:      OSMariner,
		Arch:    "arm64",
		Distro:  datamodel.AKSCBLMarinerV2Arm64Gen2,
		Gallery: imageGalleryLinux,
	}
	VHDCBLMarinerV2Gen2 = &Image{
		Name:    "CBLMarinerV2gen2",
		OS:      OSMariner,
		Arch:    "amd64",
		Distro:  datamodel.AKSCBLMarinerV2Gen2,
		Gallery: imageGalleryLinux,
	}
	// this is a particular 2204gen2containerd image originally built with private packages,
	// if we ever want to update this then we'd need to run a new VHD build using private package overrides
	VHDUbuntu2204Gen2ContainerdPrivateKubePkg = &Image{

		Name:                     "2204Gen2",
		OS:                       OSUbuntu,
		Arch:                     "amd64",
		Version:                  "1.1704411049.2812",
		Distro:                   datamodel.AKSUbuntuContainerd2204Gen2,
		Gallery:                  imageGalleryLinux,
		UnsupportedKubeletNodeIP: true,
		UnsupportedLocalDns:      true,

		UnsupportedSecureTLSBootstrapping: true,
		UnsupportedNVMe:                   true,

		IgnoreFailedCgroupTelemetryServices: true,
	}

	// without kubelet, kubectl, credential-provider and wasm
	VHDUbuntu2204Gen2ContainerdNetworkIsolatedK8sNotCached = &Image{
		Name:                "2204Gen2",
		OS:                  OSUbuntu,
		Arch:                "amd64",
		Version:             "1.1725612526.29638",
		Distro:              datamodel.AKSUbuntuContainerd2204Gen2,
		Gallery:             imageGalleryLinux,
		UnsupportedLocalDns: true,

		UnsupportedSecureTLSBootstrapping: true,
		UnsupportedNVMe:                   true,

		IgnoreFailedCgroupTelemetryServices: true,
	}

	VHDUbuntu2404Gen1Containerd = &Image{
		Name:            "2404containerd",
		OS:              OSUbuntu,
		Arch:            "amd64",
		Distro:          datamodel.AKSUbuntuContainerd2404,
		Gallery:         imageGalleryLinux,
		UnsupportedGen2: true,
	}

	VHDUbuntu2404Gen2Containerd = &Image{
		Name:    "2404gen2containerd",
		OS:      OSUbuntu,
		Arch:    "amd64",
		Distro:  datamodel.AKSUbuntuContainerd2404Gen2,
		Gallery: imageGalleryLinux,
	}

	VHDUbuntu2404ArmContainerd = &Image{
		Name:    "2404gen2arm64containerd",
		OS:      OSUbuntu,
		Arch:    "arm64",
		Distro:  datamodel.AKSUbuntuArm64Containerd2404Gen2,
		Gallery: imageGalleryLinux,
	}

	VHDFlatcarGen2 = &Image{
		Name:         "flatcargen2",
		OS:           OSFlatcar,
		Arch:         "amd64",
		Distro:       datamodel.AKSFlatcarGen2,
		Gallery:      imageGalleryLinux,
		Flatcar:      true,
		OSDiskSizeGB: 60,
	}

	VHDFlatcarGen2Arm64 = &Image{
		Name:         "flatcargen2arm64",
		OS:           OSFlatcar,
		Arch:         "arm64",
		Distro:       datamodel.AKSFlatcarArm64Gen2,
		Gallery:      imageGalleryLinux,
		Flatcar:      true,
		OSDiskSizeGB: 60,
	}

	VHDWindows2019Containerd = &Image{
		Name:    "windows-2019-containerd",
		OS:      "windows",
		Arch:    "amd64",
		Distro:  datamodel.AKSWindows2019Containerd,
		Gallery: imageGalleryWindows,
	}

	VHDWindows2022Containerd = &Image{
		Name:            "windows-2022-containerd",
		OS:              "windows",
		Arch:            "amd64",
		Distro:          datamodel.AKSWindows2022Containerd,
		Gallery:         imageGalleryWindows,
		UnsupportedGen2: true,
	}

	VHDWindows2022ContainerdGen2 = &Image{
		Name:    "windows-2022-containerd-gen2",
		OS:      OSWindows,
		Arch:    "amd64",
		Distro:  datamodel.AKSWindows2022ContainerdGen2,
		Gallery: imageGalleryWindows,
	}

	VHDWindows23H2 = &Image{
		Name:            "windows-23H2",
		OS:              OSWindows,
		Arch:            "amd64",
		Distro:          datamodel.AKSWindows23H2,
		Gallery:         imageGalleryWindows,
		UnsupportedGen2: true,
	}

	VHDWindows23H2Gen2 = &Image{
		Name:    "windows-23H2-gen2",
		OS:      OSWindows,
		Arch:    "amd64",
		Distro:  datamodel.AKSWindows23H2Gen2,
		Gallery: imageGalleryWindows,
	}

	VHDWindows2025 = &Image{
		Name:            "windows-2025",
		OS:              OSWindows,
		Arch:            "amd64",
		Distro:          datamodel.AKSWindows2025,
		Gallery:         imageGalleryWindows,
		UnsupportedGen2: true,
	}

	VHDWindows2025Gen2 = &Image{
		Name:    "windows-2025-gen2",
		OS:      OSWindows,
		Arch:    "amd64",
		Distro:  datamodel.AKSWindows2025Gen2,
		Gallery: imageGalleryWindows,
	}
)
View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

func DefaultRetryOpts

func DefaultRetryOpts() policy.RetryOptions

func GetPrivateACRName

func GetPrivateACRName(isNonAnonymousPull bool, location string) string

func NewHttpClient

func NewHttpClient() *http.Client

func PrivateACRName

func PrivateACRName(location string) string

func PrivateACRNameNotAnon

func PrivateACRNameNotAnon(location string) string

func ResourceGroupName

func ResourceGroupName(location string) string

func SkuSupportsNVMe

func SkuSupportsNVMe(sku *armcompute.ResourceSKU) bool

SkuSupportsNVMe checks the DiskControllerTypes capability of a resource SKU. Returns true if supported disk controller type is NVMe.

func SkuSupportsOnlyGen2

func SkuSupportsOnlyGen2(sku *armcompute.ResourceSKU) bool

SkuSupportsOnlyGen2 checks the HyperVGenerations capability of a resource SKU. Returns true if the only supported hypervisor generation is V2.

Types

type AzureClient

type AzureClient struct {
	AKS                       *armcontainerservice.ManagedClustersClient
	AzureFirewall             *armnetwork.AzureFirewallsClient
	BastionHosts              *armnetwork.BastionHostsClient
	Blob                      *azblob.Client
	StorageContainers         *armstorage.BlobContainersClient
	CacheRulesClient          *armcontainerregistry.CacheRulesClient
	Core                      *azcore.Client
	Credential                *azidentity.AzureCLICredential
	Maintenance               *armcontainerservice.MaintenanceConfigurationsClient
	NetworkInterfaces         *armnetwork.InterfacesClient
	PrivateDNSZoneGroup       *armnetwork.PrivateDNSZoneGroupsClient
	PrivateEndpointClient     *armnetwork.PrivateEndpointsClient
	PrivateZonesClient        *armprivatedns.PrivateZonesClient
	RecordSetClient           *armprivatedns.RecordSetsClient
	RegistriesClient          *armcontainerregistry.RegistriesClient
	Resource                  *armresources.Client
	ResourceGroup             *armresources.ResourceGroupsClient
	RoleAssignments           *armauthorization.RoleAssignmentsClient
	SecurityGroup             *armnetwork.SecurityGroupsClient
	StorageAccounts           *armstorage.AccountsClient
	Subnet                    *armnetwork.SubnetsClient
	PublicIPAddresses         *armnetwork.PublicIPAddressesClient
	RouteTables               *armnetwork.RouteTablesClient
	UserAssignedIdentities    *armmsi.UserAssignedIdentitiesClient
	VMSS                      *armcompute.VirtualMachineScaleSetsClient
	VMSSVM                    *armcompute.VirtualMachineScaleSetVMsClient
	VMs                       *armcompute.VirtualMachinesClient
	Images                    *armcompute.ImagesClient
	Snapshots                 *armcompute.SnapshotsClient
	Galleries                 *armcompute.GalleriesClient
	GalleryImages             *armcompute.GalleryImagesClient
	GalleryImageVersions      *armcompute.GalleryImageVersionsClient
	VNet                      *armnetwork.VirtualNetworksClient
	VirutalNetworkLinksClient *armprivatedns.VirtualNetworkLinksClient
	ArmOptions                *arm.ClientOptions
	VMSSVMRunCommands         *armcompute.VirtualMachineScaleSetVMRunCommandsClient
	VMExtensionImages         *armcompute.VirtualMachineExtensionImagesClient
	ResourceSKUs              *armcompute.ResourceSKUsClient
}

func NewAzureClient

func NewAzureClient() (*AzureClient, error)

func (*AzureClient) CreateVMManagedIdentity

func (a *AzureClient) CreateVMManagedIdentity(ctx context.Context, identityLocation string) (string, error)

func (*AzureClient) DeleteDisk

func (a *AzureClient) DeleteDisk(ctx context.Context, resourceGroupName, diskName string) error

DeleteDisk deletes a managed disk

func (*AzureClient) DeleteSIGImageVersion

func (a *AzureClient) DeleteSIGImageVersion(ctx context.Context, galleryResourceGroup, galleryName, imageName, version string)

DeleteSIGImageVersion deletes a SIG image version

func (*AzureClient) DeleteSnapshot

func (a *AzureClient) DeleteSnapshot(ctx context.Context, resourceGroupName, snapshotName string) error

DeleteSnapshot deletes a disk snapshot

func (*AzureClient) EnsureSIGImageVersion

func (a *AzureClient) EnsureSIGImageVersion(ctx context.Context, image *Image, location string) (VHDResourceID, error)

func (*AzureClient) GetLatestVMExtensionImageVersion

func (a *AzureClient) GetLatestVMExtensionImageVersion(ctx context.Context, location, extType, extPublisher string) (string, error)

GetLatestVMExtensionImageVersion lists VM extension images for a given extension name and returns the latest version. This is equivalent to: az vm extension image list -n Compute.AKS.Linux.AKSNode --latest

func (*AzureClient) IsVMSizeGen2Only

func (a *AzureClient) IsVMSizeGen2Only(ctx context.Context, location, vmSize string) (bool, error)

IsVMSizeGen2Only queries the Azure Resource SKUs API to determine if the given VM size only supports the Gen2 hypervisor (i.e., does not support Gen1).

func (*AzureClient) LatestSIGImageVersionByTag

func (a *AzureClient) LatestSIGImageVersionByTag(ctx context.Context, image *Image, tagName, tagValue, location string) (VHDResourceID, error)
func (a *AzureClient) UploadAndGetLink(ctx context.Context, blobName string, file *os.File) (string, error)

UploadAndGetLink uploads the data to the blob storage and returns the signed link to download the blob If the blob already exists, it will be overwritten

func (a *AzureClient) UploadAndGetSignedLink(ctx context.Context, blobName string, file *os.File) (string, error)

UploadAndGetSignedLink uploads the data to the blob storage and returns the signed link to download the blob If the blob already exists, it will be overwritten

func (*AzureClient) VMSizeSupportsNVMe

func (a *AzureClient) VMSizeSupportsNVMe(ctx context.Context, location, vmSize string) (bool, error)

VMSizeSupportsNVMe queries the Azure Resource SKUs API to determine if the given VM size supports the NVMe disk controller type.

type Configuration

type Configuration struct {
	// The defaults should only be used when running tests locally, as the CI will set these env vars.
	// We have separate Linux and Windows consts to have different defaults - they use the same env vars.
	ACRSecretName                          string        `env:"ACR_SECRET_NAME" envDefault:"acr-secret-code2"`
	AzureContainerRegistrytargetRepository string        `env:"ACR_TARGET_REPOSITORY" envDefault:"aks-managed-repository/*"`
	BlobContainer                          string        `env:"BLOB_CONTAINER" envDefault:"abe2e"`
	BlobStorageAccountPrefix               string        `env:"BLOB_STORAGE_ACCOUNT_PREFIX" envDefault:"abe2e"`
	BuildID                                string        `env:"BUILD_ID" envDefault:"local"`
	DefaultLocation                        string        `env:"E2E_LOCATION" envDefault:"westus3"`
	DefaultPollInterval                    time.Duration `env:"DEFAULT_POLL_INTERVAL" envDefault:"1s"`
	DefaultSubnetName                      string        `env:"DEFAULT_SUBNET_NAME" envDefault:"aks-subnet"`
	DefaultVMSKU                           string        `env:"DEFAULT_VM_SKU" envDefault:"Standard_D2ds_v5"`
	DisableScriptLessCompilation           bool          `env:"DISABLE_SCRIPTLESS_COMPILATION"`
	E2ELoggingDir                          string        `env:"LOGGING_DIR" envDefault:"scenario-logs"`
	GalleryNameLinux                       string        `env:"GALLERY_NAME" envDefault:"PackerSigGalleryEastUS"`
	GalleryNameWindows                     string        `env:"GALLERY_NAME" envDefault:"PackerSigGalleryEastUS"`
	GalleryResourceGroupNameLinux          string        `env:"GALLERY_RESOURCE_GROUP" envDefault:"aksvhdtestbuildrg"`
	GalleryResourceGroupNameWindows        string        `env:"GALLERY_RESOURCE_GROUP" envDefault:"aksvhdtestbuildrg"`
	GallerySubscriptionIDLinux             string        `env:"GALLERY_SUBSCRIPTION_ID" envDefault:"c4c3550e-a965-4993-a50c-628fd38cd3e1"`
	GallerySubscriptionIDWindows           string        `env:"GALLERY_SUBSCRIPTION_ID" envDefault:"c4c3550e-a965-4993-a50c-628fd38cd3e1"`
	IgnoreScenariosWithMissingVHD          bool          `env:"IGNORE_SCENARIOS_WITH_MISSING_VHD"`
	KeepVMSS                               bool          `env:"KEEP_VMSS"`
	NetworkIsolatedNSGName                 string        `env:"NETWORK_ISOLATED_NSG_NAME" envDefault:"abe2e-networkisolated-securityGroup"`
	SIGVersionTagName                      string        `env:"SIG_VERSION_TAG_NAME" envDefault:"branch"`
	SIGVersionTagValue                     string        `env:"SIG_VERSION_TAG_VALUE" envDefault:"refs/heads/main"`
	SkipTestsWithSKUCapacityIssue          bool          `env:"SKIP_TESTS_WITH_SKU_CAPACITY_ISSUE"`
	SubscriptionID                         string        `env:"SUBSCRIPTION_ID" envDefault:"8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8"`
	TagsToRun                              string        `env:"TAGS_TO_RUN"`
	TagsToSkip                             string        `env:"TAGS_TO_SKIP"`
	ExtendedTests                          string        `env:"EXTENDED_TESTS" envDefault:""`
	TestGalleryImagePrefix                 string        `env:"TEST_GALLERY_IMAGE_PREFIX" envDefault:"abe2etest"`
	TestGalleryNamePrefix                  string        `env:"TEST_GALLERY_NAME_PREFIX" envDefault:"abe2etest"`
	TestPreProvision                       bool          `env:"TEST_PRE_PROVISION" envDefault:"false"`
	TestTimeout                            time.Duration `env:"TEST_TIMEOUT" envDefault:"35m"`
	TestTimeoutCluster                     time.Duration `env:"TEST_TIMEOUT_CLUSTER" envDefault:"20m"`
	TestTimeoutVMSS                        time.Duration `env:"TEST_TIMEOUT_VMSS" envDefault:"17m"`
	WindowsAdminPassword                   string        `env:"WINDOWS_ADMIN_PASSWORD"`
	SysSSHPublicKey                        string        `env:"SYS_SSH_PUBLIC_KEY"`
	SysSSHPrivateKeyB64                    string        `env:"SYS_SSH_PRIVATE_KEY_B64"`
	EnableScriptlessCSECmd                 bool          `env:"ENABLE_SCRIPTLESS_CSE_CMD" envDefault:"false"`
}

func (*Configuration) BlobStorageAccount

func (c *Configuration) BlobStorageAccount() string

func (*Configuration) BlobStorageAccountURL

func (c *Configuration) BlobStorageAccountURL() string

func (*Configuration) GalleryResourceID

func (c *Configuration) GalleryResourceID() string

func (*Configuration) IsLocalBuild

func (c *Configuration) IsLocalBuild() bool

func (*Configuration) String

func (c *Configuration) String() string

func (*Configuration) VMIdentityResourceID

func (c *Configuration) VMIdentityResourceID(location string) string
type Gallery struct {
	SubscriptionID    string
	ResourceGroupName string
	Name              string
}

type Image

type Image struct {
	Arch                                string
	Distro                              datamodel.Distro
	Name                                string
	OS                                  OS
	Version                             string
	Gallery                             *Gallery
	UnsupportedKubeletNodeIP            bool
	UnsupportedLocalDns                 bool
	UnsupportedSecureTLSBootstrapping   bool
	UnsupportedNVMe                     bool
	UnsupportedGen2                     bool
	IgnoreFailedCgroupTelemetryServices bool
	Flatcar                             bool
	// OSDiskSizeGB overrides the default OS disk size (50 GB) when set.
	OSDiskSizeGB int32
}

func GetRandomLinuxAMD64VHD

func GetRandomLinuxAMD64VHD() *Image

func (*Image) String

func (i *Image) String() string

type OS

type OS string
var (
	OSWindows    OS = "windows"
	OSUbuntu     OS = "ubuntu"
	OSMariner    OS = "mariner"
	OSAzureLinux OS = "azurelinux"
	OSFlatcar    OS = "flatcar"
)

type VHDResourceID

type VHDResourceID string

VHDResourceID represents a resource ID pointing to a VHD in Azure. This could be theoretically be the resource ID of a managed image or SIG image version, though for now this will always be a SIG image version.

func GetVHDResourceID

func GetVHDResourceID(ctx context.Context, i Image, location string) (VHDResourceID, error)

func (VHDResourceID) Short

func (id VHDResourceID) Short() string

type VMExtenstionVersion

type VMExtenstionVersion struct {
	Original *armcompute.VirtualMachineExtensionImage
	Major    int
	Minor    int
	Patch    int
}

VMExtenstionVersion represents a parsed version of a VM extension image.

func (VMExtenstionVersion) Less

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL