acsengine

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package acsengine takes an ACS cluster model and generates the corresponding template

Index

Constants

View Source
const (
	// DefaultFirstConsecutiveStaticIP specifies the static IP address on master 0 for DCOS or Swarm
	DefaultFirstConsecutiveStaticIP = "172.16.0.5"
	// DefaultDCOSMasterSubnet specifies the default master subnet for a DCOS cluster
	DefaultDCOSMasterSubnet = "192.168.255.0/24"
	// DefaultDCOSFirstConsecutiveStaticIP  specifies the static IP address on master 0 for a DCOS cluster
	DefaultDCOSFirstConsecutiveStaticIP = "192.168.255.5"
	// DefaultDCOSBootstrapStaticIP specifies the static IP address on bootstrap for a DCOS cluster
	DefaultDCOSBootstrapStaticIP = "192.168.255.240"
	// DefaultDCOSWindowsBootstrapStaticIP specifies the static IP address on Windows bootstrap for a DCOS cluster
	DefaultDCOSWindowsBootstrapStaticIP = "192.168.255.241"
	// DefaultDockerBridgeSubnet specifies the default subnet for the docker bridge network for masters and agents.
	DefaultDockerBridgeSubnet = "172.17.0.1/16"
	// DefaultAgentSubnetTemplate specifies a default agent subnet
	DefaultAgentSubnetTemplate = "10.%d.0.0/16"
	// DefaultContainerRuntime is docker
	DefaultContainerRuntime = "docker"
	// DefaultGeneratorCode specifies the source generator of the cluster template.
	DefaultGeneratorCode = "dcos-engine"
	// DefaultOrchestratorName specifies the 3 character orchestrator code of the cluster template and affects resource naming.
	DefaultOrchestratorName = "dcos"
	// DefaultWindowsDockerVersion specifies default docker version installed on Windows nodes
	DefaultWindowsDockerVersion = "18.03.1-ee-3"
	// DefaultBootstrapVMSize specifies default bootstrap VM size
	DefaultBootstrapVMSize = "Standard_D2s_v3"
	// DefaultWindowsBootstrapVMSize specifies default Windows bootstrap VM size
	DefaultWindowsBootstrapVMSize = "Standard_D4s_v3"
)
View Source
const (
	//DefaultExtensionsRootURL  Root URL for extensions
	DefaultExtensionsRootURL = "https://raw.githubusercontent.com/Azure/dcos-engine/master/"
	// DefaultDockerEngineRepo for grabbing docker engine packages
	DefaultDockerEngineRepo = "https://download.docker.com/linux/ubuntu"
	// DefaultDockerComposeURL for grabbing docker images
	DefaultDockerComposeURL = "https://github.com/docker/compose/releases/download"

	//AzureEdgeDCOSBootstrapDownloadURL is the azure edge CDN download url
	AzureEdgeDCOSBootstrapDownloadURL = "https://dcosio.azureedge.net/dcos/%s/bootstrap/%s.bootstrap.tar.xz"
	//AzureChinaCloudDCOSBootstrapDownloadURL is the China specific DCOS package download url.
	AzureChinaCloudDCOSBootstrapDownloadURL = "https://acsengine.blob.core.chinacloudapi.cn/dcos/%s.bootstrap.tar.xz"
)
View Source
const (
	// AzureCniPluginVer specifies version of Azure CNI plugin, which has been mirrored from
	// https://github.com/Azure/azure-container-networking/releases/download/${AZURE_PLUGIN_VER}/azure-vnet-cni-linux-amd64-${AZURE_PLUGIN_VER}.tgz
	// to https://acs-mirror.azureedge.net/cni/
	AzureCniPluginVer = "v1.0.6"
	// CNIPluginVer specifies the version of CNI implementation
	// https://github.com/containernetworking/plugins
	CNIPluginVer = "v0.7.0"
)
View Source
const (
	// ValidityDuration specifies the duration an TLS certificate is valid
	ValidityDuration = time.Hour * 24 * 365 * 2
	// PkiKeySize is the size in bytes of the PKI key
	PkiKeySize = 4096
)

Variables

View Source
var (
	//DefaultDockerSpecConfig is the default Docker engine repo.
	DefaultDockerSpecConfig = DockerSpecConfig{
		DockerEngineRepo:         "https://aptdocker.azureedge.net/repo",
		DockerComposeDownloadURL: "https://github.com/docker/compose/releases/download",
	}

	//DefaultUbuntuImageConfig is the default Linux distribution.
	DefaultUbuntuImageConfig = AzureOSImageConfig{
		ImageOffer:     "UbuntuServer",
		ImageSku:       "16.04-LTS",
		ImagePublisher: "Canonical",
		ImageVersion:   "16.04.201807030",
	}

	//DefaultRHELOSImageConfig is the RHEL Linux distribution.
	DefaultRHELOSImageConfig = AzureOSImageConfig{
		ImageOffer:     "RHEL",
		ImageSku:       "7.3",
		ImagePublisher: "RedHat",
		ImageVersion:   "latest",
	}

	//DefaultCoreOSImageConfig is the CoreOS Linux distribution.
	DefaultCoreOSImageConfig = AzureOSImageConfig{
		ImageOffer:     "CoreOS",
		ImageSku:       "Stable",
		ImagePublisher: "CoreOS",
		ImageVersion:   "latest",
	}

	//AzureCloudSpec is the default configurations for global azure.
	AzureCloudSpec = AzureEnvironmentSpecConfig{

		DockerSpecConfig: DefaultDockerSpecConfig,

		EndpointConfig: AzureEndpointConfig{
			ResourceManagerVMDNSSuffix: "cloudapp.azure.com",
		},

		OSImageConfig: map[api.Distro]AzureOSImageConfig{
			api.Ubuntu: DefaultUbuntuImageConfig,
			api.RHEL:   DefaultRHELOSImageConfig,
			api.CoreOS: DefaultCoreOSImageConfig,
		},
	}

	//AzureGermanCloudSpec is the German cloud config.
	AzureGermanCloudSpec = AzureEnvironmentSpecConfig{
		DockerSpecConfig: DefaultDockerSpecConfig,
		EndpointConfig: AzureEndpointConfig{
			ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de",
		},
		OSImageConfig: map[api.Distro]AzureOSImageConfig{
			api.Ubuntu: {
				ImageOffer:     "UbuntuServer",
				ImageSku:       "16.04-LTS",
				ImagePublisher: "Canonical",
				ImageVersion:   "latest",
			},
			api.RHEL:   DefaultRHELOSImageConfig,
			api.CoreOS: DefaultCoreOSImageConfig,
		},
	}

	//AzureUSGovernmentCloud is the US government config.
	AzureUSGovernmentCloud = AzureEnvironmentSpecConfig{
		DockerSpecConfig: DefaultDockerSpecConfig,
		EndpointConfig: AzureEndpointConfig{
			ResourceManagerVMDNSSuffix: "cloudapp.usgovcloudapi.net",
		},
		OSImageConfig: map[api.Distro]AzureOSImageConfig{
			api.Ubuntu: {
				ImageOffer:     "UbuntuServer",
				ImageSku:       "16.04-LTS",
				ImagePublisher: "Canonical",
				ImageVersion:   "latest",
			},
			api.RHEL:   DefaultRHELOSImageConfig,
			api.CoreOS: DefaultCoreOSImageConfig,
		},
	}

	//AzureChinaCloudSpec is the configurations for Azure China (Mooncake)
	AzureChinaCloudSpec = AzureEnvironmentSpecConfig{

		DockerSpecConfig: DockerSpecConfig{
			DockerEngineRepo:         "https://mirror.azure.cn/docker-engine/apt/repo/",
			DockerComposeDownloadURL: "https://mirror.azure.cn/docker-toolbox/linux/compose",
		},

		EndpointConfig: AzureEndpointConfig{
			ResourceManagerVMDNSSuffix: "cloudapp.chinacloudapi.cn",
		},
		OSImageConfig: map[api.Distro]AzureOSImageConfig{
			api.Ubuntu: {
				ImageOffer:     "UbuntuServer",
				ImageSku:       "16.04-LTS",
				ImagePublisher: "Canonical",
				ImageVersion:   "latest",
			},
			api.RHEL:   DefaultRHELOSImageConfig,
			api.CoreOS: DefaultCoreOSImageConfig,
		},
	}
)
View Source
var AzureLocations = []string{
	"australiacentral",
	"australiacentral2",
	"australiaeast",
	"australiasoutheast",
	"brazilsouth",
	"canadacentral",
	"canadaeast",
	"centralindia",
	"centralus",
	"centraluseuap",
	"chinaeast",
	"chinaeast2",
	"chinanorth",
	"chinanorth2",
	"eastasia",
	"eastus",
	"eastus2",
	"eastus2euap",
	"francecentral",
	"francesouth",
	"japaneast",
	"japanwest",
	"koreacentral",
	"koreasouth",
	"northcentralus",
	"northeurope",
	"southcentralus",
	"southeastasia",
	"southindia",
	"uksouth",
	"ukwest",
	"westcentralus",
	"westeurope",
	"westindia",
	"westus",
	"westus2",
	"chinaeast",
	"chinanorth",
	"chinanorth2",
	"chinaeast2",
	"germanycentral",
	"germanynortheast",
	"usgovvirginia",
	"usgoviowa",
	"usgovarizona",
	"usgovtexas",
	"francecentral",
}

AzureLocations provides all azure regions in prod. Related powershell to refresh this list:

Get-AzureRmLocation | Select-Object -Property Location

Functions

func CreateSaveSSH

func CreateSaveSSH(username, outputDirectory string, s *i18n.Translator) (privateKey *rsa.PrivateKey, publicKeyString string, err error)

CreateSaveSSH generates and stashes an SSH key pair.

func FormatAzureProdFQDN

func FormatAzureProdFQDN(fqdnPrefix string, location string) string

FormatAzureProdFQDN constructs an Azure prod fqdn

func GenerateClusterID

func GenerateClusterID(properties *api.Properties) string

GenerateClusterID creates a unique 8 string cluster ID

func GetClassicAllowedSizes

func GetClassicAllowedSizes() string

GetClassicAllowedSizes returns the classic allowed sizes

func GetClassicSizeMap

func GetClassicSizeMap() string

GetClassicSizeMap returns the size / storage map

func GetDCOSBootstrapConfig added in v0.2.0

func GetDCOSBootstrapConfig(cs *api.ContainerService) string

GetDCOSBootstrapConfig returns DCOS bootstrap config

func GetDCOSDefaultBootstrapInstallerURL added in v0.2.0

func GetDCOSDefaultBootstrapInstallerURL(orchestratorVersion string) string

GetDCOSDefaultBootstrapInstallerURL returns default DCOS Bootstrap installer URL

func GetDCOSDefaultWindowsBootstrapInstallerURL added in v0.2.0

func GetDCOSDefaultWindowsBootstrapInstallerURL(orchestratorVersion string) string

GetDCOSDefaultWindowsBootstrapInstallerURL returns default DCOS Windows Bootstrap installer URL

func GetDCOSMasterAllowedSizes

func GetDCOSMasterAllowedSizes() string

GetDCOSMasterAllowedSizes returns the master allowed sizes

func GetDCOSWindowsBootstrapConfig added in v0.3.0

func GetDCOSWindowsBootstrapConfig(cs *api.ContainerService) string

GetDCOSWindowsBootstrapConfig returns DCOS Windows bootstrap config

func GetKubernetesAgentAllowedSizes

func GetKubernetesAgentAllowedSizes() string

GetKubernetesAgentAllowedSizes returns the allowed sizes for Kubernetes agent

func GetMasterAgentAllowedSizes

func GetMasterAgentAllowedSizes() string

GetMasterAgentAllowedSizes returns the agent allowed sizes

func GetSizeMap

func GetSizeMap() string

GetSizeMap returns the size / storage map

func GetTenantID

func GetTenantID(env azure.Environment, subscriptionID string) (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.

Types

type ArtifactWriter

type ArtifactWriter struct {
	Translator *i18n.Translator
}

ArtifactWriter represents the object that writes artifacts

func (*ArtifactWriter) WriteTLSArtifacts

func (w *ArtifactWriter) WriteTLSArtifacts(containerService *api.ContainerService, apiVersion, template, parameters, artifactsDir string, certsGenerated bool, parametersOnly bool) error

WriteTLSArtifacts saves TLS certificates and keys to the server filesystem

type AzureEndpointConfig

type AzureEndpointConfig struct {
	ResourceManagerVMDNSSuffix string
}

AzureEndpointConfig describes an Azure endpoint

type AzureEnvironmentSpecConfig

type AzureEnvironmentSpecConfig struct {
	DockerSpecConfig DockerSpecConfig
	EndpointConfig   AzureEndpointConfig
	OSImageConfig    map[api.Distro]AzureOSImageConfig
}

AzureEnvironmentSpecConfig is the overall configuration differences in different cloud environments.

type AzureOSImageConfig

type AzureOSImageConfig struct {
	ImageOffer     string
	ImageSku       string
	ImagePublisher string
	ImageVersion   string
}

AzureOSImageConfig describes an Azure OS image

type Context

type Context struct {
	Translator *i18n.Translator
}

Context represents the object that is passed to the package

type CustomFileReader

type CustomFileReader struct {
	Source io.Reader
	Dest   string
}

CustomFileReader takes represents the source text of a file as an io.Reader and the desired destination to add it to

type DCOSNodeType

type DCOSNodeType string

DCOSNodeType represents the type of DCOS Node

const (
	// DCOSMaster represents the master node type
	DCOSMaster DCOSNodeType = "DCOSMaster"
	// DCOSPrivateAgent represents the private agent node type
	DCOSPrivateAgent DCOSNodeType = "DCOSPrivateAgent"
	// DCOSPublicAgent represents the public agent node type
	DCOSPublicAgent DCOSNodeType = "DCOSPublicAgent"
)

type DockerSpecConfig

type DockerSpecConfig struct {
	DockerEngineRepo         string
	DockerComposeDownloadURL string
}

DockerSpecConfig is the configurations of docker

type FileSaver

type FileSaver struct {
	Translator *i18n.Translator
}

FileSaver represents the object that save string or byte data to file

func (*FileSaver) SaveFile

func (f *FileSaver) SaveFile(dir string, file string, data []byte) error

SaveFile saves binary data to file

func (*FileSaver) SaveFileString

func (f *FileSaver) SaveFileString(dir string, file string, data string) error

SaveFileString saves string to file

type KeyVaultID

type KeyVaultID struct {
	ID string `json:"id"`
}

KeyVaultID represents a KeyVault instance on Azure

type KeyVaultRef

type KeyVaultRef struct {
	KeyVault      KeyVaultID `json:"keyVault"`
	SecretName    string     `json:"secretName"`
	SecretVersion string     `json:"secretVersion,omitempty"`
}

KeyVaultRef represents a reference to KeyVault instance on Azure

type PkiKeyCertPair

type PkiKeyCertPair struct {
	CertificatePem string
	PrivateKeyPem  string
}

PkiKeyCertPair represents an PKI public and private cert pair

type TemplateGenerator

type TemplateGenerator struct {
	ClassicMode bool
	Translator  *i18n.Translator
}

TemplateGenerator represents the object that performs the template generation.

func InitializeTemplateGenerator

func InitializeTemplateGenerator(ctx Context, classicMode bool) (*TemplateGenerator, error)

InitializeTemplateGenerator creates a new template generator object

func (*TemplateGenerator) GenerateTemplate

func (t *TemplateGenerator) GenerateTemplate(containerService *api.ContainerService, generatorCode string, isUpgrade bool) (templateRaw string, parametersRaw string, certsGenerated bool, err error)

GenerateTemplate generates the template from the API Model

type VlabsContainerService

type VlabsContainerService struct {
	api.TypeMeta
	*vlabs.ContainerService
}

VlabsContainerService is the type we read and write from file needed because the json that is sent to ARM and dcos-engine is different from the json that the ACS RP Api gets from ARM

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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