acsengine

package
v0.0.0-...-36bfce7 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// AzureProdFQDNFormat specifies the format for a prod dns name
	AzurePublicProdFQDNFormat = "%s.%s.cloudapp.azure.com"
	//AzureChinaProdFQDNFormat specify the endpoint of Azure China Cloud
	AzureChinaProdFQDNFormat = "%s.%s.cloudapp.chinacloudapi.cn"
)
View Source
const (
	// DefaultMasterSubnet specifies the default master subnet for DCOS or Swarm
	DefaultMasterSubnet = "172.16.0.0/24"
	// DefaultFirstConsecutiveStaticIP specifies the static IP address on master 0 for DCOS or Swarm
	DefaultFirstConsecutiveStaticIP = "172.16.0.5"
	// DefaultSwarmWindowsMasterSubnet specifies the default master subnet for a Swarm Windows cluster
	DefaultSwarmWindowsMasterSubnet = "192.168.255.0/24"
	// DefaultSwarmWindowsFirstConsecutiveStaticIP specifies the static IP address on master 0 for a Swarm WIndows cluster
	DefaultSwarmWindowsFirstConsecutiveStaticIP = "192.168.255.5"
	// DefaultKubernetesMasterSubnet specifies the default kubernetes master subnet
	DefaultKubernetesMasterSubnet = "10.240.0.0/16"
	// DefaultFirstConsecutiveKubernetesStaticIP specifies the static IP address on Kubernetes master 0
	DefaultFirstConsecutiveKubernetesStaticIP = "10.240.255.5"
	// DefaultAgentSubnetTemplate specifies a default agent subnet
	DefaultAgentSubnetTemplate = "10.%d.0.0/16"
	// DefaultKubernetesClusterDomain is the dns suffix used in the cluster (used as a SAN in the PKI generation)
	DefaultKubernetesClusterDomain = "cluster.local"
	// DefaultInternalLbStaticIPOffset specifies the offset of the internal LoadBalancer's IP
	// address relative to the first consecutive Kubernetes static IP
	DefaultInternalLbStaticIPOffset = 10
)
View Source
const (
	KubernetesHyperkubeImageName         = "hyperkube-amd64:v1.5.3"
	KubernetesDashboardImageName         = "kubernetes-dashboard-amd64:v1.5.1"
	KubernetesExechealthzImageName       = "exechealthz-amd64:1.2"
	KubernetesAddonResizerImageName      = "addon-resizer:1.6"
	KubernetesHeapsterImageName          = "heapster:v1.2.0"
	KubernetesDNSImageName               = "kubedns-amd64:1.7"
	KubernetesAddonManagerImageName      = "kube-addon-manager-amd64:v6.2"
	KubernetesDNSMasqImageName           = "kube-dnsmasq-amd64:1.3"
	KubernetesPodInfraContainerImageName = "pause-amd64:3.0"
)
View Source
const (
	//MsecndDCOSBootstrapDownloadURL Azure CDN to download DCOS1.7.3
	MsecndDCOSBootstrapDownloadURL = "https://az837203.vo.msecnd.net/dcos/%s/bootstrap/%s.bootstrap.tar.xz"
	//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 (
	ValidityDuration = time.Hour * 24 * 365 * 2
	PkiKeySize       = 4096
)

Variables

View Source
var (
	//AzureCloudSpec is the default configurations for global azure.
	AzureCloudSpec = AzureEnvironmentSpecConfig{

		DockerSpecConfig: DockerSpecConfig{
			DockerEngineRepo: "https://apt.dockerproject.org/repo",
		},

		KubernetesSpecConfig: KubernetesSpecConfig{
			KubernetesImageBase: "gcr.io/google_containers/",
		},

		DCOSSpecConfig: DCOSSpecConfig{
			DCOS173_BootstrapDownloadURL: fmt.Sprintf(MsecndDCOSBootstrapDownloadURL, "testing", "df308b6fc3bd91e1277baa5a3db928ae70964722"),
			DCOS184_BootstrapDownloadURL: fmt.Sprintf(AzureEdgeDCOSBootstrapDownloadURL, "testing", "5b4aa43610c57ee1d60b4aa0751a1fb75824c083"),
			DCOS187_BootstrapDownloadURL: fmt.Sprintf(AzureEdgeDCOSBootstrapDownloadURL, "stable", "e73ba2b1cd17795e4dcb3d6647d11a29b9c35084"),
			DCOS188_BootstrapDownloadURL: fmt.Sprintf(AzureEdgeDCOSBootstrapDownloadURL, "stable", "5df43052907c021eeb5de145419a3da1898c58a5"),
		},
	}

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

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

		KubernetesSpecConfig: KubernetesSpecConfig{
			KubernetesImageBase: "mirror.azure.cn:5000/google_containers/",
		},
		DCOSSpecConfig: DCOSSpecConfig{
			DCOS173_BootstrapDownloadURL: fmt.Sprintf(AzureChinaCloudDCOSBootstrapDownloadURL, "df308b6fc3bd91e1277baa5a3db928ae70964722"),
			DCOS184_BootstrapDownloadURL: fmt.Sprintf(AzureChinaCloudDCOSBootstrapDownloadURL, "5b4aa43610c57ee1d60b4aa0751a1fb75824c083"),
			DCOS187_BootstrapDownloadURL: fmt.Sprintf(AzureChinaCloudDCOSBootstrapDownloadURL, "e73ba2b1cd17795e4dcb3d6647d11a29b9c35084"),
			DCOS188_BootstrapDownloadURL: fmt.Sprintf(AzureChinaCloudDCOSBootstrapDownloadURL, "5df43052907c021eeb5de145419a3da1898c58a5"),
		},
	}
)
View Source
var AzureLocations = []string{
	"australiaeast",
	"australiasoutheast",
	"brazilsouth",
	"canadacentral",
	"canadaeast",
	"centralindia",
	"centralus",
	"eastasia",
	"eastus",
	"eastus2",
	"japaneast",
	"japanwest",
	"koreacentral",
	"koreasouth",
	"northcentralus",
	"northeurope",
	"southcentralus",
	"southeastasia",
	"southindia",
	"uksouth",
	"ukwest",
	"westcentralus",
	"westeurope",
	"westindia",
	"westus",
	"westus2",
	"chinaeast",
	"chinanorth",
}

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

Get-AzureRmLocation | Select-Object -Property Location

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func CreatePki

func CreatePki(extraFQDNs []string, extraIPs []net.IP, clusterDomain string, caPair *PkiKeyCertPair) (*PkiKeyCertPair, *PkiKeyCertPair, *PkiKeyCertPair, error)

func FormatAzureProdFQDN

func FormatAzureProdFQDN(fqdnPrefix string, location string) string

FormatAzureProdFQDN constructs an Azure prod fqdn

func FormatAzureProdFQDNs

func FormatAzureProdFQDNs(fqdnPrefix string) []string

FormatAzureProdFQDNs constructs all possible Azure prod fqdn

func GenerateClusterID

func GenerateClusterID(properties *api.Properties) string

GenerateClusterID creates a unique 8 string cluster ID

func GenerateKubeConfig

func GenerateKubeConfig(properties *api.Properties, location string) (string, error)

GenerateKubeConfig returns a JSON string representing the KubeConfig

func GetClassicAllowedSizes

func GetClassicAllowedSizes() string

GetClassicAllowedSizes returns the classic allowed sizes

func GetClassicSizeMap

func GetClassicSizeMap() string

GetClassicSizeMap returns the size / storage map

func GetCloudTargetEnv

func GetCloudTargetEnv(location string) string

func GetDCOSMasterAllowedSizes

func GetDCOSMasterAllowedSizes() string

GetDCOSMasterAllowedSizes returns the master allowed sizes

func GetMasterAgentAllowedSizes

func GetMasterAgentAllowedSizes() string

GetMasterAgentAllowedSizes returns the agent allowed sizes

func GetSizeMap

func GetSizeMap() string

GetSizeMap returns the size / storage map

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func PrettyPrintArmTemplate

func PrettyPrintArmTemplate(template string) (string, error)

PrettyPrintArmTemplate will pretty print the arm template ensuring ordered by params, vars, resources, and outputs

func PrettyPrintJSON

func PrettyPrintJSON(content string) (string, error)

PrettyPrintJSON will pretty print the json into

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SetPropertiesDefaults

func SetPropertiesDefaults(cs *api.ContainerService) (bool, error)

SetPropertiesDefaults for the container Properties, returns true if certs are generated

Types

type AzureEnvironmentSpecConfig

type AzureEnvironmentSpecConfig struct {
	DockerSpecConfig     DockerSpecConfig
	KubernetesSpecConfig KubernetesSpecConfig
	DCOSSpecConfig       DCOSSpecConfig
}

AzureEnvironmentSpecConfig is the overall configuration differences in different cloud environments.

func GetCloudSpecConfig

func GetCloudSpecConfig(location string) AzureEnvironmentSpecConfig

GetCloudSpecConfig returns the kubenernetes container images url configurations based on the deploy target environment for example: if the target is the public azure, then the default container image url should be gcr.io/google_container/... if the target is azure china, then the default container image should be mirror.azure.cn:5000/google_container/...

type DCOSNodeType

type DCOSNodeType string

DCOSNodeType represents the type of DCOS Node

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

type DCOSSpecConfig

type DCOSSpecConfig struct {
	DCOS173_BootstrapDownloadURL string
	DCOS184_BootstrapDownloadURL string
	DCOS187_BootstrapDownloadURL string
	DCOS188_BootstrapDownloadURL string
}

DCOSSpecConfig is the configurations of DCOS

type DockerSpecConfig

type DockerSpecConfig struct {
	DockerEngineRepo string
}

DockerSpecConfig is the configurations of docker

type KeyVaultID

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

type KeyVaultRef

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

type KubernetesSpecConfig

type KubernetesSpecConfig struct {
	KubernetesImageBase string
}

KubernetesSpecConfig is the kubernetes container images used.

type PkiKeyCertPair

type PkiKeyCertPair struct {
	CertificatePem string
	PrivateKeyPem  string
}

type TemplateGenerator

type TemplateGenerator struct {
	ClassicMode bool
}

TemplateGenerator represents the object that performs the template generation.

func InitializeTemplateGenerator

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

InitializeTemplateGenerator creates a new template generator object

func (*TemplateGenerator) GenerateTemplate

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

GenerateTemplate generates the template from the API Model

type V20160330ContainerService

type V20160330ContainerService struct {
	api.TypeMeta
	*v20160330.ContainerService
}

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

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 acs-engine is different from the json that the ACS RP Api gets from ARM

Jump to

Keyboard shortcuts

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