azurestack

package
v0.34.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

Index

Constants

View Source
const (
	// AADContributorRoleID is the role id that exists in every subscription for 'Contributor'
	AADContributorRoleID = "b24988ac-6180-42a0-ab88-20f7382dd24c"
	// AADRoleReferenceTemplate is a template for a roleDefinitionId
	AADRoleReferenceTemplate = "/subscriptions/%s/providers/Microsoft.Authorization/roleDefinitions/%s"
	// AADRoleResourceGroupScopeTemplate is a template for a roleDefinition scope
	AADRoleResourceGroupScopeTemplate = "/subscriptions/%s/resourceGroups/%s"
)
View Source
const (
	// ApplicationDir is the name of the dir where the token is cached
	ApplicationDir = ".acsengine"
)
View Source
const DefaultARMOperationTimeout = 150 * time.Minute

DefaultARMOperationTimeout defines a default (permissive) ARM operation timeout

Variables

View Source
var (
	// RequiredResourceProviders is the list of Azure Resource Providers needed for AKS Engine to function
	RequiredResourceProviders = []string{"Microsoft.Compute", "Microsoft.Storage", "Microsoft.Network"}
)

Functions

func DeepCopy

func DeepCopy(dst, src interface{}) error

DeepCopy dst and src should be the same type in different API version dst should be pointer type

func DeployTemplateSync

func DeployTemplateSync(az armhelpers.AKSEngineClient, logger *logrus.Entry, resourceGroupName, deploymentName string, template map[string]interface{}, parameters map[string]interface{}) error

DeployTemplateSync deploys the template and returns ArmError

Types

type AzureClient

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

AzureClient implements the `AKSEngineClient` interface. This client is backed by real Azure clients talking to an ARM endpoint.

func NewAzureClientWithClientCertificate

func NewAzureClientWithClientCertificate(env azure.Environment, subscriptionID, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey) (*AzureClient, error)

NewAzureClientWithClientCertificate returns an AzureClient via client_id and jwt certificate assertion

func NewAzureClientWithClientCertificateExternalTenant

func NewAzureClientWithClientCertificateExternalTenant(env azure.Environment, subscriptionID, tenantID, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey) (*AzureClient, error)

NewAzureClientWithClientCertificateExternalTenant returns an AzureClient via client_id and jwt certificate assertion against a 3rd party tenant

func NewAzureClientWithClientCertificateFile

func NewAzureClientWithClientCertificateFile(env azure.Environment, subscriptionID, clientID, certificatePath, privateKeyPath string) (*AzureClient, error)

NewAzureClientWithClientCertificateFile returns an AzureClient via client_id and jwt certificate assertion

func NewAzureClientWithClientCertificateFileExternalTenant

func NewAzureClientWithClientCertificateFileExternalTenant(env azure.Environment, subscriptionID, tenantID, clientID, certificatePath, privateKeyPath string) (*AzureClient, error)

NewAzureClientWithClientCertificateFileExternalTenant returns an AzureClient via client_id and jwt certificate assertion a 3rd party tenant

func NewAzureClientWithClientSecret

func NewAzureClientWithClientSecret(env azure.Environment, subscriptionID, clientID, clientSecret string) (*AzureClient, error)

NewAzureClientWithClientSecret returns an AzureClient via client_id and client_secret

func NewAzureClientWithClientSecretExternalTenant

func NewAzureClientWithClientSecretExternalTenant(env azure.Environment, subscriptionID, tenantID, clientID, clientSecret string) (*AzureClient, error)

NewAzureClientWithClientSecretExternalTenant returns an AzureClient via client_id and client_secret from a tenant

func (*AzureClient) AddAcceptLanguages

func (az *AzureClient) AddAcceptLanguages(languages []string)

AddAcceptLanguages sets the list of languages to accept on this request

func (*AzureClient) AddAuxiliaryTokens

func (az *AzureClient) AddAuxiliaryTokens(tokens []string)

AddAuxiliaryTokens sets the list of aux tokens to accept on this request

func (*AzureClient) CheckDeploymentExistence

func (az *AzureClient) CheckDeploymentExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error)

CheckDeploymentExistence returns if the deployment already exists

func (*AzureClient) CheckResourceGroupExistence

func (az *AzureClient) CheckResourceGroupExistence(ctx context.Context, name string) (result autorest.Response, err error)

CheckResourceGroupExistence return if the resource group exists

func (*AzureClient) CreateApp

func (az *AzureClient) CreateApp(ctx context.Context, appName, appURL string, replyURLs *[]string, requiredResourceAccess *[]graphrbac.RequiredResourceAccess) (applicationResp graphrbac.Application, servicePrincipalObjectID, servicePrincipalClientSecret string, err error)

CreateApp is a simpler method for creating an application

func (*AzureClient) CreateGraphApplication

func (az *AzureClient) CreateGraphApplication(ctx context.Context, applicationCreateParameters graphrbac.ApplicationCreateParameters) (graphrbac.Application, error)

CreateGraphApplication creates an application via the graphrbac client

func (*AzureClient) CreateGraphPrincipal

func (az *AzureClient) CreateGraphPrincipal(ctx context.Context, servicePrincipalCreateParameters graphrbac.ServicePrincipalCreateParameters) (graphrbac.ServicePrincipal, error)

CreateGraphPrincipal creates a service principal via the graphrbac client

func (*AzureClient) CreateRoleAssignment

func (az *AzureClient) CreateRoleAssignment(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (authorization.RoleAssignment, error)

CreateRoleAssignment creates a role assignment via the authorization client

func (*AzureClient) CreateRoleAssignmentSimple

func (az *AzureClient) CreateRoleAssignmentSimple(ctx context.Context, resourceGroup, servicePrincipalObjectID string) error

CreateRoleAssignmentSimple is a wrapper around RoleAssignmentsClient.Create

func (*AzureClient) CreateUserAssignedID

func (az *AzureClient) CreateUserAssignedID(location string, resourceGroup string, userAssignedID string) (id *msi.Identity, err error)

CreateUserAssignedID - Creates a user assigned msi.

func (*AzureClient) DeleteApp

func (az *AzureClient) DeleteApp(ctx context.Context, applicationName, applicationObjectID string) (autorest.Response, error)

DeleteApp is a simpler method for deleting an application and the associated spn

func (*AzureClient) DeleteGraphApplication

func (az *AzureClient) DeleteGraphApplication(ctx context.Context, applicationObjectID string) (result autorest.Response, err error)

DeleteGraphApplication deletes an application via the graphrbac client

func (*AzureClient) DeleteManagedDisk

func (az *AzureClient) DeleteManagedDisk(ctx context.Context, resourceGroupName string, diskName string) error

DeleteManagedDisk deletes a managed disk.

func (*AzureClient) DeleteNetworkInterface

func (az *AzureClient) DeleteNetworkInterface(ctx context.Context, resourceGroup, nicName string) error

DeleteNetworkInterface deletes the specified network interface.

func (*AzureClient) DeleteResourceGroup

func (az *AzureClient) DeleteResourceGroup(ctx context.Context, name string) error

DeleteResourceGroup delete the named resource group

func (*AzureClient) DeleteRoleAssignmentByID

func (az *AzureClient) DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (authorization.RoleAssignment, error)

DeleteRoleAssignmentByID deletes a roleAssignment via its unique identifier

func (*AzureClient) DeleteVirtualMachine

func (az *AzureClient) DeleteVirtualMachine(ctx context.Context, resourceGroup, name string) error

DeleteVirtualMachine handles deletion of a CRP/VMAS VM (aka, not a VMSS VM).

func (*AzureClient) DeleteVirtualMachineScaleSet

func (az *AzureClient) DeleteVirtualMachineScaleSet(ctx context.Context, resourceGroup, vmssName string) error

DeleteVirtualMachineScaleSet deletes an entire VM Scale Set.

func (*AzureClient) DeleteVirtualMachineScaleSetVM

func (az *AzureClient) DeleteVirtualMachineScaleSetVM(ctx context.Context, resourceGroup, virtualMachineScaleSet, instanceID string) error

DeleteVirtualMachineScaleSetVM deletes a VM in a VMSS

func (*AzureClient) DeployTemplate

func (az *AzureClient) DeployTemplate(ctx context.Context, resourceGroupName, deploymentName string, template map[string]interface{}, parameters map[string]interface{}) (de resources.DeploymentExtended, err error)

DeployTemplate implements the TemplateDeployer interface for the AzureClient client

func (*AzureClient) EnsureProvidersRegistered

func (az *AzureClient) EnsureProvidersRegistered(subscriptionID string) error

EnsureProvidersRegistered checks if the AzureClient is registered to required resource providers and, if not, register subscription to providers

func (*AzureClient) EnsureResourceGroup

func (az *AzureClient) EnsureResourceGroup(ctx context.Context, name, location string, managedBy *string) (resourceGroup *resources.Group, err error)

EnsureResourceGroup ensures the named resource group exists in the given location.

func (*AzureClient) GetDeployment

func (az *AzureClient) GetDeployment(ctx context.Context, resourceGroupName, deploymentName string) (result resources.DeploymentExtended, err error)

GetDeployment returns the template deployment

func (*AzureClient) GetKubernetesClient

func (az *AzureClient) GetKubernetesClient(masterURL, kubeConfig string, interval, timeout time.Duration) (armhelpers.KubernetesClient, error)

GetKubernetesClient returns a KubernetesClient hooked up to the api server at the masterURL

func (*AzureClient) GetStorageClient

func (az *AzureClient) GetStorageClient(ctx context.Context, resourceGroup, accountName string) (armhelpers.AKSStorageClient, error)

GetStorageClient returns an authenticated client for the specified account.

func (*AzureClient) GetVirtualMachine

func (az *AzureClient) GetVirtualMachine(ctx context.Context, resourceGroup, name string) (azcompute.VirtualMachine, error)

GetVirtualMachine returns the specified machine in the specified resource group.

func (*AzureClient) ListDeploymentOperations

func (az *AzureClient) ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (armhelpers.DeploymentOperationsListResultPage, error)

ListDeploymentOperations gets all deployments operations for a deployment.

func (*AzureClient) ListManagedDisksByResourceGroup

func (az *AzureClient) ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) (result armhelpers.DiskListPage, err error)

ListManagedDisksByResourceGroup lists managed disks in a resource group.

func (*AzureClient) ListProviders

ListProviders returns all the providers for a given AzureClient

func (*AzureClient) ListRoleAssignmentsForPrincipal

func (az *AzureClient) ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) (armhelpers.RoleAssignmentListResultPage, error)

ListRoleAssignmentsForPrincipal (e.g. a VM) via the scope and the unique identifier of the principal

func (*AzureClient) ListVirtualMachineScaleSetVMs

func (az *AzureClient) ListVirtualMachineScaleSetVMs(ctx context.Context, resourceGroup, virtualMachineScaleSet string) (armhelpers.VirtualMachineScaleSetVMListResultPage, error)

ListVirtualMachineScaleSetVMs returns the list of VMs per VMSS

func (*AzureClient) ListVirtualMachineScaleSets

func (az *AzureClient) ListVirtualMachineScaleSets(ctx context.Context, resourceGroup string) (armhelpers.VirtualMachineScaleSetListResultPage, error)

ListVirtualMachineScaleSets returns (the first page of) the VMSS resources in the specified resource group.

func (*AzureClient) ListVirtualMachines

func (az *AzureClient) ListVirtualMachines(ctx context.Context, resourceGroup string) (armhelpers.VirtualMachineListResultPage, error)

ListVirtualMachines returns (the first page of) the machines in the specified resource group.

func (*AzureClient) SetVirtualMachineScaleSetCapacity

func (az *AzureClient) SetVirtualMachineScaleSetCapacity(ctx context.Context, resourceGroup, virtualMachineScaleSet string, sku azcompute.Sku, location string) error

SetVirtualMachineScaleSetCapacity sets the VMSS capacity

func (*AzureClient) ValidateTemplate

func (az *AzureClient) ValidateTemplate(
	ctx context.Context,
	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) CreateContainer

func (as *AzureStorageClient) CreateContainer(containerName string, options *azStorage.CreateContainerOptions) (bool, error)

CreateContainer creates the CloudBlobContainer if it does not exist

func (*AzureStorageClient) DeleteBlob

func (as *AzureStorageClient) DeleteBlob(vhdContainer, vhdBlob string, options *azStorage.DeleteBlobOptions) 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...

func (*AzureStorageClient) SaveBlockBlob

func (as *AzureStorageClient) SaveBlockBlob(containerName, blobName string, b []byte, options *azStorage.PutBlobOptions) error

SaveBlockBlob initializes a block blob by taking the byte

type DeploymentError

type DeploymentError struct {
	DeploymentName    string
	ResourceGroup     string
	TopError          error
	StatusCode        int
	Response          []byte
	ProvisioningState string
	OperationsLists   []resources.DeploymentOperationsListResult
}

DeploymentError contains the root deployment error along with deployment operation errors

func (*DeploymentError) Error

func (e *DeploymentError) Error() string

Error implements error interface

type DeploymentValidationError

type DeploymentValidationError struct {
	Err error
}

DeploymentValidationError contains validation error

func (*DeploymentValidationError) Error

func (e *DeploymentValidationError) Error() string

Error implements error interface

type DiskListPageClient

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

DiskListPageClient contains a page of Disk values.

func (*DiskListPageClient) Next

func (page *DiskListPageClient) Next() error

Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned. Deprecated: Use NextWithContext() instead.

func (*DiskListPageClient) NextWithContext

func (page *DiskListPageClient) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (DiskListPageClient) NotDone

func (page DiskListPageClient) NotDone() bool

NotDone returns true if the page enumeration should be started or is not yet complete.

func (DiskListPageClient) Response

func (page DiskListPageClient) Response() azcompute.DiskList

Response returns the raw server response from the last page request.

func (DiskListPageClient) Values

func (page DiskListPageClient) Values() []azcompute.Disk

Values returns the slice of values for the current page or nil if there are no values.

type HTTPMockClient

type HTTPMockClient struct {
	SubscriptionID                        string
	TenantID                              string
	ResourceGroup                         string
	ComputeAPIVersion                     string
	NetworkAPIVersion                     string
	DeploymentAPIVersion                  string
	DeploymentName                        string
	DeploymentStatus                      string
	VirtualMachineScaleSetName            string
	VirtualMachineName                    string
	VirtualNicName                        string
	VirutalDiskName                       string
	Location                              string
	OperationID                           string
	TokenResponse                         string
	ResponseListVirtualMachineScaleSets   string
	ResponseListVirtualMachineScaleSetVMs string
	ResponseListVirtualMachines           string
	ResponseGetVirtualMachine             string
	ResponseDeployVirtualMachine          string
	ResponseDeployVirtualMachineError     string
}

HTTPMockClient is an wrapper of httpmock

func NewHTTPMockClient

func NewHTTPMockClient() HTTPMockClient

NewHTTPMockClient creates HTTPMockClient with default values

func (HTTPMockClient) Activate

func (mc HTTPMockClient) Activate()

Activate starts the mock environment

func (HTTPMockClient) DeactivateAndReset

func (mc HTTPMockClient) DeactivateAndReset()

DeactivateAndReset shuts down the mock environment and removes any registered mocks

func (HTTPMockClient) GetEnvironment

func (mc HTTPMockClient) GetEnvironment() azure.Environment

GetEnvironment return azure.Environment for Azure Stack

func (HTTPMockClient) RegisterDeleteManagedDisk

func (mc HTTPMockClient) RegisterDeleteManagedDisk()

RegisterDeleteManagedDisk registers the mock response for DeleteManagedDisk

func (HTTPMockClient) RegisterDeleteNetworkInterface

func (mc HTTPMockClient) RegisterDeleteNetworkInterface()

RegisterDeleteNetworkInterface registers the mock response for DeleteNetworkInterface

func (HTTPMockClient) RegisterDeleteVirtualMachine

func (mc HTTPMockClient) RegisterDeleteVirtualMachine()

RegisterDeleteVirtualMachine registers the mock response for DeleteVirtualMachine

func (HTTPMockClient) RegisterDeployTemplate

func (mc HTTPMockClient) RegisterDeployTemplate()

RegisterDeployTemplate registers the mock response for DeployTemplate

func (HTTPMockClient) RegisterDeployTemplateSync

func (mc HTTPMockClient) RegisterDeployTemplateSync()

RegisterDeployTemplateSync registers the mock response for DeployTemplate

func (HTTPMockClient) RegisterGetVirtualMachine

func (mc HTTPMockClient) RegisterGetVirtualMachine()

RegisterGetVirtualMachine registers the mock response for GetVirtualMachine

func (HTTPMockClient) RegisterListVirtualMachineScaleSetVMs

func (mc HTTPMockClient) RegisterListVirtualMachineScaleSetVMs()

RegisterListVirtualMachineScaleSetVMs registers the mock response for ListVirtualMachineScaleSetVMs

func (HTTPMockClient) RegisterListVirtualMachineScaleSets

func (mc HTTPMockClient) RegisterListVirtualMachineScaleSets()

RegisterListVirtualMachineScaleSets registers the mock response for ListVirtualMachineScaleSets

func (HTTPMockClient) RegisterListVirtualMachines

func (mc HTTPMockClient) RegisterListVirtualMachines()

RegisterListVirtualMachines registers the mock response for ListVirtualMachines

func (HTTPMockClient) RegisterLogin

func (mc HTTPMockClient) RegisterLogin()

RegisterLogin registers the mock response for login

type KubernetesClientSetClient

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

KubernetesClientSetClient kubernetes client hooked up to a live api server

func (*KubernetesClientSetClient) DeleteNode

func (c *KubernetesClientSetClient) DeleteNode(name string) error

DeleteNode deregisters the node in the api server

func (*KubernetesClientSetClient) DeletePod

func (c *KubernetesClientSetClient) DeletePod(pod *v1.Pod) error

DeletePod deletes the passed in pod

func (*KubernetesClientSetClient) EvictPod

func (c *KubernetesClientSetClient) EvictPod(pod *v1.Pod, policyGroupVersion string) error

EvictPod evicts the passed in pod using the passed in api version

func (*KubernetesClientSetClient) GetNode

func (c *KubernetesClientSetClient) GetNode(name string) (*v1.Node, error)

GetNode returns details about node with passed in name

func (*KubernetesClientSetClient) ListPods

func (c *KubernetesClientSetClient) ListPods(node *v1.Node) (*v1.PodList, error)

ListPods returns all Pods running on the passed in node

func (*KubernetesClientSetClient) SupportEviction

func (c *KubernetesClientSetClient) SupportEviction() (string, error)

SupportEviction queries the api server to discover if it supports eviction, and returns supported type if it is supported

func (*KubernetesClientSetClient) UpdateNode

func (c *KubernetesClientSetClient) UpdateNode(node *v1.Node) (*v1.Node, error)

UpdateNode updates the node in the api server with the passed in info

func (*KubernetesClientSetClient) WaitForDelete

func (c *KubernetesClientSetClient) WaitForDelete(logger *log.Entry, pods []v1.Pod, usingEviction bool) ([]v1.Pod, error)

WaitForDelete waits until all pods are deleted. Returns all pods not deleted and an error on failure

type VirtualMachineListResultPageClient

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

VirtualMachineListResultPageClient Virtual Machine List Result Page Client

func (*VirtualMachineListResultPageClient) Next

Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (*VirtualMachineListResultPageClient) NextWithContext

func (page *VirtualMachineListResultPageClient) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (VirtualMachineListResultPageClient) NotDone

NotDone returns true if the page enumeration should be started or is not yet complete.

func (VirtualMachineListResultPageClient) Response

Response returns the raw server response from the last page request.

func (VirtualMachineListResultPageClient) Values

Values returns the slice of values for the current page or nil if there are no values.

type VirtualMachineScaleSetListResultPageClient

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

VirtualMachineScaleSetListResultPageClient Virtual Machine Scale Set List Result Page Client

func (*VirtualMachineScaleSetListResultPageClient) Next

Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (*VirtualMachineScaleSetListResultPageClient) NextWithContext

func (page *VirtualMachineScaleSetListResultPageClient) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (VirtualMachineScaleSetListResultPageClient) NotDone

NotDone returns true if the page enumeration should be started or is not yet complete.

func (VirtualMachineScaleSetListResultPageClient) Response

Response returns the raw server response from the last page request.

func (VirtualMachineScaleSetListResultPageClient) Values

Values returns the slice of values for the current page or nil if there are no values.

type VirtualMachineScaleSetListValues

type VirtualMachineScaleSetListValues struct {
	Value []compute.VirtualMachineScaleSet
}

VirtualMachineScaleSetListValues is an wrapper of virtual machine scale set list response values

type VirtualMachineScaleSetVMListResultPageClient

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

VirtualMachineScaleSetVMListResultPageClient Virtual Machine Scale Set VM List Result Page Client

func (*VirtualMachineScaleSetVMListResultPageClient) Next

Next advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (*VirtualMachineScaleSetVMListResultPageClient) NextWithContext

func (page *VirtualMachineScaleSetVMListResultPageClient) NextWithContext(ctx context.Context) (err error)

NextWithContext advances to the next page of values. If there was an error making the request the page does not advance and the error is returned.

func (VirtualMachineScaleSetVMListResultPageClient) NotDone

NotDone returns true if the page enumeration should be started or is not yet complete.

func (VirtualMachineScaleSetVMListResultPageClient) Response

Response returns the raw server response from the last page request.

func (VirtualMachineScaleSetVMListResultPageClient) Values

Values returns the slice of values for the current page or nil if there are no values.

type VirtualMachineScaleSetVMValues

type VirtualMachineScaleSetVMValues struct {
	Value []compute.VirtualMachineScaleSetVM
}

VirtualMachineScaleSetVMValues is an wrapper of virtual machine scale set VM response values

type VirtualMachineVMValues

type VirtualMachineVMValues struct {
	Value []compute.VirtualMachine
}

VirtualMachineVMValues is an wrapper of virtual machine VM response values

Jump to

Keyboard shortcuts

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