Documentation ¶
Index ¶
- Constants
- Variables
- func GetVMNameIndex(osType compute.OperatingSystemTypes, vmName string) (int, error)
- func LinuxVMNameParts(vmName string) (orchestrator string, poolIdentifier string, nameSuffix string, agentIndex int, ...)
- func ResourceName(ID string) (string, error)
- func SplitBlobURI(URI string) (string, string, string, error)
- func WindowsVMNameParts(vmName string) (poolPrefix string, acsStr string, poolIndex int, agentIndex int, err error)
- type ACSEngineClient
- type ACSStorageClient
- type AzureClient
- func NewAzureClientWithClientCertificate(env azure.Environment, ...) (*AzureClient, error)
- func NewAzureClientWithClientSecret(env azure.Environment, subscriptionID, clientID, clientSecret string) (*AzureClient, error)
- func NewAzureClientWithDeviceAuth(env azure.Environment, subscriptionID string) (*AzureClient, error)
- func (az *AzureClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
- func (az *AzureClient) DeleteResourceGroup(name string, cancel chan struct{}) (<-chan autorest.Response, <-chan error)
- func (az *AzureClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
- func (az *AzureClient) DeployTemplate(resourceGroupName, deploymentName string, template map[string]interface{}, ...) (*resources.DeploymentExtended, error)
- func (az *AzureClient) EnsureResourceGroup(name, location string) (resourceGroup *resources.Group, err error)
- func (az *AzureClient) GetDeployment(resourceGroupName, deploymentName string) (result resources.DeploymentExtended, err error)
- func (az *AzureClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
- func (az *AzureClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
- func (az *AzureClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
- func (az *AzureClient) ValidateTemplate(resourceGroupName string, deploymentName string, ...) (result resources.DeploymentValidateResult, err error)
- type AzureStorageClient
- type FailingMockClient
- func (fmc *FailingMockClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
- func (fmc *FailingMockClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
- func (fmc *FailingMockClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, ...) (*resources.DeploymentExtended, error)
- func (fmc *FailingMockClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
- func (fmc *FailingMockClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
- func (fmc *FailingMockClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
- func (fmc *FailingMockClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
- type MockACSEngineClient
- func (mc *MockACSEngineClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
- func (mc *MockACSEngineClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
- func (mc *MockACSEngineClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, ...) (*resources.DeploymentExtended, error)
- func (mc *MockACSEngineClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
- func (mc *MockACSEngineClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
- func (mc *MockACSEngineClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
- func (mc *MockACSEngineClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
- type MockClient
- func (mc *MockClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
- func (mc *MockClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
- func (mc *MockClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, ...) (*resources.DeploymentExtended, error)
- func (mc *MockClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
- func (mc *MockClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
- func (mc *MockClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
- func (mc *MockClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
- type MockStorageClient
Constants ¶
const ( // AcsEngineClientID is the AAD ClientID for the CLI native application AcsEngineClientID = "76e0feec-6b7f-41f0-81a7-b1b944520261" // ApplicationDir is the name of the dir where the token is cached ApplicationDir = ".acsengine" )
Variables ¶
var ( // RequiredResourceProviders is the list of Azure Resource Providers needed for ACS-Engine to function RequiredResourceProviders = []string{"Microsoft.Compute", "Microsoft.Storage", "Microsoft.Network"} )
Functions ¶
func GetVMNameIndex ¶
func GetVMNameIndex(osType compute.OperatingSystemTypes, vmName string) (int, error)
GetVMNameIndex return VM index of a node in the Kubernetes cluster
func LinuxVMNameParts ¶
func LinuxVMNameParts(vmName string) (orchestrator string, poolIdentifier string, nameSuffix string, agentIndex int, err error)
LinuxVMNameParts returns parts of Linux VM name e.g: k8s-agentpool1-11290731-0
func ResourceName ¶
ResourceName returns the last segment (the resource name) for the specified resource identifier.
func SplitBlobURI ¶
SplitBlobURI returns a decomposed blob URI parts: accountName, containerName, blobName.
Types ¶
type ACSEngineClient ¶
type ACSEngineClient interface { // DeployTemplate can deploy a template into Azure ARM DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error) // EnsureResourceGroup ensures the specified resource group exists in the specified location EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error) // List lists VM resources ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error) // GetVirtualMachine retrieves the specified virtual machine. GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error) // DeleteVirtualMachine deletes the specified virtual machine. DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error) // GetStorageClient uses SRP to retrieve keys, and then an authenticated client for talking to the specified storage // account. GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error) // DeleteNetworkInterface deletes the specified network interface. DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) }
ACSEngineClient is the interface used to talk to an Azure environment. This interface exposes just the subset of Azure APIs and clients needed for ACS-Engine.
type ACSStorageClient ¶
type ACSStorageClient interface { // DeleteBlob deletes the specified blob in the specified container. DeleteBlob(container, blob string) error }
ACSStorageClient interface models the azure storage client
type AzureClient ¶
type AzureClient struct {
// contains filtered or unexported fields
}
AzureClient implements the `ACSEngineClient` interface. This client is backed by real Azure clients talking to an ARM endpoint.
func NewAzureClientWithClientCertificate ¶
func NewAzureClientWithClientCertificate(env azure.Environment, subscriptionID, clientID, certificatePath, privateKeyPath string) (*AzureClient, error)
NewAzureClientWithClientCertificate returns an AzureClient via client_id and jwt certificate assertion
func NewAzureClientWithClientSecret ¶
func NewAzureClientWithClientSecret(env azure.Environment, subscriptionID, clientID, clientSecret string) (*AzureClient, error)
NewAzureClientWithClientSecret returns an AzureClient via client_id and client_secret
func NewAzureClientWithDeviceAuth ¶
func NewAzureClientWithDeviceAuth(env azure.Environment, subscriptionID string) (*AzureClient, error)
NewAzureClientWithDeviceAuth returns an AzureClient by having a user complete a device authentication flow
func (*AzureClient) DeleteNetworkInterface ¶
func (az *AzureClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
DeleteNetworkInterface deletes the specified network interface.
func (*AzureClient) DeleteResourceGroup ¶
func (az *AzureClient) DeleteResourceGroup(name string, cancel chan struct{}) (<-chan autorest.Response, <-chan error)
DeleteResourceGroup delete the named resource group
func (*AzureClient) DeleteVirtualMachine ¶
func (az *AzureClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
DeleteVirtualMachine handles deletion of a CRP/VMAS VM (aka, not a VMSS VM).
func (*AzureClient) DeployTemplate ¶
func (az *AzureClient) DeployTemplate(resourceGroupName, deploymentName string, template map[string]interface{}, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error)
DeployTemplate implements the TemplateDeployer interface for the AzureClient client
func (*AzureClient) EnsureResourceGroup ¶
func (az *AzureClient) EnsureResourceGroup(name, location string) (resourceGroup *resources.Group, err error)
EnsureResourceGroup ensures the named resouce group exists in the given location.
func (*AzureClient) GetDeployment ¶
func (az *AzureClient) GetDeployment(resourceGroupName, deploymentName string) (result resources.DeploymentExtended, err error)
GetDeployment returns the template deployment
func (*AzureClient) GetStorageClient ¶
func (az *AzureClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
GetStorageClient returns an authenticated client for the specified account.
func (*AzureClient) GetVirtualMachine ¶
func (az *AzureClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
GetVirtualMachine returns the specified machine in the specified resource group.
func (*AzureClient) ListVirtualMachines ¶
func (az *AzureClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
ListVirtualMachines returns (the first page of) the machines in the specified resource group.
func (*AzureClient) ValidateTemplate ¶
func (az *AzureClient) ValidateTemplate( resourceGroupName string, deploymentName string, template map[string]interface{}, parameters map[string]interface{}) (result resources.DeploymentValidateResult, err error)
ValidateTemplate validate the template and parameters
type AzureStorageClient ¶
type AzureStorageClient struct {
// contains filtered or unexported fields
}
AzureStorageClient implements the StorageClient interface and wraps the Azure storage client.
func (*AzureStorageClient) DeleteBlob ¶
func (as *AzureStorageClient) DeleteBlob(vhdContainer, vhdBlob string) error
DeleteBlob deletes the specified blob TODO(colemick): why doesn't SDK give a way to just delete a blob by URI? it's what it ends up doing internally anyway...
type FailingMockClient ¶
type FailingMockClient struct{}
FailingMockClient is an implemetnation of ACSEngineClient where all requests error out
func (*FailingMockClient) DeleteNetworkInterface ¶
func (fmc *FailingMockClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
DeleteNetworkInterface mock
func (*FailingMockClient) DeleteVirtualMachine ¶
func (fmc *FailingMockClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
DeleteVirtualMachine mock
func (*FailingMockClient) DeployTemplate ¶
func (fmc *FailingMockClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error)
DeployTemplate mock
func (*FailingMockClient) EnsureResourceGroup ¶
func (fmc *FailingMockClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
EnsureResourceGroup mock
func (*FailingMockClient) GetStorageClient ¶
func (fmc *FailingMockClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
GetStorageClient mock
func (*FailingMockClient) GetVirtualMachine ¶
func (fmc *FailingMockClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
GetVirtualMachine mock
func (*FailingMockClient) ListVirtualMachines ¶
func (fmc *FailingMockClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
ListVirtualMachines mock
type MockACSEngineClient ¶
type MockACSEngineClient struct { FailDeployTemplate bool FailEnsureResourceGroup bool FailListVirtualMachines bool FailGetVirtualMachine bool FailDeleteVirtualMachine bool FailGetStorageClient bool FailDeleteNetworkInterface bool }
MockACSEngineClient is an implemetnation of ACSEngineClient where all requests error out
func (*MockACSEngineClient) DeleteNetworkInterface ¶
func (mc *MockACSEngineClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
DeleteNetworkInterface mock
func (*MockACSEngineClient) DeleteVirtualMachine ¶
func (mc *MockACSEngineClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
DeleteVirtualMachine mock
func (*MockACSEngineClient) DeployTemplate ¶
func (mc *MockACSEngineClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error)
DeployTemplate mock
func (*MockACSEngineClient) EnsureResourceGroup ¶
func (mc *MockACSEngineClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
EnsureResourceGroup mock
func (*MockACSEngineClient) GetStorageClient ¶
func (mc *MockACSEngineClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
GetStorageClient mock
func (*MockACSEngineClient) GetVirtualMachine ¶
func (mc *MockACSEngineClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
GetVirtualMachine mock
func (*MockACSEngineClient) ListVirtualMachines ¶
func (mc *MockACSEngineClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
ListVirtualMachines mock
type MockClient ¶
type MockClient struct{}
MockClient is an implementation of ACSEngineClient where all requests return a valid response
func (*MockClient) DeleteNetworkInterface ¶
func (mc *MockClient) DeleteNetworkInterface(resourceGroup, nicName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
DeleteNetworkInterface mock
func (*MockClient) DeleteVirtualMachine ¶
func (mc *MockClient) DeleteVirtualMachine(resourceGroup, name string, cancel <-chan struct{}) (<-chan compute.OperationStatusResponse, <-chan error)
DeleteVirtualMachine mock
func (*MockClient) DeployTemplate ¶
func (mc *MockClient) DeployTemplate(resourceGroup, name string, template, parameters map[string]interface{}, cancel <-chan struct{}) (*resources.DeploymentExtended, error)
DeployTemplate mock
func (*MockClient) EnsureResourceGroup ¶
func (mc *MockClient) EnsureResourceGroup(resourceGroup, location string) (*resources.Group, error)
EnsureResourceGroup mock
func (*MockClient) GetStorageClient ¶
func (mc *MockClient) GetStorageClient(resourceGroup, accountName string) (ACSStorageClient, error)
GetStorageClient mock
func (*MockClient) GetVirtualMachine ¶
func (mc *MockClient) GetVirtualMachine(resourceGroup, name string) (compute.VirtualMachine, error)
GetVirtualMachine mock
func (*MockClient) ListVirtualMachines ¶
func (mc *MockClient) ListVirtualMachines(resourceGroup string) (compute.VirtualMachineListResult, error)
ListVirtualMachines mock
type MockStorageClient ¶
type MockStorageClient struct{}
MockStorageClient mock implementation of StorageClient
func (*MockStorageClient) DeleteBlob ¶
func (msc *MockStorageClient) DeleteBlob(container, blob string) error
DeleteBlob mock