common

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 12 Imported by: 144

Documentation

Overview

Package common stores helpers and utility functions.

Index

Constants

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 = 1000
	// 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
	// DefaultEnableCSIProxyWindows determines if CSI proxy should be enabled by default for Windows nodes
	DefaultEnableCSIProxyWindows = false
	// MaxLoadBalancerOutboundIPs is the maximum number of outbound IPs in a Standard LoadBalancer frontend configuration
	MaxLoadBalancerOutboundIPs = 16
)

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.23"
	// KubernetesDefaultReleaseWindows is the default Kubernetes release for Windows
	KubernetesDefaultReleaseWindows string = "1.23"
	// KubernetesDefaultReleaseAzureStack is the default Kubernetes release on Azure Stack
	KubernetesDefaultReleaseAzureStack string = "1.23"
	// KubernetesDefaultReleaseWindowsAzureStack is the default Kubernetes release for Windows on Azure Stack
	KubernetesDefaultReleaseWindowsAzureStack string = "1.23"
)
View Source
const (
	// TillerAddonName is the name of the tiller addon deployment
	TillerAddonName = "tiller"
	// ACIConnectorAddonName // Deprecated
	ACIConnectorAddonName = "aci-connector" // Deprecated
	// ClusterAutoscalerAddonName is the name of the cluster autoscaler addon deployment
	ClusterAutoscalerAddonName = "cluster-autoscaler"
	// BlobfuseFlexVolumeAddonName is the name of the blobfuse flexvolume addon
	BlobfuseFlexVolumeAddonName = "blobfuse-flexvolume"
	// SMBFlexVolumeAddonName is the name of the smb flexvolume addon
	SMBFlexVolumeAddonName = "smb-flexvolume"
	// KeyVaultFlexVolumeAddonName is the name of the key vault flexvolume addon deployment
	KeyVaultFlexVolumeAddonName = "keyvault-flexvolume"
	// DashboardAddonName // Deprecated
	DashboardAddonName = "kubernetes-dashboard" // Deprecated
	// DashboardMetricsScraperContainerName is the name of the metrics-scraper container in the kubernetes-dashboard addon
	DashboardMetricsScraperContainerName = "kubernetes-dashboard-metrics-scraper" // Deprecated
	// ReschedulerAddonName // Deprecated
	ReschedulerAddonName = "rescheduler" // Deprecated
	// ExecHealthZComponentName is the name of the exechealthz component
	ExecHealthZComponentName = "exechealthz"
	// MetricsServerAddonName is the name of the kubernetes metrics server addon deployment
	MetricsServerAddonName = "metrics-server"
	// AddonResizerComponentName is the name of the kubernetes addon-resizer component
	AddonResizerComponentName = "addon-resizer"
	// NVIDIADevicePluginAddonName is the name of the NVIDIA device plugin addon deployment
	NVIDIADevicePluginAddonName = "nvidia-device-plugin"
	// ContainerMonitoringAddonName is the name of the kubernetes Container Monitoring addon deployment
	ContainerMonitoringAddonName = "container-monitoring"
	// IPMASQAgentAddonName is the name of the ip masq agent addon
	IPMASQAgentAddonName = "ip-masq-agent"
	// AzureCNINetworkMonitorAddonName is the name of the Azure CNI networkmonitor addon
	AzureCNINetworkMonitorAddonName = "azure-cni-networkmonitor"
	// AzureNetworkPolicyAddonName is the name of the Azure network policy manager addon
	AzureNetworkPolicyAddonName = "azure-npm-daemonset"
	// AzureVnetTelemetryContainerName is the name of the deprecated Azure vnet telemetry container in the azure-npm-daemonset addon
	AzureVnetTelemetryContainerName = "azure-vnet-telemetry-daemonset"
	// NMIContainerName is the name of the nmi container in the aad-pod-identity addon
	NMIContainerName = "nmi"
	// MICContainerName is the name of the mic container in the aad-pod-identity addon
	MICContainerName = "mic"
	// CiliumAgentContainerName is the name of the cilium-agent container in the cilium addon
	CiliumAgentContainerName = "cilium-agent"
	// CiliumCleanStateContainerName is the name of the clean-cilium-state container in the cilium addon
	CiliumCleanStateContainerName = "clean-cilium-state"
	// CiliumOperatorContainerName is the name of the cilium-operator container in the cilium addon
	CiliumOperatorContainerName = "cilium-operator"
	// CiliumEtcdOperatorContainerName is the name of the cilium-etcd-operator container in the cilium addon
	CiliumEtcdOperatorContainerName = "cilium-etcd-operator"
	// AntreaControllerContainerName is the name of the antrea-controller container in the antrea addon
	AntreaControllerContainerName = "antrea-controller"
	// AntreaAgentContainerName is the name of the antrea-agent container in the antrea addon
	AntreaAgentContainerName = "antrea-agent"
	// AntreaOVSContainerName is the name of the antrea-ovs container in the antrea addon
	AntreaOVSContainerName = "antrea-ovs"
	// AntreaInstallCNIContainerName is the name of the install-cni container in the antrea addon
	AntreaInstallCNIContainerName = "install-cni"
	// GatekeeperContainerName is the name of the gatekeeper container in the azure-policy addon
	GatekeeperContainerName = "gatekeeper"
	// CloudNodeManagerAddonName is the name of the cloud node manager addon
	CloudNodeManagerAddonName = "cloud-node-manager"
	// CalicoAddonName is the name of calico daemonset addon
	CalicoAddonName = "calico-daemonset"
	// CalicoTyphaComponentName is the name of calico-typha component
	CalicoTyphaComponentName = "calico-typha"
	// CalicoCNIComponentName is the name of calico-cni component
	CalicoCNIComponentName = "calico-cni"
	// CalicoNodeComponentName is the name of calico-node component
	CalicoNodeComponentName = "calico-node"
	// CalicoPod2DaemonComponentName is the name of calico-pod2daemon component
	CalicoPod2DaemonComponentName = "calico-pod2daemon"
	// CalicoClusterAutoscalerComponentName is the name of calico-cluster-proportional-autoscaler component
	CalicoClusterAutoscalerComponentName = "calico-cluster-proportional-autoscaler"
	// AADPodIdentityAddonName is the name of the aad-pod-identity addon deployment
	AADPodIdentityAddonName = "aad-pod-identity"
	// AzurePolicyAddonName is the name of the Azure Policy addon
	AzurePolicyAddonName = "azure-policy"
	// AppGwIngressAddonName appgw addon
	AppGwIngressAddonName = "appgw-ingress"
	// AzureDiskCSIDriverAddonName is the name of Azure Disk CSI Driver addon
	AzureDiskCSIDriverAddonName = "azuredisk-csi-driver"
	// CSIProvisionerContainerName is the name of the csi-provisioner container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSIProvisionerContainerName = "csi-provisioner"
	// CSIAttacherContainerName is the name of the csi-attacher container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSIAttacherContainerName = "csi-attacher"
	// CSILivenessProbeContainerName is the name of the livenessprobe container in the azuredisk-csi-driver, azurefile-csi-driver and secrets-store-csi-driver addons
	CSILivenessProbeContainerName = "livenessprobe"
	// CSILivenessProbeWindowsContainerName is the name of the livenessprobe-windows container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSILivenessProbeWindowsContainerName = "livenessprobe-windows"
	// CSISnapshotterContainerName is the name of the csi-snapshotter container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSISnapshotterContainerName = "csi-snapshotter"
	// CSISnapshotControllerContainerName is the name of the csi-snapshot-controller container
	CSISnapshotControllerContainerName = "csi-snapshot-controller"
	// CSIResizerContainerName is the name of the csi-resizer container in the azuredisk-csi-driver addon
	CSIResizerContainerName = "csi-resizer"
	// CSINodeDriverRegistrarContainerName is the name of the csi-node-driver-registrar container in the azuredisk-csi-driver, azurefile-csi-driver and secrets-store-csi-driver addons
	CSINodeDriverRegistrarContainerName = "csi-node-driver-registrar"
	// CSINodeDriverRegistrarWindowsContainerName is the name of the csi-node-driver-registrar-windows container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSINodeDriverRegistrarWindowsContainerName = "csi-node-driver-registrar-windows"
	// CSIAzureDiskContainerName is the name of the azuredisk-csi container in the azuredisk-csi-driver and azurefile-csi-driver addons
	CSIAzureDiskContainerName = "azuredisk-csi"
	// AzureFileCSIDriverAddonName is the name of Azure File CSI Driver addon
	AzureFileCSIDriverAddonName = "azurefile-csi-driver"
	// CSIAzureFileContainerName is the name of the azurefile-csi container in the azurefile-csi-driver addon
	CSIAzureFileContainerName = "azurefile-csi"
	// AzureStorageClassesAddonName is the name of the azure storage classes addon
	AzureStorageClassesAddonName = "azure-storage-classes"
	// Hyperkube is the common "hyperkube" string reference
	Hyperkube = "hyperkube"
	// KubeDNSAddonName is the name of the kube-dns-deployment addon
	KubeDNSAddonName = "kube-dns"
	// DNSMasqComponentName is the name of the dnsmasq component
	DNSMasqComponentName = "dnsmasq"
	// DNSSidecarComponentName is the name of the dnsmasq component
	DNSSidecarComponentName = "k8s-dns-sidecar"
	// PauseComponentName is the name of the pause component
	PauseComponentName = "pause"
	// CoreDNSAddonName is the name of the coredns addon
	CoreDNSAddonName = "coredns"
	// CoreDNSAutoscalerName is the name of the coredns-autoscaler container in the coredns addon
	CoreDNSAutoscalerName = "coredns-autoscaler"
	// KubeProxyAddonName is the name of the kube-proxy config addon
	KubeProxyAddonName = "kube-proxy"
	// CiliumAddonName is the name of cilium daemonset addon
	CiliumAddonName = "cilium"
	// AntreaAddonName is the name of antrea daemonset addon
	AntreaAddonName = "antrea"
	// FlannelAddonName is the name of flannel plugin daemonset addon
	FlannelAddonName = "flannel"
	// KubeFlannelContainerName is the name of the kube-flannel container in the flannel addon
	KubeFlannelContainerName = "kube-flannel"
	// FlannelInstallCNIContainerName is the name of the install-cni container in the flannel addon
	FlannelInstallCNIContainerName = "install-cni"
	// KubeRBACProxyContainerName is the name of the kube-rbac-proxy container in the scheduled-maintenance addon
	KubeRBACProxyContainerName = "kube-rbac-proxy"
	// ScheduledMaintenanceManagerContainerName is the name of the manager container in the scheduled-maintenance addon
	ScheduledMaintenanceManagerContainerName = "manager"
	// AADAdminGroupAddonName is the name of the default admin group RBAC addon
	AADAdminGroupAddonName = "aad"
	// AzureCloudProviderAddonName is the name of the azure-cloud-provider addon
	AzureCloudProviderAddonName = "azure-cloud-provider"
	// AzureCSIStorageClassesAddonName is the name of Azure CSI storage classes addon
	AzureCSIStorageClassesAddonName = "azure-csi-storage-classes"
	// AuditPolicyAddonName is the name of the audit policy addon
	AuditPolicyAddonName = "audit-policy"
	// ScheduledMaintenanceAddonName is the name of the scheduled maintenance addon deployment
	ScheduledMaintenanceAddonName = "scheduled-maintenance"
	// PodSecurityPolicyAddonName is the name of the PodSecurityPolicy addon
	PodSecurityPolicyAddonName = "pod-security-policy"
	// NodeProblemDetectorAddonName is the name of the node problem detector addon
	NodeProblemDetectorAddonName = "node-problem-detector"
	// SecretsStoreCSIDriverAddonName is the name of the secrets-store-csi-driver addon
	SecretsStoreCSIDriverAddonName = "csi-secrets-store"
	// CSISecretsStoreDriverContainerName is the name of the secrets-store container in the csi-secrets-store addon
	CSISecretsStoreDriverContainerName = "secrets-store"
	// CSISecretsStoreProviderAzureContainerName is the name of the provider-azure-installer container in csi-secrets-store addon
	CSISecretsStoreProviderAzureContainerName = "provider-azure-installer"
	// ArcAddonName is the name of the arc addon
	AzureArcOnboardingAddonName = "azure-arc-onboarding"
)

Addon name consts

View Source
const (
	// SchedulerComponentName is the name of the kube-scheduler component
	SchedulerComponentName = "kube-scheduler"
	// ControllerManagerComponentName is the name of the kube-controller-manager component
	ControllerManagerComponentName = "kube-controller-manager"
	// CloudControllerManagerComponentName is the name of the cloud-controller-manager component
	CloudControllerManagerComponentName = "cloud-controller-manager"
	// APIServerComponentName is the name of the kube-apiserver component
	APIServerComponentName = "kube-apiserver"
	// AddonManagerComponentName is the name of the kube-addon-manager component
	AddonManagerComponentName = "kube-addon-manager"
	// ClusterInitComponentName is the name of the cluster-init component
	ClusterInitComponentName = "cluster-init"
	// AzureKMSProviderComponentName is the name of the azure-kms-provider component
	AzureKMSProviderComponentName = "azure-kms-provider"
)

Component name consts

View Source
const (
	// AzureStackSuffix is appended to kubernetes version on Azure Stack instances
	AzureStackSuffix = "-azs"
	// AzureStackPrefix is prepended to windows binary version for Azure Stack instances
	AzureStackPrefix = "azs-"
	// AzureStackCaCertLocation is where Azure Stack's CRP drops the stamp CA certificate
	AzureStackCaCertLocation = "/var/lib/waagent/Certificates.pem"
)
View Source
const (
	KubernetesImageBaseTypeGCR = "gcr"
	KubernetesImageBaseTypeMCR = "mcr"
)
View Source
const (
	AntreaDefaultTrafficEncapMode = "Encap"
	AntreaDefaultInstallCniCmd    = "install_cni"
	AntreaInstallCniChainCmd      = "install_cni_chaining"
	AntreaNetworkPolicyOnlyMode   = "networkPolicyOnly"
)

Antrea Plugin Const

View Source
const (
	// MasterNodeTaint is the node taint we apply to all master nodes
	MasterNodeTaint string = "node-role.kubernetes.io/master=true:NoSchedule"
	// AADPodIdentityTaintKey is the node taint key for AAD Pod Identity-enabled clusters before NMI daemonset is ready
	AADPodIdentityTaintKey string = "node.kubernetes.io/aad-pod-identity-not-ready"
)

Node Taint consts

View Source
const (
	ContainerDataDirKey = "dataDir"
)

Known container runtime configuration keys

View Source
const (
	// Kubernetes is the string constant for the Kubernetes orchestrator type
	Kubernetes string = "Kubernetes"
)

the orchestrators supported

View Source
const LegacyControlPlaneVMPrefix string = "k8s-master"
View Source
const MinCloudProviderQPSToBucketFactor float64 = 0.1

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

View Source
const WindowsArtifactAzureStackComponentName = "windowszip-azs"
View Source
const WindowsArtifactComponentName = "windowszip"

Variables

View Source
var (
	// DefaultDockerConfig describes the default configuration of the docker daemon.
	DefaultDockerConfig = DockerConfig{
		LiveRestore: true,
		LogDriver:   "json-file",
		LogOpts: LogOpts{
			MaxSize: "50m",
			MaxFile: "5",
		},
	}

	// DefaultContainerdConfig describes the default configuration of the containerd daemon.
	DefaultContainerdConfig = ContainerdConfig{
		Version:  2,
		OomScore: 0,
		Plugins: Plugins{
			IoContainerdGrpcV1Cri: IoContainerdGrpcV1Cri{
				CNI: ContainerdCNIPlugin{},
				Containerd: ContainerdPlugin{
					DefaultRuntimeName: "runc",
					Runtimes: map[string]ContainerdRuntime{
						"runc": {
							RuntimeType: "io.containerd.runc.v2",
						},

						"untrusted": {
							RuntimeType: "io.containerd.runc.v2",
						},
					},
				},
			},
		},
	}
)
View Source
var AllKubernetesSupportedVersions = map[string]bool{}/* 345 elements not displayed */

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

View Source
var AllKubernetesSupportedVersionsAzureStack = map[string]bool{
	"1.14.7":  false,
	"1.14.8":  false,
	"1.15.4":  false,
	"1.15.5":  false,
	"1.15.10": false,
	"1.15.11": false,
	"1.15.12": false,
	"1.16.9":  false,
	"1.16.10": false,
	"1.16.11": false,
	"1.16.13": false,
	"1.16.14": false,
	"1.16.15": false,
	"1.17.4":  false,
	"1.17.5":  false,
	"1.17.6":  false,
	"1.17.7":  false,
	"1.17.9":  false,
	"1.17.11": false,
	"1.17.17": false,
	"1.18.10": false,
	"1.18.15": false,
	"1.18.18": false,
	"1.19.10": false,
	"1.19.15": false,
	"1.20.6":  false,
	"1.20.11": false,
	"1.21.10": false,
	"1.22.7":  false,
	"1.22.15": false,
	"1.22.16": false,
	"1.23.6":  false,
	"1.23.12": false,
	"1.23.13": false,
	"1.23.14": false,
	"1.23.15": true,
	"1.24.7":  false,
	"1.24.9":  true,
}

AllKubernetesSupportedVersionsAzureStack is a hash table of all supported Kubernetes version strings on Azure Stack 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

View Source
var AllKubernetesWindowsSupportedVersionsAzureStack = map[string]bool{
	"1.15.10": false,
	"1.15.11": false,
	"1.15.12": false,
	"1.16.9":  false,
	"1.16.10": false,
	"1.16.11": false,
	"1.16.13": false,
	"1.16.14": false,
	"1.16.15": false,
	"1.17.4":  false,
	"1.17.5":  false,
	"1.17.6":  false,
	"1.17.7":  false,
	"1.17.9":  false,
	"1.17.11": false,
	"1.17.17": false,
	"1.18.10": false,
	"1.18.15": false,
	"1.18.18": false,
	"1.19.10": false,
	"1.19.15": false,
	"1.20.6":  false,
	"1.20.11": false,
	"1.21.10": false,
	"1.22.7":  false,
	"1.22.15": false,
	"1.22.16": false,
	"1.23.6":  false,
	"1.23.12": false,
	"1.23.13": false,
	"1.23.14": false,
	"1.23.15": true,
	"1.24.7":  false,
	"1.24.9":  true,
}

AllKubernetesWindowsSupportedVersionsAzureStack maintain a set of available k8s Windows versions in aks-engine on Azure Stack

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 ContainerdKubenetOverride added in v0.50.0

func ContainerdKubenetOverride(config *ContainerdConfig) error

ContainerdKubenetOverride transforms a containerd config to set details required when using kubenet.

func ContainerdSandboxImageOverrider added in v0.50.0

func ContainerdSandboxImageOverrider(image string) func(*ContainerdConfig) error

ContainerdSandboxImageOverrider produces a function to transform containerd config by setting the SandboxImage.

func DockerNvidiaOverride added in v0.50.0

func DockerNvidiaOverride(config *DockerConfig) error

DockerNvidiaOverride transforms a docker config to supply nvidia runtime configuration.

func GetAllSupportedKubernetesVersions

func GetAllSupportedKubernetesVersions(isUpdate, hasWindows bool, isAzureStackCloud bool) []string

GetAllSupportedKubernetesVersions returns a slice of all supported Kubernetes versions

func GetContainerdConfig added in v0.50.0

func GetContainerdConfig(opts map[string]string, overrides []func(*ContainerdConfig) error) (string, error)

GetContainerdConfig transforms the default containerd config with overrides. Overrides may be nil.

func GetContainerdConfigTestCases added in v0.50.0

func GetContainerdConfigTestCases() map[string]string

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, isAzureStackCloud bool) string

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

func GetDockerConfig added in v0.50.0

func GetDockerConfig(opts map[string]string, overrides []func(*DockerConfig) error) (string, error)

GetDockerConfig transforms the default docker config with overrides. Overrides may be nil.

func GetDockerConfigTestCases added in v0.50.0

func GetDockerConfigTestCases() map[string]string

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 GetOrderedNewlinedKeyValsStringForCloudInit added in v0.48.0

func GetOrderedNewlinedKeyValsStringForCloudInit(config map[string]string) string

GetOrderedNewlinedKeyValsStringForCloudInit returns an ordered string of key = val, separated by newlines

func GetStorageAccountType added in v0.37.0

func GetStorageAccountType(sizeName string) (string, error)

GetStorageAccountType returns the managed disk storage tier for a given VM size.

func GetSupportedKubernetesVersion

func GetSupportedKubernetesVersion(version string, hasWindows bool, isAzureStackCloud 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, isAzureStackCloud 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, isAzureStackCloud 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 IndentString added in v0.50.0

func IndentString(original string, spaces int) string

IndentString pads each line of an original string with N spaces and returns the new value.

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, isAzureStackCloud 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, isAzureStackCloud 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

type ContainerdCNIPlugin added in v0.50.0

type ContainerdCNIPlugin struct {
	ConfTemplate string `toml:"conf_template,omitempty"`
}

type ContainerdConfig added in v0.50.0

type ContainerdConfig struct {
	OomScore int     `toml:"oom_score,omitempty"`
	Root     string  `toml:"root,omitempty"`
	Version  int     `toml:"version,omitempty"`
	Plugins  Plugins `toml:"plugins,omitempty"`
}

func GetDefaultContainerdConfig added in v0.50.0

func GetDefaultContainerdConfig() ContainerdConfig

GetDefaultContainerdConfig returns the default containerd config for processing.

type ContainerdPlugin added in v0.50.0

type ContainerdPlugin struct {
	DefaultRuntimeName string                       `toml:"default_runtime_name,omitempty"`
	Runtimes           map[string]ContainerdRuntime `toml:"runtimes,omitempty"`
}

type ContainerdRuntime added in v0.50.0

type ContainerdRuntime struct {
	RuntimeType string `toml:"runtime_type,omitempty"`
}

type DockerConfig added in v0.50.0

type DockerConfig struct {
	ExecOpts             []string                       `json:"exec-opts,omitempty"`
	DataRoot             string                         `json:"data-root,omitempty"`
	LiveRestore          bool                           `json:"live-restore,omitempty"`
	LogDriver            string                         `json:"log-driver,omitempty"`
	LogOpts              LogOpts                        `json:"log-opts,omitempty"`
	DefaultRuntime       string                         `json:"default-runtime,omitempty"`
	DockerDaemonRuntimes map[string]DockerDaemonRuntime `json:"runtimes,omitempty"`
}

func GetDefaultDockerConfig added in v0.50.0

func GetDefaultDockerConfig() DockerConfig

GetDefaultDockerConfig returns the default docker config for processing.

type DockerDaemonRuntime added in v0.50.0

type DockerDaemonRuntime struct {
	Path        string   `json:"path,omitempty"`
	RuntimeArgs []string `json:"runtimeArgs"`
}

type IoContainerdGrpcV1Cri added in v0.50.0

type IoContainerdGrpcV1Cri struct {
	SandboxImage string              `toml:"sandbox_image,omitempty"`
	CNI          ContainerdCNIPlugin `toml:"cni,omitempty"`
	Containerd   ContainerdPlugin    `toml:"containerd,omitempty"`
}

type LogOpts added in v0.50.0

type LogOpts struct {
	MaxSize string `json:"max-size,omitempty"`
	MaxFile string `json:"max-file,omitempty"`
}

type Plugins added in v0.50.0

type Plugins struct {
	IoContainerdGrpcV1Cri IoContainerdGrpcV1Cri `toml:"io.containerd.grpc.v1.cri,omitempty"`
}

Jump to

Keyboard shortcuts

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