test

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0, Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCIGImageVersion = "202501.02.0"
	DefaultSIGImageVersion = "202410.09.0"
)
View Source
const (
	// Note (charliedmcb): this already exists in test/pkg/environment/common
	// https://github.com/Azure/karpenter-provider-azure/blob/84e449787ec72268efb0c7af81ec87a6b3ee95fa/test/pkg/environment/common/setup.go#L47
	// However, I'd prefer to keep our unit test dependants self-contained instead of depending upon the e2e testing package.
	TestingFinalizer = "testing/finalizer"
)

Variables

This section is empty.

Functions

func AKSAgentPool added in v1.6.8

func AKSAgentPool(overrides ...AKSAgentPoolOptions) *armcontainerservice.AgentPool

AKSAgentPool creates a test AKS Agent Pool with defaults that can be overridden by AKSAgentPoolOptions. Overrides are applied in order, with last-write-wins semantics.

func AKSMachine added in v1.6.8

func AKSMachine(overrides ...AKSMachineOptions) *armcontainerservice.Machine

AKSMachine creates a test AKS Machine with defaults that can be overridden by AKSMachineOptions. This implementation matches the setDefaultMachineValues pattern from the fake API. Overrides are applied in order, with last-write-wins semantics.

func AKSNodeClass

func AKSNodeClass(overrides ...v1beta1.AKSNodeClass) *v1beta1.AKSNodeClass

func AKSNodeClassFieldIndexer added in v0.7.0

func AKSNodeClassFieldIndexer(ctx context.Context) func(cache.Cache) error

func ApplyCIGImages added in v1.4.0

func ApplyCIGImages(nodeClass *v1beta1.AKSNodeClass)

func ApplyCIGImagesWithVersion added in v1.4.0

func ApplyCIGImagesWithVersion(nodeClass *v1beta1.AKSNodeClass, cigImageVersion string)

func ApplyDefaultStatus added in v1.4.0

func ApplyDefaultStatus(nodeClass *v1beta1.AKSNodeClass, env *coretest.Environment, useSIG bool)

TODO: Pass in test.Options if we want to use more options within this func

func ApplySIGImages added in v1.4.0

func ApplySIGImages(nodeClass *v1beta1.AKSNodeClass)

func ApplySIGImagesWithVersion added in v1.4.0

func ApplySIGImagesWithVersion(nodeClass *v1beta1.AKSNodeClass, sigImageVersion string)

func Interface added in v0.6.2

func Interface(overrides ...InterfaceOptions) *armnetwork.Interface

Interface creates a test Azure Network Interface with defaults that can be overridden by InterfaceOptions. Overrides are applied in order, with last-write-wins semantics.

func MakeNetworkSecurityGroup added in v1.5.0

func MakeNetworkSecurityGroup(resourceGroup string, name string) armnetwork.SecurityGroup

func MakeStandardLoadBalancer

func MakeStandardLoadBalancer(resourceGroup string, lbName string, includeOutbound bool) armnetwork.LoadBalancer

func ManagedTags added in v0.6.2

func ManagedTags(nodepoolName string) map[string]*string

func ManagedTagsAKSMachine added in v1.7.0

func ManagedTagsAKSMachine(nodepoolName string, nodeClaimName string, creationTimestamp time.Time) map[string]*string

func NodePool

func NodePool(options karpv1.NodePool) *karpv1.NodePool

func Options

func Options(overrides ...OptionsFields) *azoptions.Options

func RandomName added in v0.6.2

func RandomName(prefix string) string

RandomName returns a pseudo-random resource name with a given prefix.

func VirtualMachine added in v0.6.2

func VirtualMachine(overrides ...VirtualMachineOptions) *armcompute.VirtualMachine

VirtualMachine creates a test Azure Virtual Machine with defaults that can be overridden by VirtualMachineOptions. Overrides are applied in order, with last-write-wins semantics.

Types

type AKSAgentPoolOptions added in v1.6.8

type AKSAgentPoolOptions struct {
	Name          string
	ResourceGroup string
	// SubscriptionID      string
	ClusterName         string
	Count               int32
	VMSize              string
	OrchestratorVersion string
	Tags                map[string]*string
}

AKSAgentPoolOptions customizes an AKS Agent Pool for testing.

type AKSMachineOptions added in v1.6.8

type AKSMachineOptions struct {
	Name                 string
	MachinesPoolName     string
	ClusterResourceGroup string
	ClusterName          string
	Location             string
	VMSize               string
	Priority             *armcontainerservice.ScaleSetPriority
	Zones                []*string
	Properties           *armcontainerservice.MachineProperties
	NodepoolName         string
}

AKSMachineOptions customizes an AKS Machine for testing.

type Environment

type Environment struct {
	// API
	VirtualMachinesAPI          *fake.VirtualMachinesAPI
	AzureResourceGraphAPI       *fake.AzureResourceGraphAPI
	VirtualMachineExtensionsAPI *fake.VirtualMachineExtensionsAPI
	NetworkInterfacesAPI        *fake.NetworkInterfacesAPI
	CommunityImageVersionsAPI   *fake.CommunityGalleryImageVersionsAPI
	NodeImageVersionsAPI        *fake.NodeImageVersionsAPI
	SKUsAPI                     *fake.ResourceSKUsAPI
	PricingAPI                  *fake.PricingAPI
	LoadBalancersAPI            *fake.LoadBalancersAPI
	NetworkSecurityGroupAPI     *fake.NetworkSecurityGroupAPI
	SubnetsAPI                  *fake.SubnetsAPI
	AuxiliaryTokenServer        *fake.AuxiliaryTokenServer
	SubscriptionAPI             *fake.SubscriptionsAPI
	NodeBootstrappingAPI        *fake.NodeBootstrappingAPI
	AKSMachinesAPI              *fake.AKSMachinesAPI
	AKSAgentPoolsAPI            *fake.AKSAgentPoolsAPI

	// Fake data stores for the APIs
	AKSDataStorage *fake.AKSDataStorage

	// Cache
	KubernetesVersionCache    *cache.Cache
	NodeImagesCache           *cache.Cache
	InstanceTypeCache         *cache.Cache
	LoadBalancerCache         *cache.Cache
	UnavailableOfferingsCache *azurecache.UnavailableOfferings

	// Providers
	InstanceTypesProvider        instancetype.Provider
	VMInstanceProvider           instance.VMProvider
	AKSMachineProvider           instance.AKSMachineProvider
	PricingProvider              *pricing.Provider
	KubernetesVersionProvider    kubernetesversion.KubernetesVersionProvider
	ImageProvider                imagefamily.NodeImageProvider
	ImageResolver                imagefamily.Resolver
	LaunchTemplateProvider       *launchtemplate.Provider
	LoadBalancerProvider         *loadbalancer.Provider
	NetworkSecurityGroupProvider *networksecuritygroup.Provider

	InstanceTypeStore *nodeoverlay.InstanceTypeStore

	SubscriptionID string
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment(ctx context.Context, env *coretest.Environment) *Environment

func NewEnvironmentNonZonal

func NewEnvironmentNonZonal(ctx context.Context, env *coretest.Environment) *Environment

func NewRegionalEnvironment

func NewRegionalEnvironment(ctx context.Context, env *coretest.Environment, region string, nonZonal bool) *Environment

func (*Environment) Reset

func (env *Environment) Reset()

func (*Environment) Zones

func (env *Environment) Zones() []string

type InterfaceOptions added in v0.6.2

type InterfaceOptions struct {
	Name         string
	NodepoolName string
	Location     string
	Properties   *armnetwork.InterfacePropertiesFormat
	Tags         map[string]*string
}

InterfaceOptions customizes an Azure Network Interface for testing.

type OptionsFields

type OptionsFields struct {
	ClusterName                    *string
	ClusterEndpoint                *string
	ClusterID                      *string
	KubeletClientTLSBootstrapToken *string
	LinuxAdminUsername             *string
	SSHPublicKey                   *string
	NetworkPlugin                  *string
	NetworkPluginMode              *string
	NetworkPolicy                  *string
	NetworkDataplane               *string
	VMMemoryOverheadPercent        *float64
	NodeIdentities                 []string
	SubnetID                       *string
	NodeResourceGroup              *string
	ProvisionMode                  *string
	NodeBootstrappingServerURL     *string
	VnetGUID                       *string
	KubeletIdentityClientID        *string
	AdditionalTags                 map[string]string
	EnableAzureSDKLogging          *bool
	DiskEncryptionSetID            *string
	ClusterDNSServiceIP            *string
	ManageExistingAKSMachines      *bool
	AKSMachinesPoolName            *string

	// SIG Flags not required by the self hosted offering
	UseSIG                  *bool
	SIGAccessTokenServerURL *string
	SIGSubscriptionID       *string
}

type VirtualMachineOptions added in v0.6.2

type VirtualMachineOptions struct {
	Name         string
	NodepoolName string
	Location     string
	Properties   *armcompute.VirtualMachineProperties
	Tags         map[string]*string
}

VirtualMachineOptions customizes an Azure Virtual Machine for testing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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