common

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 9 Imported by: 144

Documentation

Overview

Package common stores helpers and utility functions.

Index

Constants

View Source
const (
	// Mesos is the string constant for MESOS orchestrator type
	Mesos string = "Mesos"
	// 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

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
	// address relative to the first consecutive Kubernetes static IP
	DefaultInternalLbStaticIPOffset = 10
)

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"
	// Ephemeral means that the node's os disk is ephemeral. This is not compatible with attached volumes.
	Ephemeral = "Ephemeral"
)

storage profiles

View Source
const (
	// KubernetesDefaultRelease is the default Kubernetes release
	KubernetesDefaultRelease string = "1.13"
	// KubernetesDefaultReleaseWindows is the default Kubernetes release
	KubernetesDefaultReleaseWindows string = "1.14"
)
View Source
const (
	// DCOSVersion1Dot11Dot2 is the major.minor.patch string for 1.11.0 versions of DCOS
	DCOSVersion1Dot11Dot2 string = "1.11.2"
	// DCOSVersion1Dot11Dot0 is the major.minor.patch string for 1.11.0 versions of DCOS
	DCOSVersion1Dot11Dot0 string = "1.11.0"
	// DCOSVersion1Dot10Dot0 is the major.minor.patch string for 1.10.0 versions of DCOS
	DCOSVersion1Dot10Dot0 string = "1.10.0"
	// DCOSVersion1Dot9Dot0 is the major.minor.patch string for 1.9.0 versions of DCOS
	DCOSVersion1Dot9Dot0 string = "1.9.0"
	// DCOSVersion1Dot9Dot8 is the major.minor.patch string for 1.9.8 versions of DCOS
	DCOSVersion1Dot9Dot8 string = "1.9.8"
	// DCOSVersion1Dot8Dot8 is the major.minor.patch string for 1.8.8 versions of DCOS
	DCOSVersion1Dot8Dot8 string = "1.8.8"
	// DCOSDefaultVersion is the default major.minor.patch version for DCOS
	DCOSDefaultVersion string = DCOSVersion1Dot11Dot0
)
View Source
const (
	// SwarmVersion is the Swarm orchestrator version
	SwarmVersion = "swarm:1.1.0"
	// DockerCEVersion is the DockerCE orchestrator version
	DockerCEVersion = "17.03.*"
)
View Source
const MinCloudProviderQPSToBucketFactor float64 = 0.1

MinCloudProviderQPSToBucketFactor defines the minimum ratio between QPS and Bucket size for cloudprovider rate limiting

Variables

AllDCOSSupportedVersions maintain a list of available dcos versions in aks-engine

View Source
var AllKubernetesSupportedVersions = map[string]bool{}/* 141 elements not displayed */

AllKubernetesSupportedVersions is a whitelist map of all supported Kubernetes version strings The bool value indicates if creating new clusters with this version is allowed

View Source
var AllKubernetesWindowsSupportedVersions = getAllKubernetesWindowsSupportedVersionsMap()

AllKubernetesWindowsSupportedVersions maintain a set of available k8s Windows versions in aks-engine

Functions

func CidrFirstIP

func CidrFirstIP(cidr net.IP) net.IP

CidrFirstIP returns the first IP of the provided subnet.

func CidrStringFirstIP

func CidrStringFirstIP(ip string) (net.IP, error)

CidrStringFirstIP returns the first IP of the provided subnet string. Returns an error if the string cannot be parsed.

func GetAllSupportedDCOSVersions

func GetAllSupportedDCOSVersions() []string

GetAllSupportedDCOSVersions returns a slice of all supported DCOS versions.

func GetAllSupportedDockerCEVersions

func GetAllSupportedDockerCEVersions() []string

GetAllSupportedDockerCEVersions returns a slice of all supported Docker CE versions.

func GetAllSupportedKubernetesVersions

func GetAllSupportedKubernetesVersions(isUpdate, hasWindows bool) []string

GetAllSupportedKubernetesVersions returns a slice of all supported Kubernetes versions

func GetAllSupportedSwarmVersions

func GetAllSupportedSwarmVersions() []string

GetAllSupportedSwarmVersions returns a slice of all supported Swarm versions.

func GetDCSeriesVMCasesForTesting added in v0.42.0

func GetDCSeriesVMCasesForTesting() []struct {
	VMSKU    string
	Expected bool
}

GetDCSeriesVMCasesForTesting returns a struct w/ VM SKUs and whether or not we expect them to be SGX-enabled

func GetDefaultKubernetesVersion

func GetDefaultKubernetesVersion(hasWindows bool) string

GetDefaultKubernetesVersion returns the default Kubernetes version, that is the latest patch of the default release

func GetLatestPatchVersion

func GetLatestPatchVersion(majorMinor string, versionsList []string) (version string)

GetLatestPatchVersion gets the most recent patch version from a list of semver versions given a major.minor string

func GetMasterKubernetesLabels added in v0.37.0

func GetMasterKubernetesLabels(rg string, deprecated bool) string

GetMasterKubernetesLabels returns a k8s API-compliant labels string. The `kubernetes.io/role` and `node-role.kubernetes.io` labels are disallowed by the kubelet `--node-labels` argument in Kubernetes 1.16 and later.

func GetMaxVersion

func GetMaxVersion(versions []string, preRelease bool) string

GetMaxVersion gets the highest semver version preRelease=true means accept a pre-release version as a max value

func GetMinVersion

func GetMinVersion(versions []string, preRelease bool) string

GetMinVersion gets the lowest semver version preRelease=true means accept a pre-release version as a min value

func GetNSeriesVMCasesForTesting

func GetNSeriesVMCasesForTesting() []struct {
	VMSKU    string
	Expected bool
}

GetNSeriesVMCasesForTesting returns a struct w/ VM SKUs and whether or not we expect them to be nvidia-enabled

func GetOrderedEscapedKeyValsString added in v0.37.0

func GetOrderedEscapedKeyValsString(config map[string]string) string

GetOrderedEscapedKeyValsString returns an ordered string of escaped, quoted key=val

func GetStorageAccountType added in v0.37.0

func GetStorageAccountType(sizeName string) (string, error)

GetStorageAccountType returns the support managed disk storage tier for a give VM size

func GetSupportedKubernetesVersion

func GetSupportedKubernetesVersion(version string, hasWindows bool) string

GetSupportedKubernetesVersion verifies that a passed-in version string is supported, or returns a default version string if not

func GetSupportedVersions

func GetSupportedVersions(orchType string, isUpdate, hasWindows bool) (versions []string, defaultVersion string)

GetSupportedVersions get supported version list for a certain orchestrator

func GetVNETSubnetIDComponents

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

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

func GetValidPatchVersion

func GetValidPatchVersion(orchType, orchVer string, isUpdate, hasWindows bool) string

GetValidPatchVersion gets the current valid patch version for the minor version of the passed in version

func GetVersionsBetween

func GetVersionsBetween(versions []string, versionMin, versionMax string, inclusive, preReleases bool) []string

GetVersionsBetween returns a list of versions between a min and max inclusive=true means that we test for equality on both bounds preReleases=true means that we include pre-release versions in the list

func GetVersionsGt

func GetVersionsGt(versions []string, version string, inclusive, preReleases bool) []string

GetVersionsGt returns a list of versions greater than a semver string given a list of versions inclusive=true means that we test for equality as well preReleases=true means that we include pre-release versions in the list

func GetVersionsLt

func GetVersionsLt(versions []string, version string, inclusive, preReleases bool) []string

GetVersionsLt returns a list of versions less than than a semver string given a list of versions inclusive=true means that we test for equality as well preReleases=true means that we include pre-release versions in the list

func HandleValidationErrors

func HandleValidationErrors(e validator.ValidationErrors) error

HandleValidationErrors is the helper function to catch validator.ValidationError based on Namespace of the error, and return customized error message.

func IP4BroadcastAddress

func IP4BroadcastAddress(n *net.IPNet) net.IP

IP4BroadcastAddress returns the broadcast address for the given IP subnet.

func IsKubernetesVersionGe

func IsKubernetesVersionGe(actualVersion, version string) bool

IsKubernetesVersionGe returns true if actualVersion is greater than or equal to version

func IsNvidiaEnabledSKU

func IsNvidiaEnabledSKU(vmSize string) bool

IsNvidiaEnabledSKU determines if an VM SKU has nvidia driver support

func IsSgxEnabledSKU added in v0.30.0

func IsSgxEnabledSKU(vmSize string) bool

IsSgxEnabledSKU determines if an VM SKU has SGX driver support

func IsSupportedKubernetesVersion

func IsSupportedKubernetesVersion(version string, isUpdate, hasWindows bool) bool

IsSupportedKubernetesVersion return true if the provided Kubernetes version is supported

func IsValidMinVersion added in v0.43.0

func IsValidMinVersion(orchType, orchRelease, orchVersion, minVersion string) (bool, error)

func RationalizeReleaseAndVersion

func RationalizeReleaseAndVersion(orchType, orchRel, orchVer string, isUpdate, hasWindows bool) (version string)

RationalizeReleaseAndVersion return a version when it can be rationalized from the input, otherwise ""

func SliceIntIsNonEmpty added in v0.37.0

func SliceIntIsNonEmpty(s []int) bool

SliceIntIsNonEmpty is a simple convenience to determine if a []int is non-empty

func ValidateDNSPrefix

func ValidateDNSPrefix(dnsName string) error

ValidateDNSPrefix is a helper function to check that a DNS Prefix is valid

func WrapAsARMVariable added in v0.37.0

func WrapAsARMVariable(s string) string

WrapAsARMVariable formats a string for inserting an ARM variable into an ARM expression

func WrapAsParameter added in v0.37.0

func WrapAsParameter(s string) string

WrapAsParameter formats a string for inserting an ARM parameter into an ARM expression

func WrapAsVerbatim added in v0.37.0

func WrapAsVerbatim(s string) string

WrapAsVerbatim formats a string for inserting a literal string into an ARM expression

Types

This section is empty.

Jump to

Keyboard shortcuts

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