armhelpers

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 45 Imported by: 131

Documentation

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 ACS-Engine to function
	RequiredResourceProviders = []string{"Microsoft.Compute", "Microsoft.Storage", "Microsoft.Network"}
)

Functions

func DeployTemplateSync added in v0.13.0

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

DeployTemplateSync deploys the template and returns ArmError

Types

type ACSEngineClient

type ACSEngineClient interface {

	//AddAcceptLanguages sets the list of languages to accept on this request
	AddAcceptLanguages(languages []string)

	// AddAuxiliaryTokens sets the list of aux tokens to accept on this request
	AddAuxiliaryTokens(tokens []string)

	// DeployTemplate can deploy a template into Azure ARM
	DeployTemplate(ctx context.Context, resourceGroup, name string, template, parameters map[string]interface{}) (resources.DeploymentExtended, error)

	// EnsureResourceGroup ensures the specified resource group exists in the specified location
	EnsureResourceGroup(ctx context.Context, resourceGroup, location string, managedBy *string) (*resources.Group, error)

	// List lists VM resources
	ListVirtualMachines(ctx context.Context, resourceGroup string) (VirtualMachineListResultPage, error)

	// GetVirtualMachine retrieves the specified virtual machine.
	GetVirtualMachine(ctx context.Context, resourceGroup, name string) (compute.VirtualMachine, error)

	// DeleteVirtualMachine deletes the specified virtual machine.
	DeleteVirtualMachine(ctx context.Context, resourceGroup, name string) error

	// ListVirtualMachineScaleSets lists the vmss resources in the resource group
	ListVirtualMachineScaleSets(ctx context.Context, resourceGroup string) (compute.VirtualMachineScaleSetListResultPage, error)

	// ListVirtualMachineScaleSetVMs lists the virtual machines contained in a vmss
	ListVirtualMachineScaleSetVMs(ctx context.Context, resourceGroup, virtualMachineScaleSet string) (compute.VirtualMachineScaleSetVMListResultPage, error)

	// DeleteVirtualMachineScaleSetVM deletes a VM in a VMSS
	DeleteVirtualMachineScaleSetVM(ctx context.Context, resourceGroup, virtualMachineScaleSet, instanceID string) error

	// SetVirtualMachineScaleSetCapacity sets the VMSS capacity
	SetVirtualMachineScaleSetCapacity(ctx context.Context, resourceGroup, virtualMachineScaleSet string, sku compute.Sku, location string) error

	// GetStorageClient uses SRP to retrieve keys, and then an authenticated client for talking to the specified storage
	// account.
	GetStorageClient(ctx context.Context, resourceGroup, accountName string) (ACSStorageClient, error)

	// DeleteNetworkInterface deletes the specified network interface.
	DeleteNetworkInterface(ctx context.Context, resourceGroup, nicName string) error

	// CreateGraphAppliction creates an application via the graphrbac client
	CreateGraphApplication(ctx context.Context, applicationCreateParameters graphrbac.ApplicationCreateParameters) (graphrbac.Application, error)

	// CreateGraphPrincipal creates a service principal via the graphrbac client
	CreateGraphPrincipal(ctx context.Context, servicePrincipalCreateParameters graphrbac.ServicePrincipalCreateParameters) (graphrbac.ServicePrincipal, error)
	CreateApp(ctx context.Context, applicationName, applicationURL string, replyURLs *[]string, requiredResourceAccess *[]graphrbac.RequiredResourceAccess) (result graphrbac.Application, servicePrincipalObjectID, secret string, err error)
	DeleteApp(ctx context.Context, applicationName, applicationObjectID string) (autorest.Response, error)

	// User Assigned MSI
	//CreateUserAssignedID - Creates a user assigned msi.
	CreateUserAssignedID(location string, resourceGroup string, userAssignedID string) (*msi.Identity, error)

	// RBAC
	CreateRoleAssignment(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (authorization.RoleAssignment, error)
	CreateRoleAssignmentSimple(ctx context.Context, applicationID, roleID string) error
	DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentNameID string) (authorization.RoleAssignment, error)
	ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) (RoleAssignmentListResultPage, error)

	// MANAGED DISKS
	DeleteManagedDisk(ctx context.Context, resourceGroupName string, diskName string) error
	ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.DiskListPage, err error)

	GetKubernetesClient(masterURL, kubeConfig string, interval, timeout time.Duration) (KubernetesClient, error)

	ListProviders(ctx context.Context) (resources.ProviderListResultPage, error)

	// ListDeploymentOperations gets all deployments operations for a deployment.
	ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err 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(containerName, blobName string, options *azStorage.DeleteBlobOptions) error
	// CreateContainer creates the CloudBlobContainer if it does not exist
	CreateContainer(containerName string, options *azStorage.CreateContainerOptions) (bool, error)
	// SaveBlockBlob initializes a block blob by taking the byte
	SaveBlockBlob(containerName, blobName string, b []byte, options *azStorage.PutBlobOptions) 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 string, certificate *x509.Certificate, privateKey *rsa.PrivateKey) (*AzureClient, error)

NewAzureClientWithClientCertificate returns an AzureClient via client_id and jwt certificate assertion

func NewAzureClientWithClientCertificateExternalTenant added in v0.22.0

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 added in v0.2.0

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

NewAzureClientWithClientCertificateFile 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 NewAzureClientWithClientSecretExternalTenant added in v0.22.0

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 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) AddAcceptLanguages added in v0.2.0

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

AddAcceptLanguages sets the list of languages to accept on this request

func (*AzureClient) AddAuxiliaryTokens added in v0.22.0

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

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

func (*AzureClient) CheckDeploymentExistence added in v0.2.0

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 added in v0.3.0

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

CheckResourceGroupExistence return if the resource group exists

func (*AzureClient) CreateApp added in v0.4.0

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 added in v0.4.0

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

CreateGraphApplication creates an application via the graphrbac client

func (*AzureClient) CreateGraphPrincipal added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

CreateRoleAssignmentSimple is a wrapper around RoleAssignmentsClient.Create

func (*AzureClient) CreateUserAssignedID added in v0.22.0

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

CreateUserAssignedID - Creates a user assigned msi.

func (*AzureClient) DeleteApp added in v0.22.1

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 added in v0.22.1

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 added in v0.4.0

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 added in v0.18.0

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) DeleteVirtualMachineScaleSetVM added in v0.19.0

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 added in v0.9.0

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 resouce 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 added in v0.9.0

func (az *AzureClient) GetKubernetesClient(masterURL, kubeConfig string, interval, timeout time.Duration) (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) (ACSStorageClient, error)

GetStorageClient returns an authenticated client for the specified account.

func (*AzureClient) GetVirtualMachine

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

GetVirtualMachine returns the specified machine in the specified resource group.

func (*AzureClient) ListDeploymentOperations added in v0.2.0

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

ListDeploymentOperations gets all deployments operations for a deployment.

func (*AzureClient) ListManagedDisksByResourceGroup added in v0.4.0

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

ListManagedDisksByResourceGroup lists managed disks in a resource group.

func (*AzureClient) ListProviders added in v0.9.0

ListProviders returns all the providers for a given AzureClient

func (*AzureClient) ListRoleAssignmentsForPrincipal added in v0.18.0

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

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

func (*AzureClient) ListVirtualMachineScaleSetVMs added in v0.19.0

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

ListVirtualMachineScaleSetVMs returns the list of VMs per VMSS

func (*AzureClient) ListVirtualMachineScaleSets added in v0.1.2

func (az *AzureClient) ListVirtualMachineScaleSets(ctx context.Context, resourceGroup string) (compute.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) (VirtualMachineListResultPage, error)

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

func (*AzureClient) SetVirtualMachineScaleSetCapacity added in v0.19.0

func (az *AzureClient) SetVirtualMachineScaleSetCapacity(ctx context.Context, resourceGroup, virtualMachineScaleSet string, sku compute.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 added in v0.22.1

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 added in v0.22.1

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

SaveBlockBlob initializes a block blob by taking the byte

type DeploymentError added in v0.13.0

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 added in v0.13.0

func (e *DeploymentError) Error() string

Error implements error interface

type DeploymentOperationsListResultPage added in v0.20.7

type DeploymentOperationsListResultPage interface {
	Next() error
	NotDone() bool
	Response() resources.DeploymentOperationsListResult
	Values() []resources.DeploymentOperation
}

DeploymentOperationsListResultPage is an interface for resources.DeploymentOperationsListResultPage to aid in mocking

type DeploymentValidationError added in v0.13.0

type DeploymentValidationError struct {
	Err error
}

DeploymentValidationError contains validation error

func (*DeploymentValidationError) Error added in v0.13.0

func (e *DeploymentValidationError) Error() string

Error implements error interface

type KubernetesClient added in v0.9.0

type KubernetesClient interface {
	//ListPods returns all Pods running on the passed in node
	ListPods(node *v1.Node) (*v1.PodList, error)
	//GetNode returns details about node with passed in name
	GetNode(name string) (*v1.Node, error)
	//UpdateNode updates the node in the api server with the passed in info
	UpdateNode(node *v1.Node) (*v1.Node, error)
	//DeleteNode deregisters node in the api server
	DeleteNode(name string) error
	//SupportEviction queries the api server to discover if it supports eviction, and returns supported type if it is supported
	SupportEviction() (string, error)
	//DeletePod deletes the passed in pod
	DeletePod(pod *v1.Pod) error
	//EvictPod evicts the passed in pod using the passed in api version
	EvictPod(pod *v1.Pod, policyGroupVersion string) error
	//WaitForDelete waits until all pods are deleted. Returns all pods not deleted and an error on failure
	WaitForDelete(logger *log.Entry, pods []v1.Pod, usingEviction bool) ([]v1.Pod, error)
}

KubernetesClient interface models client for interacting with kubernetes api server

type KubernetesClientSetClient added in v0.9.0

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

KubernetesClientSetClient kubernetes client hooked up to a live api server

func (*KubernetesClientSetClient) DeleteNode added in v0.14.1

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

DeleteNode deregisters the node in the api server

func (*KubernetesClientSetClient) DeletePod added in v0.9.0

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

DeletePod deletes the passed in pod

func (*KubernetesClientSetClient) EvictPod added in v0.9.0

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 added in v0.9.0

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

GetNode returns details about node with passed in name

func (*KubernetesClientSetClient) ListPods added in v0.9.0

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

ListPods returns all Pods running on the passed in node

func (*KubernetesClientSetClient) SupportEviction added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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 MockACSEngineClient

type MockACSEngineClient struct {
	FailDeployTemplate                    bool
	FailDeployTemplateQuota               bool
	FailDeployTemplateConflict            bool
	FailDeployTemplateWithProperties      bool
	FailEnsureResourceGroup               bool
	FailListVirtualMachines               bool
	FailListVirtualMachinesTags           bool
	FailListVirtualMachineScaleSets       bool
	FailGetVirtualMachine                 bool
	FailDeleteVirtualMachine              bool
	FailDeleteVirtualMachineScaleSetVM    bool
	FailSetVirtualMachineScaleSetCapacity bool
	FailListVirtualMachineScaleSetVMs     bool
	FailGetStorageClient                  bool
	FailDeleteNetworkInterface            bool
	FailGetKubernetesClient               bool
	FailListProviders                     bool
	ShouldSupportVMIdentity               bool
	FailDeleteRoleAssignment              bool
	MockKubernetesClient                  *MockKubernetesClient
}

MockACSEngineClient is an implementation of ACSEngineClient where all requests error out

func (*MockACSEngineClient) AddAcceptLanguages added in v0.2.0

func (mc *MockACSEngineClient) AddAcceptLanguages(languages []string)

AddAcceptLanguages mock

func (*MockACSEngineClient) AddAuxiliaryTokens added in v0.22.0

func (mc *MockACSEngineClient) AddAuxiliaryTokens(tokens []string)

AddAuxiliaryTokens mock

func (*MockACSEngineClient) CreateApp added in v0.4.0

func (mc *MockACSEngineClient) CreateApp(ctx context.Context, applicationName, applicationURL string, replyURLs *[]string, requiredResourceAccess *[]graphrbac.RequiredResourceAccess) (result graphrbac.Application, servicePrincipalObjectID, secret string, err error)

CreateApp is a simpler method for creating an application

func (*MockACSEngineClient) CreateGraphApplication added in v0.4.0

func (mc *MockACSEngineClient) CreateGraphApplication(ctx context.Context, applicationCreateParameters graphrbac.ApplicationCreateParameters) (graphrbac.Application, error)

CreateGraphApplication creates an application via the graphrbac client

func (*MockACSEngineClient) CreateGraphPrincipal added in v0.4.0

func (mc *MockACSEngineClient) CreateGraphPrincipal(ctx context.Context, servicePrincipalCreateParameters graphrbac.ServicePrincipalCreateParameters) (graphrbac.ServicePrincipal, error)

CreateGraphPrincipal creates a service principal via the graphrbac client

func (*MockACSEngineClient) CreateRoleAssignment added in v0.4.0

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

CreateRoleAssignment creates a role assignment via the authorization client

func (*MockACSEngineClient) CreateRoleAssignmentSimple added in v0.4.0

func (mc *MockACSEngineClient) CreateRoleAssignmentSimple(ctx context.Context, applicationID, roleID string) error

CreateRoleAssignmentSimple is a wrapper around RoleAssignmentsClient.Create

func (*MockACSEngineClient) CreateUserAssignedID added in v0.22.0

func (mc *MockACSEngineClient) CreateUserAssignedID(location string, resourceGroup string, userAssignedID string) (*msi.Identity, error)

CreateUserAssignedID - Creates a user assigned msi.

func (*MockACSEngineClient) DeleteApp added in v0.22.1

func (mc *MockACSEngineClient) DeleteApp(ctx context.Context, appName, applicationObjectID string) (response autorest.Response, err error)

DeleteApp is a simpler method for deleting an application

func (*MockACSEngineClient) DeleteManagedDisk added in v0.4.0

func (mc *MockACSEngineClient) DeleteManagedDisk(ctx context.Context, resourceGroupName string, diskName string) error

DeleteManagedDisk is a wrapper around disksClient.Delete

func (*MockACSEngineClient) DeleteNetworkInterface

func (mc *MockACSEngineClient) DeleteNetworkInterface(ctx context.Context, resourceGroup, nicName string) error

DeleteNetworkInterface mock

func (*MockACSEngineClient) DeleteRoleAssignmentByID added in v0.18.0

func (mc *MockACSEngineClient) DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (authorization.RoleAssignment, error)

DeleteRoleAssignmentByID deletes a roleAssignment via its unique identifier

func (*MockACSEngineClient) DeleteVirtualMachine

func (mc *MockACSEngineClient) DeleteVirtualMachine(ctx context.Context, resourceGroup, name string) error

DeleteVirtualMachine mock

func (*MockACSEngineClient) DeleteVirtualMachineScaleSetVM added in v0.19.0

func (mc *MockACSEngineClient) DeleteVirtualMachineScaleSetVM(ctx context.Context, resourceGroup, virtualMachineScaleSet, instanceID string) error

DeleteVirtualMachineScaleSetVM mock

func (*MockACSEngineClient) DeployTemplate

func (mc *MockACSEngineClient) DeployTemplate(ctx context.Context, resourceGroup, name string, template, parameters map[string]interface{}) (de resources.DeploymentExtended, err error)

DeployTemplate mock

func (*MockACSEngineClient) EnsureResourceGroup

func (mc *MockACSEngineClient) EnsureResourceGroup(ctx context.Context, resourceGroup, location string, managedBy *string) (*resources.Group, error)

EnsureResourceGroup mock

func (*MockACSEngineClient) GetKubernetesClient added in v0.9.0

func (mc *MockACSEngineClient) GetKubernetesClient(masterURL, kubeConfig string, interval, timeout time.Duration) (KubernetesClient, error)

GetKubernetesClient mock

func (*MockACSEngineClient) GetStorageClient

func (mc *MockACSEngineClient) GetStorageClient(ctx context.Context, resourceGroup, accountName string) (ACSStorageClient, error)

GetStorageClient mock

func (*MockACSEngineClient) GetVirtualMachine

func (mc *MockACSEngineClient) GetVirtualMachine(ctx context.Context, resourceGroup, name string) (compute.VirtualMachine, error)

GetVirtualMachine mock

func (*MockACSEngineClient) ListDeploymentOperations added in v0.13.0

func (mc *MockACSEngineClient) ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error)

ListDeploymentOperations gets all deployments operations for a deployment.

func (*MockACSEngineClient) ListDeploymentOperationsNextResults added in v0.13.0

func (mc *MockACSEngineClient) ListDeploymentOperationsNextResults(lastResults resources.DeploymentOperationsListResult) (result resources.DeploymentOperationsListResult, err error)

ListDeploymentOperationsNextResults retrieves the next set of results, if any.

func (*MockACSEngineClient) ListManagedDisksByResourceGroup added in v0.4.0

func (mc *MockACSEngineClient) ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.DiskListPage, err error)

ListManagedDisksByResourceGroup is a wrapper around disksClient.ListManagedDisksByResourceGroup

func (*MockACSEngineClient) ListProviders added in v0.9.0

ListProviders mock

func (*MockACSEngineClient) ListRoleAssignmentsForPrincipal added in v0.18.0

func (mc *MockACSEngineClient) ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) (RoleAssignmentListResultPage, error)

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

func (*MockACSEngineClient) ListVirtualMachineScaleSetVMs added in v0.19.0

func (mc *MockACSEngineClient) ListVirtualMachineScaleSetVMs(ctx context.Context, resourceGroup, virtualMachineScaleSet string) (compute.VirtualMachineScaleSetVMListResultPage, error)

ListVirtualMachineScaleSetVMs mock

func (*MockACSEngineClient) ListVirtualMachineScaleSets added in v0.1.2

func (mc *MockACSEngineClient) ListVirtualMachineScaleSets(ctx context.Context, resourceGroup string) (compute.VirtualMachineScaleSetListResultPage, error)

ListVirtualMachineScaleSets mock

func (*MockACSEngineClient) ListVirtualMachines

func (mc *MockACSEngineClient) ListVirtualMachines(ctx context.Context, resourceGroup string) (VirtualMachineListResultPage, error)

ListVirtualMachines mock

func (*MockACSEngineClient) SetVirtualMachineScaleSetCapacity added in v0.19.0

func (mc *MockACSEngineClient) SetVirtualMachineScaleSetCapacity(ctx context.Context, resourceGroup, virtualMachineScaleSet string, sku compute.Sku, location string) error

SetVirtualMachineScaleSetCapacity mock

type MockDeploymentOperationsListResultPage added in v0.20.7

MockDeploymentOperationsListResultPage contains a page of DeploymentOperation values.

func (*MockDeploymentOperationsListResultPage) Next added in v0.20.7

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 (MockDeploymentOperationsListResultPage) NotDone added in v0.20.7

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

func (MockDeploymentOperationsListResultPage) Response added in v0.20.7

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

func (MockDeploymentOperationsListResultPage) Values added in v0.20.7

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

type MockKubernetesClient added in v0.9.0

type MockKubernetesClient struct {
	FailListPods          bool
	FailGetNode           bool
	UpdateNodeFunc        func(*v1.Node) (*v1.Node, error)
	FailUpdateNode        bool
	FailDeleteNode        bool
	FailSupportEviction   bool
	FailDeletePod         bool
	FailEvictPod          bool
	FailWaitForDelete     bool
	ShouldSupportEviction bool
	PodsList              *v1.PodList
}

MockKubernetesClient mock implementation of KubernetesClient

func (*MockKubernetesClient) DeleteNode added in v0.14.1

func (mkc *MockKubernetesClient) DeleteNode(name string) error

DeleteNode deregisters node in the api server

func (*MockKubernetesClient) DeletePod added in v0.9.0

func (mkc *MockKubernetesClient) DeletePod(pod *v1.Pod) error

DeletePod deletes the passed in pod

func (*MockKubernetesClient) EvictPod added in v0.9.0

func (mkc *MockKubernetesClient) EvictPod(pod *v1.Pod, policyGroupVersion string) error

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

func (*MockKubernetesClient) GetNode added in v0.9.0

func (mkc *MockKubernetesClient) GetNode(name string) (*v1.Node, error)

GetNode returns details about node with passed in name

func (*MockKubernetesClient) ListPods added in v0.9.0

func (mkc *MockKubernetesClient) ListPods(node *v1.Node) (*v1.PodList, error)

ListPods returns all Pods running on the passed in node

func (*MockKubernetesClient) SupportEviction added in v0.9.0

func (mkc *MockKubernetesClient) SupportEviction() (string, error)

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

func (*MockKubernetesClient) UpdateNode added in v0.9.0

func (mkc *MockKubernetesClient) UpdateNode(node *v1.Node) (*v1.Node, error)

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

func (*MockKubernetesClient) WaitForDelete added in v0.9.0

func (mkc *MockKubernetesClient) 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 MockRoleAssignmentListResultPage added in v0.20.7

MockRoleAssignmentListResultPage contains a page of RoleAssignment values.

func (*MockRoleAssignmentListResultPage) Next added in v0.20.7

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 (MockRoleAssignmentListResultPage) NotDone added in v0.20.7

func (page MockRoleAssignmentListResultPage) NotDone() bool

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

func (MockRoleAssignmentListResultPage) Response added in v0.20.7

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

func (MockRoleAssignmentListResultPage) Values added in v0.20.7

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

type MockStorageClient

type MockStorageClient struct {
	FailCreateContainer bool
	FailSaveBlockBlob   bool
}

MockStorageClient mock implementation of StorageClient

func (*MockStorageClient) CreateContainer added in v0.22.1

func (msc *MockStorageClient) CreateContainer(container string, options *azStorage.CreateContainerOptions) (bool, error)

CreateContainer mock

func (*MockStorageClient) DeleteBlob

func (msc *MockStorageClient) DeleteBlob(container, blob string, options *azStorage.DeleteBlobOptions) error

DeleteBlob mock

func (*MockStorageClient) SaveBlockBlob added in v0.22.1

func (msc *MockStorageClient) SaveBlockBlob(container, blob string, b []byte, options *azStorage.PutBlobOptions) error

SaveBlockBlob mock

type MockVirtualMachineListResultPage added in v0.20.7

type MockVirtualMachineListResultPage struct {
	Fn   func(compute.VirtualMachineListResult) (compute.VirtualMachineListResult, error)
	Vmlr compute.VirtualMachineListResult
}

MockVirtualMachineListResultPage contains a page of VirtualMachine values.

func (*MockVirtualMachineListResultPage) Next added in v0.20.7

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 (MockVirtualMachineListResultPage) NotDone added in v0.20.7

func (page MockVirtualMachineListResultPage) NotDone() bool

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

func (MockVirtualMachineListResultPage) Response added in v0.20.7

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

func (MockVirtualMachineListResultPage) Values added in v0.20.7

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

type RoleAssignmentListResultPage added in v0.20.7

type RoleAssignmentListResultPage interface {
	Next() error
	NotDone() bool
	Response() authorization.RoleAssignmentListResult
	Values() []authorization.RoleAssignment
}

RoleAssignmentListResultPage is an interface for authorization.RoleAssignmentListResultPage to aid in mocking

type VirtualMachineListResultPage added in v0.20.7

type VirtualMachineListResultPage interface {
	Next() error
	NotDone() bool
	Response() compute.VirtualMachineListResult
	Values() []compute.VirtualMachine
}

VirtualMachineListResultPage is an interface for compute.VirtualMachineListResultPage to aid in mocking

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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