azure

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright The Pharmer Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SecurityGroupBastion defines an SSH bastion role
	SecurityGroupBastion = SecurityGroupRole("bastion")

	// SecurityGroupNode defines a Kubernetes workload node role
	SecurityGroupNode = SecurityGroupRole("node")

	// SecurityGroupControlPlane defines a Kubernetes control plane node role
	SecurityGroupControlPlane = SecurityGroupRole("controlplane")
)
View Source
var (
	// SecurityGroupProtocolAll is a wildcard for all IP protocols
	SecurityGroupProtocolAll = SecurityGroupProtocol("*")

	// SecurityGroupProtocolTCP represents the TCP protocol in ingress rules
	SecurityGroupProtocolTCP = SecurityGroupProtocol("Tcp")

	// SecurityGroupProtocolUDP represents the UDP protocol in ingress rules
	SecurityGroupProtocolUDP = SecurityGroupProtocol("Udp")
)
View Source
var (
	SKUBasic    = SKU("Basic")
	SKUStandard = SKU("Standard")
)
View Source
var (
	// LoadBalancerProtocolTCP defines the LB API string representing the TCP protocol
	LoadBalancerProtocolTCP = LoadBalancerProtocol("TCP")

	// LoadBalancerProtocolSSL defines the LB API string representing the TLS protocol
	LoadBalancerProtocolSSL = LoadBalancerProtocol("SSL")

	// LoadBalancerProtocolHTTP defines the LB API string representing the HTTP protocol at L7
	LoadBalancerProtocolHTTP = LoadBalancerProtocol("HTTP")

	// LoadBalancerProtocolHTTPS defines the LB API string representing the HTTP protocol at L7
	LoadBalancerProtocolHTTPS = LoadBalancerProtocol("HTTPS")
)

TODO

View Source
var (
	// VMStateCreating ...
	VMStateCreating = VMState("Creating")
	// VMStateDeleting ...
	VMStateDeleting = VMState("Deleting")
	// VMStateFailed ...
	VMStateFailed = VMState("Failed")
	// VMStateMigrating ...
	VMStateMigrating = VMState("Migrating")
	// VMStateSucceeded ...
	VMStateSucceeded = VMState("Succeeded")
	// VMStateUpdating ...
	VMStateUpdating = VMState("Updating")
)

Functions

func EncodeClusterSpec

func EncodeClusterSpec(spec *AzureClusterProviderSpec) (*runtime.RawExtension, error)

EncodeClusterSpec marshals the cluster provider spec.

func EncodeClusterStatus

func EncodeClusterStatus(status *AzureClusterProviderStatus) (*runtime.RawExtension, error)

EncodeClusterStatus marshals the cluster status.

func EncodeMachineSpec

func EncodeMachineSpec(spec *AzureMachineProviderSpec) (*runtime.RawExtension, error)

EncodeMachineSpec marshals the machine provider spec.

func EncodeMachineStatus

func EncodeMachineStatus(status *AzureMachineProviderStatus) (*runtime.RawExtension, error)

EncodeMachineStatus marshals the machine status

Types

type AzureClusterProviderSpec

type AzureClusterProviderSpec struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// NetworkSpec encapsulates all things related to Azure network.
	NetworkSpec NetworkSpec `json:"networkSpec,omitempty"`

	ResourceGroup string `json:"resourceGroup"`
	Location      string `json:"location"`

	// SSHPublicKey is the ssh public key for the bastion host
	SSHPublicKey string `json:"sshPublicKey"`
	// SSHPrivateKey is the ssh private key for the bastion host
	SSHPrivateKey string `json:"sshPrivateKey"`

	// CAKeyPair is the key pair for CA certs.
	CAKeyPair KeyPair `json:"caKeyPair,omitempty"`

	// EtcdCAKeyPair is the key pair for etcd.
	EtcdCAKeyPair KeyPair `json:"etcdCAKeyPair,omitempty"`

	// FrontProxyCAKeyPair is the key pair for the front proxy.
	FrontProxyCAKeyPair KeyPair `json:"frontProxyCAKeyPair,omitempty"`

	// SAKeyPair is the service account key pair.
	SAKeyPair KeyPair `json:"saKeyPair,omitempty"`

	// AdminKubeconfig generated using the certificates part of the spec
	// do not move to status, since it uses on disk ca certs, which causes issues during regeneration
	AdminKubeconfig string `json:"adminKubeconfig,omitempty"`

	// DiscoveryHashes generated using the certificates part of the spec, used by master and nodes bootstrapping
	// this never changes until ca is rotated
	// do not move to status, since it uses on disk ca certs, which causes issues during regeneration
	DiscoveryHashes []string `json:"discoveryHashes,omitempty"`

	// ClusterConfiguration holds the cluster-wide information used during a
	// kubeadm init call.
	ClusterConfiguration kubeadmv1beta1.ClusterConfiguration `json:"clusterConfiguration,omitempty"`
}

AzureClusterProviderSpec is the providerConfig for Azure in the cluster. +k8s:openapi-gen=true

func ClusterConfigFromProviderSpec

func ClusterConfigFromProviderSpec(providerConfig clusterapi.ProviderSpec) (*AzureClusterProviderSpec, error)

ClusterConfigFromProviderSpec unmarshals a provider config into an Azure Cluster type

type AzureClusterProviderStatus

type AzureClusterProviderStatus struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Network Network `json:"network,omitempty"`
	Bastion VM      `json:"bastion,omitempty"`
}

AzureClusterProviderStatus contains the status fields relevant to Azure in the cluster object. +k8s:openapi-gen=true

func ClusterStatusFromProviderStatus

func ClusterStatusFromProviderStatus(extension *runtime.RawExtension) (*AzureClusterProviderStatus, error)

ClusterStatusFromProviderStatus unmarshals a raw extension into an Azure Cluster type

type AzureMachineProviderCondition

type AzureMachineProviderCondition struct {
	// Type is the type of the condition.
	Type AzureMachineProviderConditionType `json:"type"`
	// Status is the status of the condition.
	Status corev1.ConditionStatus `json:"status"`
	// LastProbeTime is the last time we probed the condition.
	// +optional
	LastProbeTime metav1.Time `json:"lastProbeTime"`
	// LastTransitionTime is the last time the condition transitioned from one status to another.
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	// Reason is a unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason"`
	// Message is a human-readable message indicating details about last transition.
	// +optional
	Message string `json:"message"`
}

AzureMachineProviderCondition is a condition in a AzureMachineProviderStatus

type AzureMachineProviderConditionType

type AzureMachineProviderConditionType string

AzureMachineProviderConditionType is a valid value for AzureMachineProviderCondition.Type

const (
	// MachineCreated indicates whether the machine has been created or not. If not,
	// it should include a reason and message for the failure.
	MachineCreated AzureMachineProviderConditionType = "MachineCreated"
)

Valid conditions for an Azure machine instance

type AzureMachineProviderSpec

type AzureMachineProviderSpec struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Roles         []MachineRole `json:"roles,omitempty"`
	Location      string        `json:"location"`
	VMSize        string        `json:"vmSize"`
	Image         Image         `json:"image"`
	OSDisk        OSDisk        `json:"osDisk"`
	SSHPublicKey  string        `json:"sshPublicKey"`
	SSHPrivateKey string        `json:"sshPrivateKey"`
}

AzureMachineProviderSpec is the Schema for the azuremachineproviderspecs API +k8s:openapi-gen=true

func MachineSpecFromProviderSpec

func MachineSpecFromProviderSpec(providerConfig clusterapi.ProviderSpec) (*AzureMachineProviderSpec, error)

MachineSpecFromClusterSpec unmarslalls a provider config into Azure Machine type

type AzureMachineProviderStatus

type AzureMachineProviderStatus struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// VMID is the instance ID of the machine created in Azure.
	// +optional
	VMID *string `json:"vmId,omitempty"`

	// VMState is the state of the Azure instance for this machine.
	// +optional
	VMState *string `json:"instanceState,omitempty"`

	// Conditions is a set of conditions associated with the Machine to indicate
	// errors or other status.
	// +optional
	Conditions []AzureMachineProviderCondition `json:"conditions,omitempty"`
}

AzureMachineProviderStatus is the type that will be embedded in a Machine.Status.ProviderStatus field. It contains Azure-specific status information. +k8s:openapi-gen=true

func MachineStatusFromProviderStatus

func MachineStatusFromProviderStatus(extension *runtime.RawExtension) (*AzureMachineProviderStatus, error)

MachineStatusFromProviderStatus unmarshals a raw extension into an Azure machine type

type AzureResourceReference

type AzureResourceReference struct {
	// ID of resource
	// +optional
	ID *string `json:"id,omitempty"`
}

AzureResourceReference is a reference to a specific Azure resource by ID

type BackendPool

type BackendPool struct {
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`
}

type FrontendIPConfig

type FrontendIPConfig struct {
}

type Image

type Image struct {
	Publisher string `json:"publisher"`
	Offer     string `json:"offer"`
	SKU       string `json:"sku"`
	Version   string `json:"version"`
}

type IngressRule

type IngressRule struct {
	Description string                `json:"description"`
	Protocol    SecurityGroupProtocol `json:"protocol"`

	// SourcePorts - The source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports.
	SourcePorts *string `json:"sourcePorts,omitempty"`

	// DestinationPorts - The destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports.
	DestinationPorts *string `json:"destinationPorts,omitempty"`

	// Source - The CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.
	Source *string `json:"source,omitempty"`

	// Destination - The destination address prefix. CIDR or destination IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.
	Destination *string `json:"destination,omitempty"`
}

TODO IngressRule defines an Azure ingress rule for security groups.

type IngressRules

type IngressRules []*IngressRule

TODO IngressRules is a slice of Azure ingress rules for security groups.

type KeyPair

type KeyPair struct {
	// base64 encoded cert and key
	Cert []byte `json:"cert"`
	Key  []byte `json:"key"`
}

KeyPair is how operators can supply custom keypairs for kubeadm to use.

func (*KeyPair) HasCertAndKey

func (kp *KeyPair) HasCertAndKey() bool

HasCertAndKey returns whether a keypair contains cert and key of non-zero length.

type LoadBalancer

type LoadBalancer struct {
	ID               string           `json:"id,omitempty"`
	Name             string           `json:"name,omitempty"`
	SKU              SKU              `json:"sku,omitempty"`
	FrontendIPConfig FrontendIPConfig `json:"frontendIpConfig,omitempty"`
	BackendPool      BackendPool      `json:"backendPool,omitempty"`
	Tags             Tags             `json:"tags,omitempty"`
}

TODO LoadBalancer defines an Azure load balancer.

type LoadBalancerHealthCheck

type LoadBalancerHealthCheck struct {
	Target             string        `json:"target"`
	Interval           time.Duration `json:"interval"`
	Timeout            time.Duration `json:"timeout"`
	HealthyThreshold   int64         `json:"healthyThreshold"`
	UnhealthyThreshold int64         `json:"unhealthyThreshold"`
}

TODO LoadBalancerHealthCheck defines an Azure load balancer health check.

type LoadBalancerListener

type LoadBalancerListener struct {
	Protocol         LoadBalancerProtocol `json:"protocol"`
	Port             int64                `json:"port"`
	InstanceProtocol LoadBalancerProtocol `json:"instanceProtocol"`
	InstancePort     int64                `json:"instancePort"`
}

TODO LoadBalancerListener defines an Azure load balancer listener.

type LoadBalancerProtocol

type LoadBalancerProtocol string

TODO LoadBalancerProtocol defines listener protocols for a load balancer.

type MachineRole

type MachineRole string
const (
	// TODO: Change references to "controlplane", instead of "Master" and lowercase both roles.
	Master MachineRole = "Master"
	Node   MachineRole = "Node"
)

type ManagedDisk

type ManagedDisk struct {
	StorageAccountType string `json:"storageAccountType"`
}

type Network

type Network struct {
	// Vnet defines the cluster vnet.
	Vnet Vnet `json:"vnet,omitempty"`

	// SecurityGroups is a map from the role/kind of the security group to its unique name, if any.
	SecurityGroups map[SecurityGroupRole]*SecurityGroup `json:"securityGroups,omitempty"`

	// Subnets includes all the subnets defined inside the Vnet.
	Subnets Subnets `json:"subnets,omitempty"`

	// APIServerLB is the Kubernetes API server load balancer.
	APIServerLB LoadBalancer `json:"apiServerLb,omitempty"`

	// APIServerIP is the Kubernetes API server public IP address.
	APIServerIP PublicIP `json:"apiServerIp,omitempty"`
}

Network encapsulates Azure networking resources.

type NetworkSpec

type NetworkSpec struct {
	// Vnet configuration.
	// +optional
	Vnet VnetSpec `json:"vnet,omitempty"`

	// Subnets configuration.
	// +optional
	Subnets Subnets `json:"subnets,omitempty"`
}

NetworkSpec encapsulates all things related to Azure network.

type OSDisk

type OSDisk struct {
	OSType      string      `json:"osType"`
	ManagedDisk ManagedDisk `json:"managedDisk"`
	DiskSizeGB  int32       `json:"diskSizeGB"`
}

type PublicIP

type PublicIP struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	IPAddress string `json:"ipAddress,omitempty"`
	DNSName   string `json:"dnsName,omitempty"`
}

PublicIP defines an Azure public IP address. TODO: Remove once load balancer is implemented.

type SKU

type SKU string

LoadBalancerSKU enumerates the values for load balancer sku name.

type SecurityGroup

type SecurityGroup struct {
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	IngressRules IngressRules `json:"ingressRule"`
	Tags         *Tags        `json:"tags"`
}

SecurityGroup defines an Azure security group.

type SecurityGroupProtocol

type SecurityGroupProtocol string

SecurityGroupProtocol defines the protocol type for a security group rule.

type SecurityGroupRole

type SecurityGroupRole string

SecurityGroupRole defines the unique role of a security group.

type Subnet

type Subnet struct {
	ID            string        `json:"id,omitempty"`
	Name          string        `json:"name"`
	VnetID        string        `json:"vnetId"`
	CidrBlock     string        `json:"cidrBlock"`
	SecurityGroup SecurityGroup `json:"securityGroup"`
}

Subnet defines an Azure subnet attached to a Vnet.

type SubnetSpec

type SubnetSpec struct {
	// ID defines a unique identifier to reference this resource.
	ID string `json:"id,omitempty"`

	// Name defines a name for the subnet resource.
	Name string `json:"name"`

	// VnetID defines the ID of the virtual network this subnet should be built in.
	VnetID string `json:"vnetId"`

	// CidrBlock is the CIDR block to be used when the provider creates a managed Vnet.
	CidrBlock string `json:"cidrBlock,omitempty"`

	// SecurityGroup defines the NSG (network security group) that should be attached to this subnet.
	SecurityGroup SecurityGroup `json:"securityGroup"`
}

SubnetSpec configures an Azure subnet.

type Subnets

type Subnets []*Subnet

Subnets is a slice of Subnet.

func (Subnets) ToMap

func (s Subnets) ToMap() map[string]*Subnet

TODO ToMap returns a map from id to subnet.

type Tags

type Tags map[string]*string

Tags defines resource tags.

type VM

type VM struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`

	// Hardware profile
	VMSize string `json:"vmSize,omitempty"`

	// Storage profile
	Image  Image  `json:"image,omitempty"`
	OSDisk OSDisk `json:"osDisk,omitempty"`

	StartupScript string `json:"startupScript,omitempty"`

	// State - The provisioning state, which only appears in the response.
	State    VMState    `json:"vmState,omitempty"`
	Identity VMIdentity `json:"identity,omitempty"`

	Tags Tags `json:"tags,omitempty"`
}

VM describes an Azure virtual machine.

type VMIdentity

type VMIdentity string

VMIdentity defines the identity of the virtual machine, if configured.

type VMState

type VMState string

VMState describes the state of an Azure virtual machine.

type Vnet

type Vnet struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	CidrBlock string `json:"cidrBlock"`
	Tags      *Tags  `json:"tags"`
}

Vnet defines an Azure Virtual Network.

type VnetSpec

type VnetSpec struct {
	// ID is the identifier of the virtual network this provider should use to create resources.
	ID string `json:"id,omitempty"`

	// Name defines a name for the virtual network resource.
	Name string `json:"name"`

	// CidrBlock is the CIDR block to be used when the provider creates a managed virtual network.
	CidrBlock string `json:"cidrBlock,omitempty"`
}

VnetSpec configures an Azure virtual network.

Jump to

Keyboard shortcuts

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