vlabs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package vlabs stores an experimental api model for acs

Index

Constants

View Source
const (
	// DCOS is the string constant for DCOS orchestrator type and defaults to DCOS188
	DCOS string = "DCOS"
	// Swarm is the string constant for the Swarm orchestrator type
	Swarm string = "Swarm"
	// Kubernetes is the string constant for the Kubernetes orchestrator type
	Kubernetes string = "Kubernetes"
	// SwarmMode is the string constant for the Swarm Mode orchestrator type
	SwarmMode string = "SwarmMode"
)

the orchestrators supported by vlabs

View Source
const (
	// MinAgentCount are the minimum number of agents per agent pool
	MinAgentCount = 1
	// MaxAgentCount are the maximum number of agents per agent pool
	MaxAgentCount = 100
	// MinPort specifies the minimum tcp port to open
	MinPort = 1
	// MaxPort specifies the maximum tcp port to open
	MaxPort = 65535
	// MaxDisks specifies the maximum attached disks to add to the cluster
	MaxDisks = 4
	// MinDiskSizeGB specifies the minimum attached disk size
	MinDiskSizeGB = 1
	// MaxDiskSizeGB specifies the maximum attached disk size
	MaxDiskSizeGB = 1023
	// MinIPAddressCount specifies the minimum number of IP addresses per network interface
	MinIPAddressCount = 1
	// MaxIPAddressCount specifies the maximum number of IP addresses per network interface
	MaxIPAddressCount = 256
)

validation values

View Source
const (
	// AvailabilitySet means that the vms are in an availability set
	AvailabilitySet = "AvailabilitySet"
	// VirtualMachineScaleSets means that the vms are in a virtual machine scaleset
	VirtualMachineScaleSets = "VirtualMachineScaleSets"
)

Availability profiles

View Source
const (
	// StorageAccount means that the nodes use raw storage accounts for their os and attached volumes
	StorageAccount = "StorageAccount"
	// ManagedDisks means that the nodes use managed disks for their os and attached volumes
	ManagedDisks = "ManagedDisks"
)

storage profiles

View Source
const (
	// DCOS190 is the string constant for DCOS 1.9.0
	DCOS190 string = "1.9.0"
	// DCOS188 is the string constant for DCOS 1.8.8
	DCOS188 string = "1.8.8"
	// DCOS187 is the string constant for DCOS 1.8.7
	DCOS187 string = "1.8.7"
	// DCOS184 is the string constant for DCOS 1.8.4
	DCOS184 string = "1.8.4"
	// DCOS173 is the string constant for DCOS 1.7.3
	DCOS173 string = "1.7.3"
	// DCOSLatest is the string constant for latest DCOS version
	DCOSLatest string = DCOS190
)
View Source
const (
	// Kubernetes153 is the string constant for Kubernetes 1.5.3
	Kubernetes153 string = "1.5.3"
	// Kubernetes157 is the string constant for Kubernetes 1.5.7
	Kubernetes157 string = "1.5.7"
	// Kubernetes160 is the string constant for Kubernetes 1.6.0
	Kubernetes160 string = "1.6.0"
	// Kubernetes162 is the string constant for Kubernetes 1.6.2
	Kubernetes162 string = "1.6.2"
	// Kubernetes166 is the string constant for Kubernetes 1.6.6
	Kubernetes166 string = "1.6.6"
	// Kubernetes170 is the string constant for Kubernetes 1.7.0
	Kubernetes170 string = "1.7.0"
	// Kubernetes171 is the string constant for Kubernetes 1.7.1
	Kubernetes171 string = "1.7.1"
	// Kubernetes172 is the string constant for Kubernetes 1.7.2
	Kubernetes172 string = "1.7.2"
	// KubernetesLatest is the string constant for latest Kubernetes version
	KubernetesLatest string = Kubernetes166
	// KubernetesDefaultVersion is the string constant for current Kubernetes version
	KubernetesDefaultVersion string = Kubernetes166
)
View Source
const (
	// APIVersion is the version of this API
	APIVersion = "vlabs"
)

Variables

View Source
var (
	NetworkPolicyValues = [...]string{"", "none", "azure", "calico"}
)

Network policy

Functions

func GetVNETSubnetIDComponents

func GetVNETSubnetIDComponents(vnetSubnetID string) (string, string, string, string, error)

GetVNETSubnetIDComponents extract subscription, resourcegroup, vnetname, subnetname from the vnetSubnetID

Types

type AgentPoolProfile

type AgentPoolProfile struct {
	Name                string `json:"name" validate:"required"`
	Count               int    `json:"count" validate:"required,min=1,max=100"`
	VMSize              string `json:"vmSize" validate:"required"`
	OSDiskSizeGB        int    `json:"osDiskSizeGB,omitempty" validate:"min=0,max=1023"`
	DNSPrefix           string `json:"dnsPrefix,omitempty"`
	OSType              OSType `json:"osType,omitempty"`
	Ports               []int  `json:"ports,omitempty" validate:"dive,min=1,max=65535"`
	AvailabilityProfile string `json:"availabilityProfile"`
	StorageProfile      string `json:"storageProfile" validate:"eq=StorageAccount|eq=ManagedDisks|len=0"`
	DiskSizesGB         []int  `json:"diskSizesGB,omitempty" validate:"max=4,dive,min=1,max=1023"`
	VnetSubnetID        string `json:"vnetSubnetID,omitempty"`
	IPAddressCount      int    `json:"ipAddressCount,omitempty" validate:"min=0,max=256"`

	FQDN             string            `json:"fqdn"`
	CustomNodeLabels map[string]string `json:"customNodeLabels,omitempty"`
	// contains filtered or unexported fields
}

AgentPoolProfile represents an agent pool definition

func (*AgentPoolProfile) GetSubnet

func (a *AgentPoolProfile) GetSubnet() string

GetSubnet returns the read-only subnet for the agent pool

func (*AgentPoolProfile) HasDisks

func (a *AgentPoolProfile) HasDisks() bool

HasDisks returns true if the customer specified disks

func (*AgentPoolProfile) IsAvailabilitySets

func (a *AgentPoolProfile) IsAvailabilitySets() bool

IsAvailabilitySets returns true if the customer specified disks

func (*AgentPoolProfile) IsCustomVNET

func (a *AgentPoolProfile) IsCustomVNET() bool

IsCustomVNET returns true if the customer brought their own VNET

func (*AgentPoolProfile) IsLinux

func (a *AgentPoolProfile) IsLinux() bool

IsLinux returns true if the agent pool is linux

func (*AgentPoolProfile) IsManagedDisks

func (a *AgentPoolProfile) IsManagedDisks() bool

IsManagedDisks returns true if the customer specified managed disks

func (*AgentPoolProfile) IsStorageAccount

func (a *AgentPoolProfile) IsStorageAccount() bool

IsStorageAccount returns true if the customer specified storage account

func (*AgentPoolProfile) IsWindows

func (a *AgentPoolProfile) IsWindows() bool

IsWindows returns true if the agent pool is windows

func (*AgentPoolProfile) SetSubnet

func (a *AgentPoolProfile) SetSubnet(subnet string)

SetSubnet sets the read-only subnet for the agent pool

func (*AgentPoolProfile) Validate

func (a *AgentPoolProfile) Validate(orchestratorType string) error

Validate implements APIObject

type CertificateProfile

type CertificateProfile struct {
	// CaCertificate is the certificate authority certificate.
	CaCertificate string `json:"caCertificate,omitempty"`
	// CaPrivateKey is the certificate authority key.
	CaPrivateKey string `json:"caPrivateKey,omitempty"`
	// ApiServerCertificate is the rest api server certificate, and signed by the CA
	APIServerCertificate string `json:"apiServerCertificate,omitempty"`
	// ApiServerPrivateKey is the rest api server private key, and signed by the CA
	APIServerPrivateKey string `json:"apiServerPrivateKey,omitempty"`
	// ClientCertificate is the certificate used by the client kubelet services and signed by the CA
	ClientCertificate string `json:"clientCertificate,omitempty"`
	// ClientPrivateKey is the private key used by the client kubelet services and signed by the CA
	ClientPrivateKey string `json:"clientPrivateKey,omitempty"`
	// KubeConfigCertificate is the client certificate used for kubectl cli and signed by the CA
	KubeConfigCertificate string `json:"kubeConfigCertificate,omitempty"`
	// KubeConfigPrivateKey is the client private key used for kubectl cli and signed by the CA
	KubeConfigPrivateKey string `json:"kubeConfigPrivateKey,omitempty"`
}

CertificateProfile represents the definition of the master cluster The JSON parameters could be either a plain text, or referenced to a secret in a keyvault. In the latter case, the format of the parameter's value should be "/subscriptions/<SUB_ID>/resourceGroups/<RG_NAME>/providers/Microsoft.KeyVault/vaults/<KV_NAME>/secrets/<NAME>[/<VERSION>]" where:

<SUB_ID> is the subscription ID of the keyvault
<RG_NAME> is the resource group of the keyvault
<KV_NAME> is the name of the keyvault
<NAME> is the name of the secret
<VERSION> (optional) is the version of the secret (default: the latest version)

type ClassicAgentPoolProfileType

type ClassicAgentPoolProfileType string

ClassicAgentPoolProfileType represents types of classic profiles

type ContainerService

type ContainerService struct {
	ID       string                `json:"id,omitempty"`
	Location string                `json:"location,omitempty"`
	Name     string                `json:"name,omitempty"`
	Plan     *ResourcePurchasePlan `json:"plan,omitempty"`
	Tags     map[string]string     `json:"tags,omitempty"`
	Type     string                `json:"type,omitempty"`

	Properties *Properties `json:"properties"`
}

ContainerService complies with the ARM model of resource definition in a JSON template.

type KeyVaultCertificate

type KeyVaultCertificate struct {
	CertificateURL   string `json:"certificateUrl,omitempty"`
	CertificateStore string `json:"certificateStore,omitempty"`
}

KeyVaultCertificate specifies a certificate to install On Linux, the certificate file is placed under the /var/lib/waagent directory with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for the private key. Both of these files are .pem formatted. On windows the certificate will be saved in the specified store.

type KeyVaultID

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

KeyVaultID specifies a key vault

type KeyVaultSecrets

type KeyVaultSecrets struct {
	SourceVault       *KeyVaultID           `json:"sourceVault,omitempty"`
	VaultCertificates []KeyVaultCertificate `json:"vaultCertificates,omitempty"`
}

KeyVaultSecrets specifies certificates to install on the pool of machines from a given key vault the key vault specified must have been granted read permissions to CRP

type KubernetesConfig

type KubernetesConfig struct {
	KubernetesImageBase              string  `json:"kubernetesImageBase,omitempty"`
	ClusterSubnet                    string  `json:"clusterSubnet,omitempty"`
	NetworkPolicy                    string  `json:"networkPolicy,omitempty"`
	DockerBridgeSubnet               string  `json:"DockerBridgeSubnet,omitempty"`
	NodeStatusUpdateFrequency        string  `json:"nodeStatusUpdateFrequency,omitempty"`
	CtrlMgrNodeMonitorGracePeriod    string  `json:"ctrlMgrNodeMonitorGracePeriod,omitempty"`
	CtrlMgrPodEvictionTimeout        string  `json:"ctrlMgrPodEvictionTimeout,omitempty"`
	CtrlMgrRouteReconciliationPeriod string  `json:"ctrlMgrRouteReconciliationPeriod,omitempty"`
	CloudProviderBackoff             bool    `json:"cloudProviderBackoff,omitempty"`
	CloudProviderBackoffRetries      int     `json:"cloudProviderBackoffRetries,omitempty"`
	CloudProviderBackoffJitter       float64 `json:"cloudProviderBackoffJitter,omitempty"`
	CloudProviderBackoffDuration     int     `json:"cloudProviderBackoffDuration,omitempty"`
	CloudProviderBackoffExponent     float64 `json:"cloudProviderBackoffExponent,omitempty"`
	CloudProviderRateLimit           bool    `json:"cloudProviderRateLimit,omitempty"`
	CloudProviderRateLimitQPS        float64 `json:"cloudProviderRateLimitQPS,omitempty"`
	CloudProviderRateLimitBucket     int     `json:"cloudProviderRateLimitBucket,omitempty"`
	UseManagedIdentity               bool    `json:"useManagedIdentity,omitempty"`
	CustomHyperkubeImage             string  `json:"customHyperkubeImage,omitempty"`
	UseInstanceMetadata              bool    `json:"useInstanceMetadata,omitempty"`
	EnableRbac                       bool    `json:"enableRbac,omitempty"`
}

KubernetesConfig contains the Kubernetes config structure, containing Kubernetes specific configuration

func (*KubernetesConfig) Validate

func (a *KubernetesConfig) Validate(k8sVersion string) error

Validate validates the KubernetesConfig.

type LinuxProfile

type LinuxProfile struct {
	AdminUsername string `json:"adminUsername" validate:"required"`
	SSH           struct {
		PublicKeys []PublicKey `json:"publicKeys" validate:"required,len=1"`
	} `json:"ssh" validate:"required"`
	Secrets []KeyVaultSecrets `json:"secrets,omitempty"`
}

LinuxProfile represents the linux parameters passed to the cluster

func (*LinuxProfile) Validate

func (l *LinuxProfile) Validate() error

Validate implements APIObject

type MasterProfile

type MasterProfile struct {
	Count                    int    `json:"count" validate:"required,eq=1|eq=3|eq=5"`
	DNSPrefix                string `json:"dnsPrefix" validate:"required"`
	VMSize                   string `json:"vmSize" validate:"required"`
	OSDiskSizeGB             int    `json:"osDiskSizeGB,omitempty" validate:"min=0,max=1023"`
	VnetSubnetID             string `json:"vnetSubnetID,omitempty"`
	FirstConsecutiveStaticIP string `json:"firstConsecutiveStaticIP,omitempty"`
	IPAddressCount           int    `json:"ipAddressCount,omitempty" validate:"min=0,max=256"`
	StorageProfile           string `json:"storageProfile,omitempty" validate:"eq=StorageAccount|eq=ManagedDisks|len=0"`
	HTTPSourceAddressPrefix  string `json:"HTTPSourceAddressPrefix,omitempty"`
	OAuthEnabled             bool   `json:"oauthEnabled"`

	// Master LB public endpoint/FQDN with port
	// The format will be FQDN:2376
	// Not used during PUT, returned as part of GET
	FQDN string `json:"fqdn,omitempty"`
	// contains filtered or unexported fields
}

MasterProfile represents the definition of the master cluster

func (*MasterProfile) GetSubnet

func (m *MasterProfile) GetSubnet() string

GetSubnet returns the read-only subnet for the master

func (*MasterProfile) IsCustomVNET

func (m *MasterProfile) IsCustomVNET() bool

IsCustomVNET returns true if the customer brought their own VNET

func (*MasterProfile) IsManagedDisks added in v0.2.0

func (m *MasterProfile) IsManagedDisks() bool

IsManagedDisks returns true if the master specified managed disks

func (*MasterProfile) IsStorageAccount added in v0.2.0

func (m *MasterProfile) IsStorageAccount() bool

IsStorageAccount returns true if the master specified storage account

func (*MasterProfile) SetSubnet

func (m *MasterProfile) SetSubnet(subnet string)

SetSubnet sets the read-only subnet for the master

func (*MasterProfile) Validate

func (m *MasterProfile) Validate() error

Validate implements APIObject

type OSType

type OSType string

OSType represents OS types of agents

const (
	Windows OSType = "Windows"
	Linux   OSType = "Linux"
)

the OSTypes supported by vlabs

type OrchestratorProfile

type OrchestratorProfile struct {
	OrchestratorType    string            `json:"orchestratorType" validate:"required"`
	OrchestratorVersion string            `json:"orchestratorVersion"`
	KubernetesConfig    *KubernetesConfig `json:"kubernetesConfig,omitempty"`
}

OrchestratorProfile contains Orchestrator properties

func (*OrchestratorProfile) IsSwarmMode

func (o *OrchestratorProfile) IsSwarmMode() bool

IsSwarmMode returns true if this template is for Swarm Mode orchestrator

func (*OrchestratorProfile) UnmarshalJSON added in v0.5.0

func (o *OrchestratorProfile) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal json using the default behavior And do fields manipulation, such as populating default value

func (*OrchestratorProfile) Validate

func (o *OrchestratorProfile) Validate() error

Validate implements APIObject

type Properties

type Properties struct {
	ProvisioningState       ProvisioningState        `json:"provisioningState,omitempty"`
	OrchestratorProfile     *OrchestratorProfile     `json:"orchestratorProfile,omitempty" validate:"required"`
	MasterProfile           *MasterProfile           `json:"masterProfile,omitempty" validate:"required"`
	AgentPoolProfiles       []*AgentPoolProfile      `json:"agentPoolProfiles,omitempty" validate:"dive,required"`
	LinuxProfile            *LinuxProfile            `json:"linuxProfile,omitempty" validate:"required"`
	WindowsProfile          *WindowsProfile          `json:"windowsProfile,omitempty"`
	ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
	CertificateProfile      *CertificateProfile      `json:"certificateProfile,omitempty"`
}

Properties represents the ACS cluster definition

func (*Properties) HasWindows

func (p *Properties) HasWindows() bool

HasWindows returns true if the cluster contains windows

func (*Properties) Validate

func (a *Properties) Validate() error

Validate implements APIObject

type ProvisioningState

type ProvisioningState string

ProvisioningState represents the current state of container service resource.

const (
	// Creating means ContainerService resource is being created.
	Creating ProvisioningState = "Creating"
	// Updating means an existing ContainerService resource is being updated
	Updating ProvisioningState = "Updating"
	// Failed means resource is in failed state
	Failed ProvisioningState = "Failed"
	// Succeeded means resource created succeeded during last create/update
	Succeeded ProvisioningState = "Succeeded"
	// Deleting means resource is in the process of being deleted
	Deleting ProvisioningState = "Deleting"
	// Migrating means resource is being migrated from one subscription or
	// resource group to another
	Migrating ProvisioningState = "Migrating"
)

type PublicKey added in v0.4.0

type PublicKey struct {
	KeyData string `json:"keyData"`
}

PublicKey represents an SSH key for LinuxProfile

type ResourcePurchasePlan

type ResourcePurchasePlan struct {
	Name          string `json:"name,omitempty"`
	Product       string `json:"product,omitempty"`
	PromotionCode string `json:"promotionCode,omitempty"`
	Publisher     string `json:"publisher,omitempty"`
}

ResourcePurchasePlan defines resource plan as required by ARM for billing purposes.

type ServicePrincipalProfile

type ServicePrincipalProfile struct {
	ClientID          string `json:"servicePrincipalClientID,omitempty"`
	Secret            string `json:"servicePrincipalClientSecret,omitempty"`
	KeyvaultSecretRef string `json:"servicePrincipalClientKeyvaultSecretRef,omitempty"`
}

ServicePrincipalProfile contains the client and secret used by the cluster for Azure Resource CRUD The 'Secret' parameter should be a secret in plain text. The 'KeyvaultSecretRef' parameter is a reference to a secret in a keyvault. The format of the parameter's value should be "/subscriptions/<SUB_ID>/resourceGroups/<RG_NAME>/providers/Microsoft.KeyVault/vaults/<KV_NAME>/secrets/<NAME>[/<VERSION>]" where:

<SUB_ID> is the subscription ID of the keyvault
<RG_NAME> is the resource group of the keyvault
<KV_NAME> is the name of the keyvault
<NAME> is the name of the secret.
<VERSION> (optional) is the version of the secret (default: the latest version)

type UpgradeContainerService

type UpgradeContainerService struct {
	OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"`
}

UpgradeContainerService API model

func (*UpgradeContainerService) Validate

func (ucs *UpgradeContainerService) Validate() error

Validate implements APIObject

type WindowsProfile

type WindowsProfile struct {
	AdminUsername string            `json:"adminUsername,omitempty"`
	AdminPassword string            `json:"adminPassword,omitempty"`
	Secrets       []KeyVaultSecrets `json:"secrets,omitempty"`
}

WindowsProfile represents the windows parameters passed to the cluster

Jump to

Keyboard shortcuts

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