cloudprovider

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 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
	ExtClient  compute.VirtualMachineExtensionsClient
	Config     config.AzureConfig
}

Client is a cloud provider client

func NewCloudProvider

func NewCloudProvider(configFile string) (c *Client, e error)

NewCloudProvider returns a azure cloud provider client

func (*Client) AssignUserMSI

func (c *Client) AssignUserMSI(userAssignedMSIID, name string, isvmss bool) error

AssignUserMSI - Use the underlying cloud api call and add the given user assigned MSI to the vm

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) RemoveUserMSI

func (c *Client) RemoveUserMSI(userAssignedMSIID, name string, isvmss bool) error

RemoveUserMSI - Use the underlying cloud api calls and remove the given user assigned MSI from the vm.

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 {
	RemoveUserMSI(userAssignedMSIID, name string, isvmss bool) error
	AssignUserMSI(userAssignedMSIID, name string, isvmss bool) error
	UpdateUserMSI(addUserAssignedMSIIDs, removeUserAssignedMSIIDs []string, name string, isvmss bool) error
	GetUserMSIs(name string, isvmss bool) ([]string, 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 {
	AppendUserIdentity(id string) bool
	RemoveUserIdentity(id string) error
	GetUserIdentityList() []string
}

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) (c *VMClient, e error)

NewVirtualMachinesClient creates a new vm client.

func (*VMClient) CreateOrUpdate

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

CreateOrUpdate creates a new vm, or if the vm already exists it updates the existing one. This is used by "cloudprovider" to *update* add/remove identities from an already existing vm.

func (*VMClient) Get

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

Get gets the passed in vm.

type VMClientInt

type VMClientInt interface {
	CreateOrUpdate(rg string, nodeName string, vm compute.VirtualMachine) error
	Get(rgName string, nodeName string) (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) (c *VMSSClient, e error)

NewVMSSClient creates a new vmss client.

func (*VMSSClient) CreateOrUpdate

func (c *VMSSClient) CreateOrUpdate(rg string, vmssName string, vm compute.VirtualMachineScaleSet) error

CreateOrUpdate creates a new vmss, or if the vmss already exists it updates the existing one. This is used by "cloudprovider" to *update* add/remove identities from an already existing vmss.

func (*VMSSClient) Get

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

Get gets the passed in vmss.

type VMSSClientInt

type VMSSClientInt interface {
	CreateOrUpdate(rg, name string, vm compute.VirtualMachineScaleSet) error
	Get(rgName, name string) (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