azure

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

packe az provides a simple wrapper around the Azure CLI.

Package az provides a simple wrapper around az cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AKSNodepool

type AKSNodepool struct {
	// AgentPoolType is VirtualMachineScaleSets or AvailabilitySet
	AgentPoolType string `json:"agentPoolType"`
	// Count is the number of VM's in the pool.
	Count int `json:"count"`
	// EnableAutoScaling is true when the node autoscaler is active.
	EnableAutoScaling bool `json:"enableAutoScaling"`
	// MaxCount is the maximum number of autoscaling nodes.
	MaxCount int `json:"maxCount"`
	// MaxPods is the maximum number of pods on a node.
	MaxPods int `json:"maxPods"`
	// MinCount is the minimum number of autoscaling nodes.
	MinCount int `json:"minCount"`
	// Mode defines the primary function of the pool.
	// If set as "System", AKS prefers system pods scheduling to the pool. https://aka.ms/aks/nodepool/mode.
	Mode string `json:"mode"`
	// Name of the pool.
	Name string `json:"name"`
	// OrchestratorVersion is the Kuberntes version of the pool.
	OrchestratorVersion string `json:"orchestratorVersion"`
	// AgentPoolType is the OS Type; Linux or Windows.
	OSType string `json:"osType"`
	// ProvisioningState is the current state of the pool.
	ProvisioningState ProvisioningState `json:"provisioningState"`
	// ResourceGroup
	ResourceGroup string `json:"resourceGroup"`
	// VMSize is the type of VM used in the pool.
	VMSize string `json:"vmSize"`
}

AKSNodepool is a subset of AKS node pool values.

type AZ

type AZ struct {
	// Subscription is the Name or ID of the Azure subscription.
	Subscription string

	Log logr.Logger
}

AZ is able to perform az cli commands.

func (*AZ) AKSNodepool

func (c *AZ) AKSNodepool(resourceGroup, cluster, nodepool string) (*AKSNodepool, error)

AKSNodepool returns the details about an AKS cluster nodepool.

func (*AZ) AKSNodepoolList

func (c *AZ) AKSNodepoolList(resourceGroup, cluster string) ([]AKSNodepool, error)

AKSNodepoolList returns all the node pools of an AKS cluster.

func (*AZ) AKSNodepoolUpgrade

func (c *AZ) AKSNodepoolUpgrade(resourceGroup, cluster, nodepool, version string) (*AKSNodepool, error)

AKSNodepoolUpgrade upgrades the node pool in a managed Kubernetes cluster to Kubernetes version. Expect this call to block for 10m per VM.

func (*AZ) AccountStatus

func (c *AZ) AccountStatus() ([]AccountStatus, error)

AccountStatus returns the account status of the already logged in account. An error is returned when no account is logged in.

func (*AZ) AllAutoscalers

func (c *AZ) AllAutoscalers(enable bool, clusters []v1.ClusterSpec, resourceGroup string, log logr.Logger) error

AllAutoscalers enables or disables Node autoscaling of multiple clusters/pools.

func (*AZ) Autoscaler

func (c *AZ) Autoscaler(enable bool, resourceGroup string, cluster string, pool string, minCount int, maxCount int) error

Autoscaler enables or disables a Node autoscaler for a cluster/pool. https://docs.microsoft.com/en-us/azure/aks/cluster-autoscaler#use-the-cluster-autoscaler-with-multiple-node-pools-enabled

func (*AZ) KeyvaultSecret

func (c *AZ) KeyvaultSecret(name, vaultName string) (string, error)

KeyvaultSecret returns the value of 'name' secret in 'vaultName' KeyVault.

func (*AZ) LoginSP

func (c *AZ) LoginSP(user, password, tenant string) error

LoginSP performs an 'az login' by ServicePrincipal.

func (*AZ) Logout

func (c *AZ) Logout() error

Logout performs an 'az logout'.

func (*AZ) SetSubscription

func (c *AZ) SetSubscription(sub string)

SetSubscription sets the Name or ID of the Azure subscription to use.

type AZFake

type AZFake struct {
	// Tally is the number of times a method has been called.
	AKSNodepoolListTally, AKSNodepoolTally, AKSNodepoolUpgradeTally, KeyvaultSecretTally int

	// Results that are returned by the fake implementations.
	AKSNodepoolListResult []AKSNodepool
	// AKSNodepoolResult is a list of results of which one is returned on each subsequent call.
	AKSNodepoolResult        []AKSNodepool
	AKSNodepoolUpgradeResult AKSNodepool

	KeyvaultSecretResult string
}

TerraformFake provides a Terraformer for testing.

func (*AZFake) AKSNodepool

func (c *AZFake) AKSNodepool(resourceGroup, cluster, nodepool string) (*AKSNodepool, error)

AKSNodepool returns the details about an AKS cluster nodepool.

func (*AZFake) AKSNodepoolList

func (c *AZFake) AKSNodepoolList(resourceGroup, cluster string) ([]AKSNodepool, error)

AKSNodepoolList returns all the node pools of an AKS cluster.

func (*AZFake) AKSNodepoolUpgrade

func (c *AZFake) AKSNodepoolUpgrade(resourceGroup, cluster, nodepool, version string) (*AKSNodepool, error)

AKSNodepoolUpgrade upgrades the node pool in a managed Kubernetes cluster to Kubernetes version. Expect this call to block for 10m per VM.

func (*AZFake) AllAutoscalers

func (c *AZFake) AllAutoscalers(enable bool, clusters []v1.ClusterSpec, resourceGroup string, log logr.Logger) error

func (*AZFake) Autoscaler

func (c *AZFake) Autoscaler(enable bool, resourceGroup string, cluster string, pool string, minCount int, maxCount int) error

func (*AZFake) KeyvaultSecret

func (c *AZFake) KeyvaultSecret(name, vaultName string) (string, error)

KeyvaultSecret reads name secret from vaultName KeyVault.

func (*AZFake) LoginSP

func (c *AZFake) LoginSP(user, password, tenant string) error

func (*AZFake) Logout

func (c *AZFake) Logout() error

func (*AZFake) SetSubscription

func (c *AZFake) SetSubscription(sub string)

func (*AZFake) SetupFakeResults

func (c *AZFake) SetupFakeResults()

SetupFakeResults sets-up the receiver with data that is returned during testing.

type AZer

type AZer interface {
	SetSubscription(sub string)

	LoginSP(user, password, tenant string) error
	Logout() error

	// KeyvaultSecret reads name secret from vaultName KeyVault.
	KeyvaultSecret(name, vaultName string) (string, error)

	// AKSNodepoolList returns all the node pools of an AKS cluster.
	AKSNodepoolList(resourceGroup, cluster string) ([]AKSNodepool, error)
	// AKSNodepool returns the details about an AKS cluster nodepool.
	AKSNodepool(resourceGroup, cluster, nodepool string) (*AKSNodepool, error)
	// AKSNodepoolUpgrade upgrades the node pool in a managed Kubernetes cluster to Kubernetes version.
	// Expect this call to block for VM count * 10m.
	AKSNodepoolUpgrade(resourceGroup, cluster, nodepool, version string) (*AKSNodepool, error)
	// Autoscaling enables or disables a Node autoscaler.
	Autoscaler(enable bool, resourceGroup string, cluster string, pool string, minCount int, maxCount int) error
	// AllAutoscalers enables or disables the Node autoscalers of multiple clusters.
	AllAutoscalers(enable bool, clusters []v1.ClusterSpec, resourceGroup string, log logr.Logger) error
}

AZer is able to perform az cli commands.

type AccountState

type AccountState string
const (
	// Creating means ContainerService resource is being created.
	Enabled  AccountState = "Enabled"
	Disabled AccountState = "Disabled"
)

type AccountStatus

type AccountStatus struct {
	// Name of the subscription.
	Name string `json:"name"`
	// ID of the subscription.
	Id string `json:"id"`
	// IsDefault is true for the default account.
	IsDefault bool `json:"isDefault"`
	// State of the account
	AccountState AccountState `json:"state"`
	// User that is logged in.
	User struct {
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"user"`
}

AccountStatus is a subset of az account status values.

type ProvisioningState

type ProvisioningState string

ProvisioningState represents the current state of container service resource. https://github.com/Azure/aks-engine/blob/master/pkg/api/agentPoolOnlyApi/vlabs/types.go

const (
	// Creating means ContainerService resource is being created.
	Creating ProvisioningState = "Creating"
	// Updating means an existing ContainerService resource is being updated
	Updating ProvisioningState = "Updating"
	// Failed means resource is in failed state
	Failed ProvisioningState = "Failed"
	// Succeeded means resource created succeeded during last create/update
	Succeeded ProvisioningState = "Succeeded"
	// Deleting means resource is in the process of being deleted
	Deleting ProvisioningState = "Deleting"
	// Migrating means resource is being migrated from one subscription or
	// resource group to another
	Migrating ProvisioningState = "Migrating"
)

Jump to

Keyboard shortcuts

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