armhelpers

package
v0.81.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package armhelpers stores helpers and wrapper for the go azure sdk.

Index

Constants

View Source
const DefaultARMOperationTimeout = 150 * time.Minute

DefaultARMOperationTimeout defines a default (permissive) ARM operation timeout

View Source
const (
	//DefaultFakeVMName is the default name assigned to VMs part of FakeListVirtualMachineResult
	DefaultFakeVMName = "k8s-agentpool1-12345678-0"
)

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 DeployTemplateSync

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

DeployTemplateSync deploys the template and returns ArmError

func GetTenantID added in v0.81.0

func GetTenantID(subscriptionID string, cloud cloud.Configuration) (string, error)

GetTenantID figures out the AAD tenant ID of the subscription by making an unauthenticated request to the Get Subscription Details endpoint and parses the value from WWW-Authenticate header.

func NewClientCertificateCredential added in v0.81.0

func NewClientCertificateCredential(cloud cloud.Configuration, subscriptionID, clientID, certificatePath, privateKeyPath string) (*azidentity.ClientCertificateCredential, error)

NewClientCertificateCredential returns an AzureClient via client_id and jwt certificate assertion

func NewClientCertificateCredentialExternalTenant added in v0.81.0

func NewClientCertificateCredentialExternalTenant(cloud cloud.Configuration, subscriptionID, clientID, certificatePath, privateKeyPath string) (*azidentity.ClientCertificateCredential, error)

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

func NewClientSecretCredential added in v0.81.0

func NewClientSecretCredential(cloud cloud.Configuration, subscriptionID, clientID, clientSecret string) (*azidentity.ClientSecretCredential, error)

NewClientSecretCredential returns an AzureClient via client_id and client_secret

func NewClientSecretCredentialExternalTenant added in v0.81.0

func NewClientSecretCredentialExternalTenant(cloud cloud.Configuration, subscriptionID, clientID, clientSecret string) (*azidentity.ClientSecretCredential, error)

NewClientSecretCredentialExternalTenant returns an AzureClient via client_id and client_secret from a tenant

func NewDefaultCredential added in v0.81.0

func NewDefaultCredential(cloud cloud.Configuration, subscriptionID string) (*azidentity.DefaultAzureCredential, error)

NewDefaultCredential returns an AzureClient

func ValidateRequiredImages

func ValidateRequiredImages(ctx context.Context, location string, p *api.Properties, client AKSEngineClient) error

ValidateRequiredImages checks that the OS images required by both master and agent pools are available on the target cloud

Types

type AKSEngineClient

type AKSEngineClient interface {

	// 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.ResourceGroup, error)

	// ListVirtualMachines lists VM resources
	ListVirtualMachines(ctx context.Context, resourceGroup string) ([]*compute.VirtualMachine, error)

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

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

	// DeleteVirtualMachine deletes the specified virtual machine.
	DeleteVirtualMachine(ctx context.Context, resourceGroup, name string) error
	// GetVirtualMachinePowerState returns the virtual machine's PowerState status code
	GetVirtualMachinePowerState(ctx context.Context, resourceGroup, name string) (string, error)

	//
	// STORAGE
	DeleteVirtualHardDisk(ctx context.Context, resourceGroup string, vhd *compute.VirtualHardDisk) error

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

	//
	// RBAC
	DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentNameID string) (authorization.RoleAssignment, error)
	ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) ([]*authorization.RoleAssignment, error)

	// MANAGED DISKS
	DeleteManagedDisk(ctx context.Context, resourceGroupName string, diskName string) error
	ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error)

	GetKubernetesClient(apiserverURL, kubeConfig string, interval, timeout time.Duration) (kubernetes.Client, error)

	ListProviders(ctx context.Context) ([]*resources.Provider, error)

	// ListDeploymentOperations gets all deployments operations for a deployment.
	ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string) ([]*resources.DeploymentOperation, error)
}

AKSEngineClient is the interface used to talk to an Azure environment. This interface exposes just the subset of Azure APIs and clients needed for AKS Engine.

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

func NewAzureClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureClient, error)

NewAzureClientWithClientSecret returns an AzureClient via client_id and client_secret

func (*AzureClient) AddAcceptLanguages

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

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) DeleteVirtualHardDisk added in v0.81.0

func (az *AzureClient) DeleteVirtualHardDisk(ctx context.Context, resourceGroup string, vhd *armcompute.VirtualHardDisk) error

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

func (az *AzureClient) DeployTemplate(ctx context.Context, resourceGroupName, deploymentName string, template map[string]interface{}, parameters map[string]interface{}) (resources.DeploymentExtended, 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) (resources.ResourceGroup, 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) (resources.DeploymentsClientGetResponse, error)

GetDeployment returns the template deployment

func (*AzureClient) GetKubernetesClient

func (az *AzureClient) GetKubernetesClient(apiserverURL, kubeConfig string, interval, timeout time.Duration) (kubernetes.Client, error)

GetKubernetesClient returns a KubernetesClient hooked up to the api server at the apiserverURL.

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

func (az *AzureClient) GetVirtualMachineImage(ctx context.Context, location, publisherName, offer, skus, version string) (compute.VirtualMachineImage, error)

GetVirtualMachineImage returns an image or an error where there is no image

func (*AzureClient) GetVirtualMachinePowerState

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

GetVirtualMachinePowerState returns the virtual machine's PowerState status code

func (*AzureClient) ListDeploymentOperations

func (az *AzureClient) ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string) ([]*armresources.DeploymentOperation, error)

ListDeploymentOperations gets all deployments operations for a deployment.

func (*AzureClient) ListManagedDisksByResourceGroup

func (az *AzureClient) ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) ([]*armcompute.Disk, error)

ListManagedDisksByResourceGroup lists managed disks in a resource group.

func (*AzureClient) ListProviders

func (az *AzureClient) ListProviders(ctx context.Context) ([]*armresources.Provider, error)

ListProviders returns all the providers for a given AzureClient

func (*AzureClient) ListRoleAssignmentsForPrincipal

func (az *AzureClient) ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) ([]*authorization.RoleAssignment, error)

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

func (*AzureClient) ListVirtualMachineImages

func (az *AzureClient) ListVirtualMachineImages(ctx context.Context, location, publisherName, offer, skus string) ([]*compute.VirtualMachineImageResource, error)

ListVirtualMachineImages returns the list of images available in the current environment

func (*AzureClient) ListVirtualMachines

func (az *AzureClient) ListVirtualMachines(ctx context.Context, resourceGroup string) ([]*compute.VirtualMachine, error)

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

func (*AzureClient) RestartVirtualMachine

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

RestartVirtualMachine restarts the specified virtual machine.

func (*AzureClient) ValidateTemplate

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

ValidateTemplate validate the template and parameters

type DeploymentError

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

DeploymentError contains the root deployment error along with deployment operation errors

func (*DeploymentError) Error

func (e *DeploymentError) Error() string

type DeploymentValidationError

type DeploymentValidationError struct {
	Err error
}

DeploymentValidationError contains validation error

func (*DeploymentValidationError) Error

func (e *DeploymentValidationError) Error() string

Error implements error interface

type HTTPMockClient

type HTTPMockClient struct {
	SubscriptionID                             string
	TenantID                                   string
	ResourceGroup                              string
	ResourceGroupAPIVersion                    string
	ComputeAPIVersion                          string
	DiskAPIVersion                             string
	NetworkAPIVersion                          string
	DeploymentAPIVersion                       string
	LogAnalyticsAPIVersion                     string
	SubscriptionsAPIVersion                    string
	ResourceSkusAPIVersion                     string
	DeploymentName                             string
	DeploymentStatus                           string
	VirtualMachineName                         string
	VirtualNicName                             string
	VirutalDiskName                            string
	Location                                   string
	OperationID                                string
	TokenResponse                              string
	Publisher                                  string
	Sku                                        string
	Offer                                      string
	Version                                    string
	ResponseListVirtualMachines                string
	ResponseGetVirtualMachine                  string
	ResponseDeployVirtualMachine               string
	ResponseDeployVirtualMachineError          string
	ResponseGetAvailabilitySet                 string
	ResponseGetLogAnalyticsWorkspace           string
	ResponseGetLogAnalyticsWorkspaceSharedKeys string
	ResponseListWorkspacesByResourceGroup      string
	ResponseCreateOrUpdateWorkspace            string
	ResponseListWorkspacesByResourceGroupInMC  string
	ResponseCreateOrUpdateWorkspaceInMC        string
	ResponseGetVirtualMachineImage             string
	ResponseListVirtualMachineImages           string
	// contains filtered or unexported fields
}

HTTPMockClient is an wrapper of httpmock

func NewHTTPMockClient

func NewHTTPMockClient() (HTTPMockClient, error)

NewHTTPMockClient creates HTTPMockClient with default values

func (*HTTPMockClient) Activate

func (mc *HTTPMockClient) Activate() error

Activate starts the mock environment and should only be called after all required endpoints have been registered.

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() cloud.Configuration

GetEnvironment return Environment for Azure

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

func (mc HTTPMockClient) RegisterDeleteOperation()

RegisterDeleteOperation registers mock responses for checking the status of a delete operation

func (HTTPMockClient) RegisterDeployOperationFailure

func (mc HTTPMockClient) RegisterDeployOperationFailure()

RegisterDeployOperationSuccess registers the mock response for a failed deployment

func (HTTPMockClient) RegisterDeployOperationSuccess

func (mc HTTPMockClient) RegisterDeployOperationSuccess()

RegisterDeployOperationSuccess registers the mock response for a successful deployment

func (*HTTPMockClient) RegisterDeployTemplate

func (mc *HTTPMockClient) RegisterDeployTemplate()

RegisterDeployTemplate registers the mock response for DeployTemplate

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

func (*HTTPMockClient) RegisterVMImageFetcherInterface

func (mc *HTTPMockClient) RegisterVMImageFetcherInterface()

RegisterVMImageFetcherInterface registers the mock response for VMImageFetcherInterface methods.

func (*HTTPMockClient) RegisterVirtualMachineEndpoint

func (mc *HTTPMockClient) RegisterVirtualMachineEndpoint()

RegisterVirtualMachineEndpoint registers mock responses for the Microsoft.Compute/virtualMachines endpoint

type MockAKSEngineClient

type MockAKSEngineClient struct {
	FailDeployTemplate                     bool
	FailDeployTemplateQuota                bool
	FailDeployTemplateConflict             bool
	FailDeployTemplateWithProperties       bool
	FailEnsureResourceGroup                bool
	FailListVirtualMachines                bool
	FailListVirtualMachinesTags            bool
	FailGetVirtualMachine                  bool
	FailRestartVirtualMachine              bool
	FailDeleteVirtualMachine               bool
	FailDeleteNetworkInterface             bool
	FailGetKubernetesClient                bool
	FailListProviders                      bool
	ShouldSupportVMIdentity                bool
	FailDeleteRoleAssignment               bool
	FailEnsureDefaultLogAnalyticsWorkspace bool
	FailAddContainerInsightsSolution       bool
	FailGetLogAnalyticsWorkspaceInfo       bool
	MockKubernetesClient                   *MockKubernetesClient
	FakeListVirtualMachineResult           func() []*compute.VirtualMachine
}

MockAKSEngineClient is an implementation of AKSEngineClient where all requests error out

func (*MockAKSEngineClient) AddAcceptLanguages

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

AddAcceptLanguages mock

func (*MockAKSEngineClient) AddContainerInsightsSolution

func (mc *MockAKSEngineClient) AddContainerInsightsSolution(ctx context.Context, workspaceSubscriptionID, workspaceResourceGroup, workspaceName, workspaceLocation string) (result bool, err error)

AddContainerInsightsSolution mock

func (*MockAKSEngineClient) DeleteManagedDisk

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

DeleteManagedDisk is a wrapper around disksClient.Delete

func (*MockAKSEngineClient) DeleteNetworkInterface

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

DeleteNetworkInterface mock

func (*MockAKSEngineClient) DeleteRoleAssignmentByID

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

DeleteRoleAssignmentByID deletes a roleAssignment via its unique identifier

func (*MockAKSEngineClient) DeleteVirtualHardDisk added in v0.81.0

func (mc *MockAKSEngineClient) DeleteVirtualHardDisk(ctx context.Context, resourceGroup string, vhd *compute.VirtualHardDisk) error

func (*MockAKSEngineClient) DeleteVirtualMachine

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

DeleteVirtualMachine mock

func (*MockAKSEngineClient) DeployTemplate

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

DeployTemplate mock

func (*MockAKSEngineClient) EnsureDefaultLogAnalyticsWorkspace

func (mc *MockAKSEngineClient) EnsureDefaultLogAnalyticsWorkspace(ctx context.Context, resourceGroup, location string) (workspaceResourceID string, err error)

EnsureDefaultLogAnalyticsWorkspace mock

func (*MockAKSEngineClient) EnsureResourceGroup

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

EnsureResourceGroup mock

func (*MockAKSEngineClient) GetKubernetesClient

func (mc *MockAKSEngineClient) GetKubernetesClient(apiserverURL, kubeConfig string, interval, timeout time.Duration) (kubernetes.Client, error)

GetKubernetesClient mock

func (*MockAKSEngineClient) GetLogAnalyticsWorkspaceInfo

func (mc *MockAKSEngineClient) GetLogAnalyticsWorkspaceInfo(ctx context.Context, workspaceSubscriptionID, workspaceResourceGroup, workspaceName string) (workspaceID string, workspaceKey, workspaceLocation string, err error)

GetLogAnalyticsWorkspaceInfo mock

func (*MockAKSEngineClient) GetVirtualMachine

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

GetVirtualMachine mock

func (*MockAKSEngineClient) GetVirtualMachinePowerState

func (mc *MockAKSEngineClient) GetVirtualMachinePowerState(ctx context.Context, resourceGroup, name string) (string, error)

GetVirtualMachinePowerState returns the virtual machine's PowerState status code

func (*MockAKSEngineClient) ListDeploymentOperations

func (mc *MockAKSEngineClient) ListDeploymentOperations(ctx context.Context, resourceGroupName string, deploymentName string) ([]*resources.DeploymentOperation, error)

ListDeploymentOperations gets all deployments operations for a deployment.

func (*MockAKSEngineClient) ListDeploymentOperationsNextResults

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

ListDeploymentOperationsNextResults retrieves the next set of results, if any.

func (*MockAKSEngineClient) ListManagedDisksByResourceGroup

func (mc *MockAKSEngineClient) ListManagedDisksByResourceGroup(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error)

ListManagedDisksByResourceGroup is a wrapper around disksClient.ListManagedDisksByResourceGroup

func (*MockAKSEngineClient) ListProviders

func (mc *MockAKSEngineClient) ListProviders(ctx context.Context) ([]*resources.Provider, error)

ListProviders mock

func (*MockAKSEngineClient) ListRoleAssignmentsForPrincipal

func (mc *MockAKSEngineClient) ListRoleAssignmentsForPrincipal(ctx context.Context, scope string, principalID string) ([]*authorization.RoleAssignment, error)

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

func (*MockAKSEngineClient) ListVirtualMachines

func (mc *MockAKSEngineClient) ListVirtualMachines(ctx context.Context, resourceGroup string) ([]*compute.VirtualMachine, error)

ListVirtualMachines mock

func (*MockAKSEngineClient) MakeFakeVirtualMachine

func (mc *MockAKSEngineClient) MakeFakeVirtualMachine(vmName string, orchestratorVersion string) compute.VirtualMachine

MakeFakeVirtualMachine returns a fake compute.VirtualMachine

func (*MockAKSEngineClient) RestartVirtualMachine

func (mc *MockAKSEngineClient) RestartVirtualMachine(ctx context.Context, resourceGroup, name string) error

RestartVirtualMachine mock

type MockKubernetesClient

type MockKubernetesClient struct {
	FailListPods              bool
	FailListNodes             bool
	FailListServiceAccounts   bool
	FailListPodSecurityPolicy bool
	FailGetNode               bool
	UpdateNodeFunc            func(*v1.Node) (*v1.Node, error)
	GetNodeFunc               func(name string) (*v1.Node, error)
	FailUpdateNode            bool
	FailDeleteNode            bool
	FailDeleteServiceAccount  bool
	FailSupportEviction       bool
	FailDeletePod             bool
	FailDeleteClusterRole     bool
	FailDeleteDaemonSet       bool
	FailDeleteDeployment      bool
	FailEvictPod              bool
	FailWaitForDelete         bool
	ShouldSupportEviction     bool
	PodsList                  *v1.PodList
	ServiceAccountList        *v1.ServiceAccountList
	PodSecurityPolicyList     *policyv1beta1.PodSecurityPolicyList
	FailGetDeploymentCount    int
	FailUpdateDeploymentCount int
}

MockKubernetesClient mock implementation of KubernetesClient

func (*MockKubernetesClient) DeleteClusterRole

func (mkc *MockKubernetesClient) DeleteClusterRole(role *rbacv1.ClusterRole) error

DeleteDeployment deletes the passed in daemonset

func (*MockKubernetesClient) DeleteDaemonSet

func (mkc *MockKubernetesClient) DeleteDaemonSet(pod *appsv1.DaemonSet) error

DeleteDaemonSet deletes the passed in daemonset

func (*MockKubernetesClient) DeleteDeployment

func (mkc *MockKubernetesClient) DeleteDeployment(pod *appsv1.Deployment) error

DeleteDeployment deletes the passed in daemonset

func (*MockKubernetesClient) DeleteNode

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

DeleteNode deregisters node in the api server

func (*MockKubernetesClient) DeletePod

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

DeletePod deletes the passed in pod

func (*MockKubernetesClient) DeleteServiceAccount

func (mkc *MockKubernetesClient) DeleteServiceAccount(sa *v1.ServiceAccount) error

DeleteServiceAccount deletes the provided service account

func (*MockKubernetesClient) EvictPod

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

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

func (*MockKubernetesClient) GetDaemonSet

func (mkc *MockKubernetesClient) GetDaemonSet(namespace, name string) (*appsv1.DaemonSet, error)

DaemonSet returns a given daemonset in a namespace.

func (*MockKubernetesClient) GetDeployment

func (mkc *MockKubernetesClient) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment returns a given deployment in a namespace.

func (*MockKubernetesClient) GetNode

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

GetNode returns details about node with passed in name

func (*MockKubernetesClient) ListAllPods

func (mkc *MockKubernetesClient) ListAllPods() (*v1.PodList, error)

ListAllPods returns all Pods running

func (*MockKubernetesClient) ListNodes

func (mkc *MockKubernetesClient) ListNodes() (*v1.NodeList, error)

ListNodes returns a list of Nodes registered in the api server

func (*MockKubernetesClient) ListNodesByOptions

func (mkc *MockKubernetesClient) ListNodesByOptions(opts metav1.ListOptions) (*v1.NodeList, error)

ListNodesByOptions returns a list of Nodes registered in the api server

func (*MockKubernetesClient) ListPodSecurityPolices added in v0.75.4

func (mkc *MockKubernetesClient) ListPodSecurityPolices(opts metav1.ListOptions) (*policyv1beta1.PodSecurityPolicyList, error)

ListPodSecurityPolices returns the list of Pod Security Policies

func (*MockKubernetesClient) ListPods

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

ListPods returns Pods running on the passed in node

func (*MockKubernetesClient) ListServiceAccounts

func (mkc *MockKubernetesClient) ListServiceAccounts(namespace string) (*v1.ServiceAccountList, error)

ListServiceAccounts returns a list of Service Accounts in the provided namespace

func (*MockKubernetesClient) SupportEviction

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

func (mkc *MockKubernetesClient) UpdateDeployment(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

UpdateDeployment updates a deployment to match the given specification.

func (*MockKubernetesClient) UpdateNode

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

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 MockStorageClient

type MockStorageClient struct {
	FailCreateContainer bool
	FailSaveBlockBlob   bool
}

MockStorageClient mock implementation of StorageClient

func (*MockStorageClient) DeleteBlob

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

DeleteBlob mock

type VMImageFetcher

type VMImageFetcher interface {

	// ListVirtualMachineImages return a list of images
	ListVirtualMachineImages(ctx context.Context, location, publisherName, offer, skus string) ([]*compute.VirtualMachineImageResource, error)

	// GetVirtualMachineImage return a virtual machine image
	GetVirtualMachineImage(ctx context.Context, location, publisherName, offer, skus, version string) (compute.VirtualMachineImage, error)
}

VMImageFetcher is an extension of AKSEngine client allows us to operate on the virtual machine images in the environment

type VirtualMachineVMValues

type VirtualMachineVMValues struct {
	Value []compute.VirtualMachine
}

VirtualMachineVMValues is an wrapper of virtual machine VM response values

Directories

Path Synopsis
Package utils provides helper methods to assist with ARM operations.
Package utils provides helper methods to assist with ARM operations.

Jump to

Keyboard shortcuts

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