aks

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const EmptyScript = `` /* 260-byte string literal not displayed */

EmptyScript is just used as a placeholder for now NOTE: scripts would need to be ran with /bin/sh and not /bin/bash since Azure CustomScript Extension defaults to it NOTE: scripts should be POSIX compliant (or at the very least work in the Dash shell of Ubuntu

Variables

View Source
var ResourceTemplates map[string]string

ResourceTemplates maps resource names to content of resources implementation specified in code.go

Functions

This section is empty.

Types

type Config

type Config struct {
	ClusterName                   string              `json:"-" yaml:"-" mapstructure:"-"`
	PrivateKey                    string              `json:"private_key,omitempty" yaml:"private_key,omitempty" mapstructure:"private_key"`
	PrivateKeyFile                string              `json:"private_key_file" yaml:"private_key_file" mapstructure:"private_key_file"`
	PublicKey                     string              `json:"public_key,omitempty" yaml:"public_key,omitempty" mapstructure:"public_key"`
	PublicKeyFile                 string              `json:"public_key_file" yaml:"public_key_file" mapstructure:"public_key_file"`
	SubscriptionID                string              `json:"subscription_id,omitempty" yaml:"subscription_id,omitempty" mapstructure:"subscription_id"`
	TenantID                      string              `json:"tenant_id,omitempty" yaml:"tenant_id,omitempty" mapstructure:"tenant_id"`
	ClientID                      string              `json:"client_id,omitempty" yaml:"client_id,omitempty" mapstructure:"client_id"`
	ClientSecret                  string              `json:"client_secret,omitempty" yaml:"client_secret,omitempty" mapstructure:"client_secret"`
	Environment                   string              `json:"environment" yaml:"environment" mapstructure:"environment"`
	ResourceGroupLocation         string              `json:"resource_group_location" yaml:"resource_group_location" mapstructure:"resource_group_location"`
	DNSPrefix                     string              `json:"dns_prefix,omitempty" yaml:"dns_prefix,omitempty" mapstructure:"dns_prefix"`
	ContainerRegistryHost         Registry            `json:"container_registry,omitempty" yaml:"container_registry,omitempty" mapstructure:"container_registry,omitempty"`
	ContainerRegistrySku          string              `json:"container_registry_sku,omitempty" yaml:"container_registry_sku,omitempty" mapstructure:"container_registry_sku"`
	ContainerRegistryAdminEnabled bool                `` /* 147-byte string literal not displayed */
	PreviewFeatures               []PreviewFeature    `json:"preview_features,omitempty" yaml:"preview_features,omitempty" mapstructure:"preview_features,omitempty"`
	VnetName                      string              `json:"vnet_name" yaml:"vnet_name" mapstructure:"vnet_name"`
	VnetResourceGroupName         string              `json:"vnet_resource_group_name" yaml:"vnet_resource_group_name" mapstructure:"vnet_resource_group_name"`
	VnetAddressSpace              string              `json:"vnet_address_space" yaml:"vnet_address_space" mapstructure:"vnet_address_space"`
	SubnetAddressPrefix           string              `json:"subnet_address_prefix" yaml:"subnet_address_prefix" mapstructure:"subnet_address_prefix"`
	PrivateDNSZoneName            string              `json:"private_dns_zone_name" yaml:"private_dns_zone_name" mapstructure:"private_dns_zone_name"`
	ServiceCIDR                   string              `json:"service_cidr" yaml:"service_cidr" mapstructure:"service_cidr"`
	DockerBridgeCIDR              string              `json:"docker_bridge_cidr" yaml:"docker_bridge_cidr" mapstructure:"docker_bridge_cidr"`
	DNSServiceIP                  string              `json:"dns_service_ip" yaml:"dns_service_ip" mapstructure:"dns_service_ip"`
	KubernetesVersion             string              `json:"kubernetes_version" yaml:"kubernetes_version" mapstructure:"kubernetes_version"`
	AdminUsername                 string              `json:"admin_username" yaml:"admin_username" mapstructure:"admin_username"`
	NetworkPolicy                 string              `json:"network_policy" yaml:"network_policy" mapstructure:"network_policy"`
	EnablePodSecurityPolicy       bool                `json:"enable_pod_security_policy" yaml:"enable_pod_security_policy" mapstructure:"enable_pod_security_policy"`
	ClusterClientID               string              `json:"cluster_client_id" yaml:"cluster_client_id" mapstructure:"cluster_client_id"`
	ClusterClientSecret           string              `json:"cluster_client_secret" yaml:"cluster_client_secret" mapstructure:"cluster_client_secret"`
	DefaultNodePool               NodePool            `json:"default_node_pool" yaml:"default_node_pool" mapstructure:"default_node_pool"`
	NodePools                     map[string]NodePool `json:"node_pools" yaml:"node_pools" mapstructure:"node_pools"`
	Jumpbox                       *Jumpbox            `json:"jumpbox,omitempty" yaml:"jumpbox,omitempty" mapstructure:"jumpbox"`
}

Config defines the Azure AKS configuration parameters in the Cluster config file

func NewConfigFrom

func NewConfigFrom(m map[interface{}]interface{}) *Config

NewConfigFrom returns a new AKS configuration from a map, usually from a cluster config file

func (*Config) MergeNodePools

func (c *Config) MergeNodePools(nodePoolsEnvConf map[string]string)

MergeNodePools merges the node pools in this configuration with the given environment configuration for node pools

func (*Config) MergeWithEnv

func (c *Config) MergeWithEnv(envConf map[string]string, conf ...Config) error

MergeWithEnv merges this configuration with the given configuration in a map[string]string, usually from environment variables

func (*Config) MergeWithMapConfig

func (c *Config) MergeWithMapConfig(m map[interface{}]interface{})

MergeWithMapConfig merges this configuration with the given configuration in a map[string], usually from a cluster config file

type DataDisk

type DataDisk struct {
	MountPoint string `json:"mount_point" yaml:"mount_point" mapstructure:"mount_point"`
	VolumeSize int    `json:"volume_size" yaml:"volume_size" mapstructure:"volume_size"`
}

DataDisk defines the disk information

type Jumpbox

type Jumpbox struct {
	AdminUsername   string    `json:"admin_username" yaml:"admin_username" mapstructure:"admin_username"`
	PrivateKey      string    `json:"-" yaml:"-" mapstructure:"-"`
	PrivateKeyFile  string    `json:"private_key_file" yaml:"private_key_file" mapstructure:"private_key_file"`
	PublicKey       string    `json:"public_key,omitempty" yaml:"public_key,omitempty" mapstructure:"public_key"`
	PublicKeyFile   string    `json:"public_key_file" yaml:"public_key_file" mapstructure:"public_key_file"`
	VMSize          string    `json:"vm_size" yaml:"vm_size" mapstructure:"vm_size"`
	RootVolumeSize  int       `json:"root_volume_size" yaml:"root_volume_size" mapstructure:"root_volume_size"`
	EnablePublicIP  bool      `json:"enable_public_ip" yaml:"enable_public_ip" mapstructure:"enable_public_ip"`
	TimeoutMinutes  int       `json:"timeout_minutes" yaml:"timeout_minutes" mapstructure:"timeout_minutes"`
	UploadKubeconfg bool      `json:"upload_kubeconfig" yaml:"upload_kubeconfig" mapstructure:"upload_kubeconfig"`
	NSGRules        []NSGRule `` /* 135-byte string literal not displayed */
	Commands        []string  `json:"commands,omitempty" yaml:"commands,omitempty" mapstructure:"commands"`
	FileUploads     []string  `json:"file_uploads,omitempty" yaml:"file_uploads,omitempty" mapstructure:"file_uploads"`
	UbuntuServerSku string    `json:"ubuntu_server_sku" yaml:"ubuntu_server_sku" mapstructure:"ubuntu_server_sku"`
}

Jumpbox contains information needed when creating a jumpbox to the cluster

type NSGRule

type NSGRule struct {
	Name                     string `json:"name" yaml:"name" mapstructure:"name"`
	Priority                 int    `json:"priority" yaml:"priority" mapstructure:"priority"`
	Direction                string `json:"direction" yaml:"direction" mapstructure:"direction"`
	Access                   string `json:"access" yaml:"access" mapstructure:"access"`
	Protocol                 string `json:"protocol" yaml:"protocol" mapstructure:"protocol"`
	SourcePortRange          string `json:"source_port_range" yaml:"source_port_range" mapstructure:"source_port_range"`
	DestinationPortRange     string `json:"destination_port_range" yaml:"destination_port_range" mapstructure:"destination_port_range"`
	SourceAddressPrefix      string `json:"source_address_prefix" yaml:"source_address_prefix" mapstructure:"source_address_prefix"`
	DestinationAddressPrefix string `json:"destination_address_prefix" yaml:"destination_address_prefix" mapstructure:"destination_address_prefix"`
}

NSGRule defines the network security group rule to be added

type NodePool

type NodePool struct {
	Name                string      `json:"-" yaml:"-" mapstructure:"-"`
	Count               int         `json:"count,omitempty" yaml:"count,omitempty" mapstructure:"count"`
	VMSize              string      `json:"vm_size" yaml:"vm_size" mapstructure:"vm_size"`
	RootVolumeSize      int         `json:"root_volume_size" yaml:"root_volume_size" mapstructure:"root_volume_size"`
	MaxPods             int         `json:"max_pods" yaml:"max_pods" mapstructure:"max_pods"`
	Type                string      `json:"type" yaml:"type" mapstructure:"type"`
	EphemeralMountPoint string      `json:"ephemeral_mount_point,omitempty" yaml:"ephemeral_mount_point,omitempty" mapstructure:"ephemeral_mount_point,omitempty"`
	DockerRoot          string      `json:"docker_root,omitempty" yaml:"docker_root,omitempty" mapstructure:"docker_root"`
	DataDisks           *[]DataDisk `json:"data_disks,omitempty" yaml:"data_disks,omitempty" mapstructure:"data_disks,omitempty"`

	AvailabilityZones   []string `json:"availability_zones,omitempty" yaml:"availability_zones,omitempty" mapstructure:"availability_zones,omitempty"`
	NodeTaints          []string `json:"node_taints,omitempty" yaml:"node_taints,omitempty" mapstructure:"node_taints"`
	EnableAutoScaling   bool     `json:"enable_auto_scaling,omitempty" yaml:"enable_auto_scaling,omitempty" mapstructure:"enable_auto_scaling"`
	AutoScalingMinCount int      `json:"auto_scaling_min_count,omitempty" yaml:"auto_scaling_min_count,omitempty" mapstructure:"auto_scaling_min_count"`
	AutoScalingMaxCount int      `json:"auto_scaling_max_count,omitempty" yaml:"auto_scaling_max_count,omitempty" mapstructure:"auto_scaling_max_count"`
}

NodePool defines the settings for group of instances on Azure AKS

type Platform

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

Platform implements the Provisioner interface for Azure AKS

func CreateFrom

func CreateFrom(clusterName string, config map[interface{}]interface{}, credentials []string, ui *ui.UI, version string) *Platform

CreateFrom creates a new Platform with the given configuration for Azure AKS

func New

func New(clusterName string, envConfig map[string]string, ui *ui.UI, version string) (*Platform, error)

New creates a new Plaform with the given environment configuration

func (*Platform) Address

func (p *Platform) Address() string

Address returns the address to access the Kubernetes cluster

func (*Platform) Apply

func (p *Platform) Apply(destroy bool) error

Apply apply the changes either to create or destroy the cluster on this platform

func (*Platform) BeProvisioner

func (p *Platform) BeProvisioner(state *terraformer.State) error

BeProvisioner setup the Plaftorm to be a Provisioner

func (*Platform) Code

func (p *Platform) Code() []byte

Code returns the Terraform code to execute

func (*Platform) Config

func (p *Platform) Config() interface{}

Config returns the default configuration for Azure AKS

func (*Platform) Credentials

func (p *Platform) Credentials(params ...string)

Credentials is to assign the credentials to the configuration

func (*Platform) GetPrivateKey

func (p *Platform) GetPrivateKey() (string, []byte, bool)

GetPrivateKey returns the private key and file from the configuration, also if this platform requires a private key for provisioning

func (*Platform) GetPublicKey

func (p *Platform) GetPublicKey() (string, []byte, bool)

GetPublicKey return the public key and file from the configuration, also if this platform requires a public key for provisioning

func (*Platform) LoadState

func (p *Platform) LoadState(stateBuffer *bytes.Buffer) error

LoadState loads the given Terraform state in a buffer into the terraformer state

func (*Platform) MergeWithEnv

func (p *Platform) MergeWithEnv(envConfig map[string]string) error

MergeWithEnv implements the MergeWithEnv method from the interfase Provisioner. It merges the environment variables with the existing configuration

func (*Platform) Name

func (p *Platform) Name() string

Name returns the platform name

func (*Platform) Nodes

func (p *Platform) Nodes() []*state.Node

Nodes return the list of nodes provisioned. It took the value from the

func (*Platform) Output

func (p *Platform) Output(name string) string

Output returns a value from the terraform output

func (*Platform) Plan

func (p *Platform) Plan(destroy bool) (plan *terraformer.Plan, err error)

Plan do the planning of the changes either to create or destroy the cluster on this platform.

func (*Platform) Port

func (p *Platform) Port() int

Port returns the port to access the Kubernetes cluster

func (*Platform) PostApply

func (p *Platform) PostApply(destroy bool) error

PostApply applies changes after the changes done in the Apply method

func (*Platform) PreApply

func (p *Platform) PreApply(destroy bool) error

PreApply applies changes before the changes done in the Apply method

func (*Platform) PrivateKey

func (p *Platform) PrivateKey(file string, encKey, key []byte)

PrivateKey sets the private key and file in the configuration

func (*Platform) Provision

func (p *Platform) Provision() error

Provision provisions or creates a cluster on this platform

func (*Platform) PublicKey

func (p *Platform) PublicKey(file string, key []byte)

PublicKey sets the public key and file in the configuration and variables

func (*Platform) State

func (p *Platform) State() *terraformer.State

State returns the current Terraform state of the cluster

func (*Platform) Terminate

func (p *Platform) Terminate() error

Terminate terminates or destroys a cluster on this platform

func (*Platform) Variables

func (p *Platform) Variables() map[string]interface{}

Variables returns the variables as a map where the key is the variable name

type PreviewFeature

type PreviewFeature struct {
	Namespace string `json:"namespace" yaml:"namespace" mapstructure:"namespace"`
	Name      string `json:"name" yaml:"name" mapstructure:"name"`
}

PreviewFeature represents the preview feature information when enabling such

type Registry

type Registry struct {
	Host     string `json:"host" yaml:"host" mapstructure:"host"`
	Username string `json:"username" yaml:"username" mapstructure:"username"`
	Password string `json:"password" yaml:"password" mapstructure:"password"`
}

Registry represents the ACR login info

Jump to

Keyboard shortcuts

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