Version: v0.1.0-alpha.3 Latest Latest

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

Go to latest
Published: Feb 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 0




View Source
const (
	ClusterCA      = "cluster-ca"
	EtcdCA         = "etcd-ca"
	FrontProxyCA   = "front-proxy-ca"
	ServiceAccount = "service-account"


View Source
var (
	DefaultScopeGetter        ScopeGetter        = ScopeGetterFunc(NewScope)
	DefaultMachineScopeGetter MachineScopeGetter = MachineScopeGetterFunc(NewMachineScope)


func GetOrGenerateKeyPair

func GetOrGenerateKeyPair(kp *v1alpha1.KeyPair, user string) ([]byte, []byte, error)

GetOrGenerateKeyPair returns a byte encoded cert and key pair if exists, generates one otherwise


type AzureClients

type AzureClients struct {
	// TODO: Remove legacy clients once interfaces are reimplemented
	Compute   AzureComputeClient
	Network   AzureNetworkClient
	Resources AzureResourcesClient

	// Compute
	VM    compute.VirtualMachinesClient
	Disks compute.DisksClient

	// Network
	VirtualNetworks   network.VirtualNetworksClient
	SecurityGroups    network.SecurityGroupsClient
	Interfaces        network.InterfacesClient
	LB                network.LoadBalancersClient
	PublicIPAddresses network.PublicIPAddressesClient

	// Resources
	Groups      resources.GroupsClient
	Deployments resources.DeploymentsClient
	Tags        resources.TagsClient

AzureClients contains all the Azure clients used by the scopes.

type AzureComputeClient

type AzureComputeClient interface {
	// Virtual Machines Operations
	RunCommand(resoureGroup string, name string, cmd string) (compute.VirtualMachinesRunCommandFuture, error)
	VMIfExists(resourceGroup string, name string) (*compute.VirtualMachine, error)
	DeleteVM(resourceGroup string, name string) (compute.VirtualMachinesDeleteFuture, error)
	WaitForVMRunCommandFuture(future compute.VirtualMachinesRunCommandFuture) error
	WaitForVMDeletionFuture(future compute.VirtualMachinesDeleteFuture) error

	// Disk Operations
	DeleteManagedDisk(resourceGroup string, name string) (compute.DisksDeleteFuture, error)
	WaitForDisksDeleteFuture(future compute.DisksDeleteFuture) error

AzureComputeClient defines the operations that will interact with the Azure Compute API

type AzureNetworkClient

type AzureNetworkClient interface {
	// Network Interfaces Operations
	DeleteNetworkInterface(resourceGroupName string, networkInterfaceName string) (network.InterfacesDeleteFuture, error)
	WaitForNetworkInterfacesDeleteFuture(future network.InterfacesDeleteFuture) error

	// Network Security Groups Operations
	CreateOrUpdateNetworkSecurityGroup(resourceGroupName string, networkSecurityGroupName string, location string) (*network.SecurityGroupsCreateOrUpdateFuture, error)
	NetworkSGIfExists(resourceGroupName string, networkSecurityGroupName string) (*network.SecurityGroup, error)
	WaitForNetworkSGsCreateOrUpdateFuture(future network.SecurityGroupsCreateOrUpdateFuture) error

	// Public Ip Address Operations
	CreateOrUpdatePublicIPAddress(resourceGroupName string, IPName string) (network.PublicIPAddress, error)
	DeletePublicIPAddress(resourceGroup string, IPName string) (network.PublicIPAddressesDeleteFuture, error)
	WaitForPublicIPAddressDeleteFuture(future network.PublicIPAddressesDeleteFuture) error

	// Virtual Networks Operations
	CreateOrUpdateVnet(resourceGroupName string, virtualNetworkName string, location string) (*network.VirtualNetworksCreateOrUpdateFuture, error)
	WaitForVnetCreateOrUpdateFuture(future network.VirtualNetworksCreateOrUpdateFuture) error

AzureNetworkClient defines the operations that will interact with the Azure Network API

type AzureResourcesClient

type AzureResourcesClient interface {
	// Resource Groups Operations
	CreateOrUpdateGroup(resourceGroupName string, location string) (resources.Group, error)
	DeleteGroup(resourceGroupName string) (resources.GroupsDeleteFuture, error)
	CheckGroupExistence(rgName string) (autorest.Response, error)
	WaitForGroupsDeleteFuture(future resources.GroupsDeleteFuture) error

	// Deployment Operations
	CreateOrUpdateDeployment(machine *clusterv1.Machine, clusterConfig *providerv1.AzureClusterProviderSpec, machineConfig *providerv1.AzureMachineProviderSpec, startupScript string) (*resources.DeploymentsCreateOrUpdateFuture, error)
	GetDeploymentResult(future resources.DeploymentsCreateOrUpdateFuture) (de resources.DeploymentExtended, err error)
	ValidateDeployment(machine *clusterv1.Machine, clusterConfig *providerv1.AzureClusterProviderSpec, machineConfig *providerv1.AzureMachineProviderSpec, startupScript string) error
	WaitForDeploymentsCreateOrUpdateFuture(future resources.DeploymentsCreateOrUpdateFuture) error

AzureResourcesClient defines the operations that will interact with the Azure Resources API

type MachineScope

type MachineScope struct {

	Machine       *clusterv1.Machine
	MachineClient client.MachineInterface
	MachineConfig *v1alpha1.AzureMachineProviderSpec
	MachineStatus *v1alpha1.AzureMachineProviderStatus

MachineScope defines a scope defined around a machine and its cluster.

func NewMachineScope

func NewMachineScope(params MachineScopeParams) (*MachineScope, error)

NewMachineScope creates a new MachineScope from the supplied parameters. This is meant to be called for each machine actuator operation.

func (*MachineScope) Close

func (m *MachineScope) Close()

func (*MachineScope) Location

func (m *MachineScope) Location() string

Location returns the machine location.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the machine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the machine namespace.

func (*MachineScope) Role

func (m *MachineScope) Role() string

Role returns the machine role from the labels.

type MachineScopeGetter

type MachineScopeGetter interface {
	GetMachineScope(params MachineScopeParams) (*MachineScope, error)

type MachineScopeGetterFunc

type MachineScopeGetterFunc func(params MachineScopeParams) (*MachineScope, error)

func (MachineScopeGetterFunc) GetMachineScope

func (f MachineScopeGetterFunc) GetMachineScope(params MachineScopeParams) (*MachineScope, error)

type MachineScopeParams

type MachineScopeParams struct {
	Cluster *clusterv1.Cluster
	Machine *clusterv1.Machine
	Client  client.ClusterV1alpha1Interface

MachineScopeParams defines the input parameters used to create a new MachineScope.

type Scope

type Scope struct {
	Cluster       *clusterv1.Cluster
	ClusterClient client.ClusterInterface
	ClusterConfig *v1alpha1.AzureClusterProviderSpec
	ClusterStatus *v1alpha1.AzureClusterProviderStatus
	Context       context.Context

Scope defines the basic context for an actuator to operate upon.

func NewScope

func NewScope(params ScopeParams) (*Scope, error)

NewScope creates a new Scope from the supplied parameters. This is meant to be called for each different actuator iteration.

func (*Scope) Close

func (s *Scope) Close()

Close closes the current scope persisting the cluster configuration and status.

func (*Scope) Location

func (s *Scope) Location() string

Location returns the cluster location.

func (*Scope) Name

func (s *Scope) Name() string

Name returns the cluster name.

func (*Scope) Namespace

func (s *Scope) Namespace() string

Namespace returns the cluster namespace.

func (*Scope) Network

func (s *Scope) Network() *v1alpha1.Network

TODO: Implement scope functions Network returns the cluster network object.

func (*Scope) SecurityGroups

func (s *Scope) SecurityGroups() map[v1alpha1.SecurityGroupRole]*v1alpha1.SecurityGroup

SecurityGroups returns the cluster security groups as a map, it creates the map if empty.

func (*Scope) Subnets

func (s *Scope) Subnets() v1alpha1.Subnets

Subnets returns the cluster subnets.

func (*Scope) Vnet

func (s *Scope) Vnet() *v1alpha1.Vnet

Vnet returns the cluster Vnet.

type ScopeGetter

type ScopeGetter interface {
	GetScope(params ScopeParams) (*Scope, error)

type ScopeGetterFunc

type ScopeGetterFunc func(params ScopeParams) (*Scope, error)

func (ScopeGetterFunc) GetScope

func (f ScopeGetterFunc) GetScope(params ScopeParams) (*Scope, error)

type ScopeParams

type ScopeParams struct {
	Cluster *clusterv1.Cluster
	Client  client.ClusterV1alpha1Interface

ScopeParams defines the input parameters used to create a new Scope.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL