cloudprovider

package
v1.8.17 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// VMResourceType virtual machine resource type
	VMResourceType = "virtualMachines"
	// VMSSResourceType virtual machine scale sets resource type
	VMSSResourceType = "virtualMachineScaleSets"
)

Variables

This section is empty.

Functions

func ParseResourceID

func ParseResourceID(resourceID string) (azure.Resource, error)

ParseResourceID is a slightly modified version of https://github.com/Azure/go-autorest/blob/528b76fd0ebec0682f3e3da7c808cd472b999615/autorest/azure/azure.go#L175 The modification here is to support a nested resource such as is the case for a node resource in a vmss.

Types

type Client

type Client struct {
	VMClient    VMClientInt
	VMSSClient  VMSSClientInt
	RetryClient retry.ClientInt
	ExtClient   compute.VirtualMachineExtensionsClient
	Config      config.AzureConfig
	// contains filtered or unexported fields
}

Client is a cloud provider client

func NewCloudProvider

func NewCloudProvider(configFile string, updateUserMSIMaxRetry int, updateUseMSIRetryInterval time.Duration) (*Client, error)

NewCloudProvider returns a azure cloud provider client

func (*Client) GetClusterIdentity added in v1.7.5

func (c *Client) GetClusterIdentity() string

GetClusterIdentity returns the cluster identity that MIC will use for all cloud provider operations. This is userAssignedIdentityID configured in the azure.json

func (*Client) GetUserMSIs

func (c *Client) GetUserMSIs(name string, isvmss bool) ([]string, error)

GetUserMSIs will return a list of all identities on the node or vmss based on value of isvmss

func (*Client) Init added in v1.6.1

func (c *Client) Init() error

Init initializes the cloud provider client based on a config path or environment variables

func (*Client) UpdateUserMSI

func (c *Client) UpdateUserMSI(addUserAssignedMSIIDs, removeUserAssignedMSIIDs []string, name string, isvmss bool) error

UpdateUserMSI will batch process the removal and addition of ids

type ClientInt

type ClientInt interface {
	UpdateUserMSI(addUserAssignedMSIIDs, removeUserAssignedMSIIDs []string, name string, isvmss bool) error
	GetUserMSIs(name string, isvmss bool) ([]string, error)
	Init() error
}

ClientInt client interface

type IdentityHolder

type IdentityHolder interface {
	IdentityInfo() IdentityInfo
	ResetIdentity() IdentityInfo
}

IdentityHolder represents a resource that contains an Identity object This is used to be able to generically intract with multiple resource types (e.g. VirtualMachine and VirtualMachineScaleSet) which each contain an identity.

type IdentityInfo

type IdentityInfo interface {
	GetUserIdentityList() []string
	SetUserIdentities(map[string]bool) bool
	RemoveUserIdentity(string) bool
}

IdentityInfo is used to interact with different implementations of Azure compute identities. This is needed because different Azure resource types (e.g. VirtualMachine and VirtualMachineScaleSet) have different identity types. This abstracts those differences.

type VMClient

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

VMClient client for VirtualMachines

func NewVirtualMachinesClient

func NewVirtualMachinesClient(config config.AzureConfig, spt *adal.ServicePrincipalToken) (*VMClient, error)

NewVirtualMachinesClient creates a new vm client.

func (*VMClient) Get

func (c *VMClient) Get(rgName string, nodeName string) (_ compute.VirtualMachine, err error)

Get gets the passed in vm.

func (*VMClient) UpdateIdentities added in v1.6.0

func (c *VMClient) UpdateIdentities(rg, nodeName string, vm compute.VirtualMachine) (err error)

UpdateIdentities updates the user assigned identities for the provided node

type VMClientInt

type VMClientInt interface {
	Get(rgName string, nodeName string) (compute.VirtualMachine, error)
	UpdateIdentities(rg, nodeName string, vmu compute.VirtualMachine) error
}

VMClientInt is the interface used by "cloudprovider" for interacting with Azure vmas

type VMSSClient

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

VMSSClient is used to interact with Azure virtual machine scale sets.

func NewVMSSClient

func NewVMSSClient(config config.AzureConfig, spt *adal.ServicePrincipalToken) (*VMSSClient, error)

NewVMSSClient creates a new vmss client.

func (*VMSSClient) Get

func (c *VMSSClient) Get(rgName string, vmssName string) (_ compute.VirtualMachineScaleSet, err error)

Get gets the passed in vmss.

func (*VMSSClient) UpdateIdentities added in v1.6.0

func (c *VMSSClient) UpdateIdentities(rg, vmssName string, vmss compute.VirtualMachineScaleSet) (err error)

UpdateIdentities updates the user assigned identities for the provided node

type VMSSClientInt

type VMSSClientInt interface {
	Get(rgName, name string) (compute.VirtualMachineScaleSet, error)
	UpdateIdentities(rg, vmssName string, vmu compute.VirtualMachineScaleSet) error
}

VMSSClientInt is the interface used by "cloudprovider" for interacting with Azure vmss

Jump to

Keyboard shortcuts

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