instance

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NodePoolTagKey = strings.ReplaceAll(corev1beta1.NodePoolLabelKey, "/", "_")

	CapacityTypeToPriority = map[string]string{
		corev1beta1.CapacityTypeSpot:     string(compute.Spot),
		corev1beta1.CapacityTypeOnDemand: string(compute.Regular),
	}
	PriorityToCapacityType = map[string]string{
		string(compute.Spot):    corev1beta1.CapacityTypeSpot,
		string(compute.Regular): corev1beta1.CapacityTypeOnDemand,
	}

	SubscriptionQuotaReachedReason = "SubscriptionQuotaReached"
	ZonalAllocationFailureReason   = "ZonalAllocationFailure"
	SKUNotAvailableReason          = "SKUNotAvailable"

	SubscriptionQuotaReachedTTL = 1 * time.Hour
	SKUNotAvailableSpotTTL      = 1 * time.Hour
	SKUNotAvailableOnDemandTTL  = 23 * time.Hour
)

Functions

func ConvertToVirtualMachineIdentity

func ConvertToVirtualMachineIdentity(nodeIdentities []string) *armcompute.VirtualMachineIdentity

func CreateVirtualMachine

func CreateVirtualMachine(ctx context.Context, client VirtualMachinesAPI, rg, vmName string, vm armcompute.VirtualMachine) (*armcompute.VirtualMachine, error)

func GenerateResourceName

func GenerateResourceName(nodeClaimName string) string

func GetAllSingleValuedRequirementLabels

func GetAllSingleValuedRequirementLabels(instanceType *corecloudprovider.InstanceType) map[string]string

GetAllSingleValuedRequirementLabels converts instanceType.Requirements to labels Like instanceType.Requirements.Labels() it uses single-valued requirements Unlike instanceType.Requirements.Labels() it does not filter out restricted Node labels

func GetCapacityType

func GetCapacityType(instance *armcompute.VirtualMachine) string

func GetListQueryBuilder

func GetListQueryBuilder(rg string) *kql.Builder

func GetZoneID

func GetZoneID(vm *armcompute.VirtualMachine) (string, error)

GetZoneID returns the zone ID for the given virtual machine, or an empty string if there is no zone specified

func NewQueryRequest

func NewQueryRequest(subscriptionID *string, query string) *arg.QueryRequest

func UpdateVirtualMachine

func UpdateVirtualMachine(ctx context.Context, client VirtualMachinesAPI, rg, vmName string, updates armcompute.VirtualMachineUpdate) error

Types

type AZClient

type AZClient struct {
	ImageVersionsClient imagefamily.CommunityGalleryImageVersionsAPI
	// SKU CLIENT is still using track 1 because skewer does not support the track 2 path. We need to refactor this once skewer supports track 2
	SKUClient           skuclient.SkuClient
	LoadBalancersClient loadbalancer.LoadBalancersAPI
	// contains filtered or unexported fields
}

TODO: Move this to another package that more correctly reflects its usage across multiple providers

func CreateAZClient

func CreateAZClient(ctx context.Context, cfg *auth.Config) (*AZClient, error)

func NewAZClient

func NewAZClient(ctx context.Context, cfg *auth.Config, env *azure.Environment) (*AZClient, error)

func NewAZClientFromAPI

func NewAZClientFromAPI(
	virtualMachinesClient VirtualMachinesAPI,
	azureResourceGraphClient AzureResourceGraphAPI,
	virtualMachinesExtensionClient VirtualMachineExtensionsAPI,
	interfacesClient NetworkInterfacesAPI,
	loadBalancersClient loadbalancer.LoadBalancersAPI,
	imageVersionsClient imagefamily.CommunityGalleryImageVersionsAPI,
	skuClient skuclient.SkuClient,
) *AZClient

type NetworkInterfacesAPI

type NetworkInterfacesAPI interface {
	BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters armnetwork.Interface, options *armnetwork.InterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[armnetwork.InterfacesClientCreateOrUpdateResponse], error)
	BeginDelete(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientBeginDeleteOptions) (*runtime.Poller[armnetwork.InterfacesClientDeleteResponse], error)
	Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *armnetwork.InterfacesClientGetOptions) (armnetwork.InterfacesClientGetResponse, error)
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(
	azClient *AZClient,
	instanceTypeProvider *instancetype.Provider,
	launchTemplateProvider *launchtemplate.Provider,
	loadBalancerProvider *loadbalancer.Provider,
	offeringsCache *cache.UnavailableOfferings,
	location string,
	resourceGroup string,
	subnetID string,
	subscriptionID string,
) *Provider

func (*Provider) Create

func (p *Provider) Create(ctx context.Context, nodeClass *v1alpha2.AKSNodeClass, nodeClaim *corev1beta1.NodeClaim, instanceTypes []*corecloudprovider.InstanceType) (*armcompute.VirtualMachine, error)

Create an instance given the constraints. instanceTypes should be sorted by priority for spot capacity type.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, resourceName string) error

func (*Provider) Get

func (p *Provider) Get(ctx context.Context, vmName string) (*armcompute.VirtualMachine, error)

func (*Provider) List

func (*Provider) Update

func (p *Provider) Update(ctx context.Context, vmName string, update armcompute.VirtualMachineUpdate) error

type Resource

type Resource = map[string]interface{}

func GetResourceData

func GetResourceData(ctx context.Context, client AzureResourceGraphAPI, req arg.QueryRequest) ([]Resource, error)

Queries Azure Resource Graph using Resources() and returns a list of all pages of data.

type VirtualMachineExtensionsAPI

type VirtualMachineExtensionsAPI interface {
	BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters armcompute.VirtualMachineExtension, options *armcompute.VirtualMachineExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[armcompute.VirtualMachineExtensionsClientCreateOrUpdateResponse], error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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