machinepools

package
v0.0.0-...-2bcb20d Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWSKind                              = "Amazonec2Config"
	AWSPoolType                          = "rke-machine-config.cattle.io.amazonec2config"
	AWSResourceConfig                    = "amazonec2configs"
	AWSMachineConfigConfigurationFileKey = "awsMachineConfigs"
)
View Source
const (
	AzureKind                              = "AzureConfig"
	AzurePoolType                          = "rke-machine-config.cattle.io.azureconfig"
	AzureResourceConfig                    = "azureconfigs"
	AzureMachineConfigConfigurationFileKey = "azureMachineConfigs"
)
View Source
const (
	DOKind                              = "DigitaloceanConfig"
	DOPoolType                          = "rke-machine-config.cattle.io.digitaloceanconfig"
	DOResourceConfig                    = "digitaloceanconfigs"
	DOMachineConfigConfigurationFileKey = "doMachineConfigs"
)
View Source
const (
	HarvesterKind                              = "HarvesterConfig"
	HarvesterPoolType                          = "rke-machine-config.cattle.io.harvesterconfig"
	HarvesterResourceConfig                    = "harvesterconfigs"
	HarvesterMachineConfigConfigurationFileKey = "harvesterMachineConfigs"
)
View Source
const (
	LinodeKind                              = "LinodeConfig"
	LinodePoolType                          = "rke-machine-config.cattle.io.linodeconfig"
	LinodeResourceConfig                    = "linodeconfigs"
	LinodeMachineConfigConfigurationFileKey = "linodeMachineConfigs"
)
View Source
const (
	VmwaresphereKind                               = "VmwarevsphereConfig"
	VmwarevsphereType                              = "rke-machine-config.cattle.io.vmwarevsphereconfig"
	VmwarevsphereConfig                            = "vmwarevsphereconfigs"
	VmwarevsphereMachineConfigConfigurationFileKey = "vmwarevsphereMachineConfigs"
)
View Source
const (
	True = "true"
)

Variables

This section is empty.

Functions

func CreateAllMachinePools

func CreateAllMachinePools(machineConfigs []MachinePoolConfig, pools []Pools, machineObjects []v1.SteveAPIObject, objectRoles []Roles, hostnameLengthLimits []HostnameTruncation) []apisV1.RKEMachinePool

CreateAllMachinePools will setup multiple node pools from a given config.

func GetInitMachine

func GetInitMachine(client *rancher.Client, clusterID string) (*v1.SteveAPIObject, error)

GetInitMachine accepts a client and clusterID and returns the "init node" machine object for rke2/k3s clusters

func MatchMachineConfigToRolesIndex

func MatchMachineConfigToRolesIndex(machineConfig *MachinePoolConfig, objectRoles []Roles) int

MatchMachineConfigToRolesIndex will return the index of the matching role for a given machineConfig.

func MatchNodeRolesToMachinePool

func MatchNodeRolesToMachinePool(nodeRoles NodeRoles, machinePools []apisV1.RKEMachinePool) (int, int32)

MatchNodeRolesToMachinePool matches the role of machinePools to the nodeRoles.

func MatchRoleToPool

func MatchRoleToPool(poolRole string, allRoles []Roles) int

MatchRoleToPool matches the role of a pool to the Roles of a machine. Returns the index of the matching Roles.

func NewAWSMachineConfig

func NewAWSMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewAWSMachineConfig is a constructor to set up rke-machine-config.cattle.io.amazonec2config. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func NewAzureMachineConfig

func NewAzureMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewAzureMachineConfig is a constructor to set up rke-machine-config.cattle.io.azureconfig. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func NewDigitalOceanMachineConfig

func NewDigitalOceanMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewDigitalOceanMachineConfig is a constructor to set up rke-machine-config.cattle.io.digitaloceanconfig. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func NewHarvesterMachineConfig

func NewHarvesterMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewHarvesterMachineConfig is a constructor to set up rke-machine-config.cattle.io.harvesterconfig. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func NewLinodeMachineConfig

func NewLinodeMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewLinodeMachineConfig is a constructor to set up rke-machine-config.cattle.io.linodeconfigs. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func NewRKEMachinePool

func NewRKEMachinePool(machineObject v1.SteveAPIObject, pool Pools, machineConfig *MachinePoolConfig) apisV1.RKEMachinePool

NewRKEMachinePool is a constructor that sets up a apisV1.RKEMachinePool object to be used to provision a cluster.

func NewVSphereMachineConfig

func NewVSphereMachineConfig(generatedPoolName, namespace string) []unstructured.Unstructured

NewVSphereMachineConfig is a constructor to set up rke-machine-config.cattle.io.vmwarevsphereconfig. It returns an *unstructured.Unstructured that CreateMachineConfig uses to created the rke-machine-config

func ScaleMachinePoolNodes

func ScaleMachinePoolNodes(client *rancher.Client, cluster *v1.SteveAPIObject, nodeRoles NodeRoles) (*v1.SteveAPIObject, error)

ScaleMachinePoolNodes is a helper method that will scale the machine pool to the desired quantity.

Types

type AWSMachineConfig

type AWSMachineConfig struct {
	Roles
	AMI                string   `json:"ami" yaml:"ami"`
	IAMInstanceProfile string   `json:"iamInstanceProfile" yaml:"iamInstanceProfile"`
	InstanceType       string   `json:"instanceType" yaml:"instanceType"`
	SSHUser            string   `json:"sshUser" yaml:"sshUser"`
	VPCID              string   `json:"vpcId" yaml:"vpcId"`
	SubnetID           string   `json:"subnetId" yaml:"subnetId"`
	VolumeType         string   `json:"volumeType" yaml:"volumeType"`
	Zone               string   `json:"zone" yaml:"zone"`
	Retries            string   `json:"retries" yaml:"retries"`
	RootSize           string   `json:"rootSize" yaml:"rootSize"`
	SecurityGroup      []string `json:"securityGroup" yaml:"securityGroup"`
}

AWSMachineConfig is configuration needed to create an rke-machine-config.cattle.io.amazonec2config

type AWSMachineConfigs

type AWSMachineConfigs struct {
	AWSMachineConfig []AWSMachineConfig `json:"awsMachineConfig" yaml:"awsMachineConfig"`
	Region           string             `json:"region" yaml:"region"`
}

type AzureMachineConfig

type AzureMachineConfig struct {
	Roles
	AvailabilitySet   string   `json:"availabilitySet" yaml:"availabilitySet"`
	DiskSize          string   `json:"diskSize" yaml:"diskSize"`
	DNS               string   `json:"dns,omitempty" yaml:"dns,omitempty"`
	FaultDomainCount  string   `json:"faultDomainCount" yaml:"faultDomainCount"`
	Image             string   `json:"image" yaml:"image"`
	ManagedDisks      bool     `json:"managedDisks" yaml:"managedDisks"`
	NoPublicIP        bool     `json:"noPublicIp" yaml:"noPublicIp"`
	NSG               string   `json:"nsg" yaml:"nsg"`
	OpenPort          []string `json:"openPort" yaml:"openPort"`
	PrivateIPAddress  string   `json:"privateIpAddress,omitempty" yaml:"privateIpAddress,omitempty"`
	ResourceGroup     string   `json:"resourceGroup" yaml:"resourceGroup"`
	Size              string   `json:"size" yaml:"size"`
	SSHUser           string   `json:"sshUser" yaml:"sshUser"`
	StaticPublicIP    bool     `json:"staticPublicIp" yaml:"staticPublicIp"`
	StorageType       string   `json:"storageType" yaml:"storageType"`
	Subnet            string   `json:"subnet" yaml:"subnet"`
	SubnetPrefix      string   `json:"subnetPrefix" yaml:"subnetPrefix"`
	UpdateDomainCount string   `json:"updateDomainCount" yaml:"updateDomainCount"`
	UsePrivateIP      bool     `json:"usePrivateIp" yaml:"usePrivateIp"`
	Vnet              string   `json:"vnet" yaml:"vnet"`
}

AzureMachineConfig is configuration needed to create an rke-machine-config.cattle.io.azureconfig

type AzureMachineConfigs

type AzureMachineConfigs struct {
	AzureMachineConfig []AzureMachineConfig `json:"azureMachineConfig" yaml:"azureMachineConfig"`
	Environment        string               `json:"environment" yaml:"environment"`
}

type DOMachineConfig

type DOMachineConfig struct {
	Roles
	Image             string `json:"image" yaml:"image"`
	Backups           bool   `json:"backups" yaml:"backups"`
	IPV6              bool   `json:"ipv6" yaml:"ipv6"`
	Monitoring        bool   `json:"monitoring" yaml:"monitoring"`
	PrivateNetworking bool   `json:"privateNetworking" yaml:"privateNetworking"`
	Size              string `json:"size" yaml:"size"`
	SSHKeyContents    string `json:"sshKeyContents" yaml:"sshKeyContents"`
	SSHKeyFingerprint string `json:"sshKeyFingerprint" yaml:"sshKeyFingerprint"`
	SSHPort           string `json:"sshPort" yaml:"sshPort"`
	SSHUser           string `json:"sshUser" yaml:"sshUser"`
	Tags              string `json:"tags" yaml:"tags"`
	Userdata          string `json:"userdata" yaml:"userdata"`
}

DOMachineConfig is configuration needed to create an rke-machine-config.cattle.io.digitaloceanconfig

type DOMachineConfigs

type DOMachineConfigs struct {
	DOMachineConfig []DOMachineConfig `json:"doMachineConfig" yaml:"doMachineConfig"`
	Region          string            `json:"region" yaml:"region"`
}

type HarvesterMachineConfig

type HarvesterMachineConfig struct {
	Roles
	DiskSize    string `json:"diskSize" yaml:"diskSize"`
	CPUCount    string `json:"cpuCount" yaml:"cpuCount"`
	MemorySize  string `json:"memorySize" yaml:"memorySize"`
	NetworkName string `json:"networkName" yaml:"networkName"`
	ImageName   string `json:"imageName" yaml:"imageName"`
	DiskBus     string `json:"diskBus" yaml:"diskBus"`
	SSHUser     string `json:"sshUser" yaml:"sshUser"`
}

HarvesterMachineConfig is configuration needed to create an rke-machine-config.cattle.io.harvesterconfig

type HarvesterMachineConfigs

type HarvesterMachineConfigs struct {
	HarvesterMachineConfig []HarvesterMachineConfig `json:"harvesterMachineConfig" yaml:"harvesterMachineConfig"`
	VMNamespace            string                   `json:"vmNamespace" yaml:"vmNamespace"`
}

type HostnameTruncation

type HostnameTruncation struct {
	PoolNameLengthLimit    int
	ClusterNameLengthLimit int
	Name                   string
}

HostnameTruncation is a struct that is used to set the hostname length limit for a cluster or pool

type LinodeMachineConfig

type LinodeMachineConfig struct {
	Roles
	AuthorizedUsers string `json:"authorizedUsers" yaml:"authorizedUsers"`
	DockerPort      string `json:"dockerPort" yaml:"dockerPort"`
	CreatePrivateIP bool   `json:"createPrivateIp" yaml:"createPrivateIp"`
	Image           string `json:"image" yaml:"image"`
	InstanceType    string `json:"instanceType" yaml:"instanceType"`
	RootPass        string `json:"rootPass" yaml:"rootPass"`
	SSHPort         string `json:"sshPort" yaml:"sshPort"`
	SSHUser         string `json:"sshUser" yaml:"sshUser"`
	Stackscript     string `json:"stackscript" yaml:"stackscript"`
	StackscriptData string `json:"stackscriptData" yaml:"stackscriptData"`
	SwapSize        string `json:"swapSize" yaml:"swapSize"`
	Tags            string `json:"tags" yaml:"tags"`
	UAPrefix        string `json:"uaPrefix" yaml:"uaPrefix"`
}

LinodeMachineConfig is configuration needed to create an rke-machine-config.cattle.io.linodeconfig

type LinodeMachineConfigs

type LinodeMachineConfigs struct {
	LinodeMachineConfig []LinodeMachineConfig `json:"linodeMachineConfig" yaml:"linodeMachineConfig"`
	Region              string                `json:"region" yaml:"region"`
}

type MachinePoolConfig

type MachinePoolConfig struct {
	NodeRoles
	Name                 string           `json:"name,omitempty" yaml:"name,omitempty"`
	DrainBeforeDelete    bool             `json:"drainBeforeDelete,omitempty" yaml:"drainBeforeDelete,omitempty"`
	HostnameLengthLimit  int              `json:"hostnameLengthLimit" yaml:"hostnameLengthLimit" default:"0"`
	NodeStartupTimeout   *metav1.Duration `json:"nodeStartupTimeout,omitempty" yaml:"nodeStartupTimeout,omitempty"`
	UnhealthyNodeTimeout *metav1.Duration `json:"unhealthyNodeTimeout,omitempty" yaml:"unhealthyNodeTimeout,omitempty"`
	MaxUnhealthy         *string          `json:"maxUnhealthy,omitempty" yaml:"maxUnhealthy,omitempty"`
	UnhealthyRange       *string          `json:"unhealthyRange,omitempty" yaml:"unhealthyRange,omitempty"`
}

type NodeRoles

type NodeRoles struct {
	ControlPlane bool  `json:"controlplane,omitempty" yaml:"controlplane,omitempty"`
	Etcd         bool  `json:"etcd,omitempty" yaml:"etcd,omitempty"`
	Worker       bool  `json:"worker,omitempty" yaml:"worker,omitempty"`
	Windows      bool  `json:"windows,omitempty" yaml:"windows,omitempty"`
	Quantity     int32 `json:"quantity" yaml:"quantity"`
}

func (NodeRoles) String

func (n NodeRoles) String() string

type Pools

type Pools struct {
	NodeLabels             map[string]string `json:"nodeLabels,omitempty" yaml:"nodeLabels,omitempty"`
	NodeTaints             []corev1.Taint    `json:"nodeTaints,omitempty" yaml:"nodeTaints,omitempty"`
	SpecifyCustomPrivateIP bool              `json:"specifyPrivateIP,omitempty" yaml:"specifyPrivateIP,omitempty"`
	SpecifyCustomPublicIP  bool              `json:"specifyPublicIP,omitempty" yaml:"specifyPublicIP,omitempty" default:"true"`
	CustomNodeNameSuffix   string            `json:"nodeNameSuffix,omitempty" yaml:"nodeNameSuffix,omitempty"`
}

type Roles

type Roles struct {
	Roles []string `json:"roles,omitempty" yaml:"roles,omitempty"`
}

func GetAWSMachineRoles

func GetAWSMachineRoles() []Roles

GetAWSMachineRoles returns a list of roles from the given machineConfigs

func GetAzureMachineRoles

func GetAzureMachineRoles() []Roles

GetAzureMachineRoles returns a list of roles from the given machineConfigs

func GetDOMachineRoles

func GetDOMachineRoles() []Roles

GetDOMachineRoles returns a list of roles from the given machineConfigs

func GetHarvesterMachineRoles

func GetHarvesterMachineRoles() []Roles

GetHarvesterMachineRoles returns a list of roles from the given machineConfigs

func GetLinodeMachineRoles

func GetLinodeMachineRoles() []Roles

GetLinodeMachineRoles returns a list of roles from the given machineConfigs

func GetVsphereMachineRoles

func GetVsphereMachineRoles() []Roles

type VmwarevsphereMachineConfig

type VmwarevsphereMachineConfig struct {
	Roles
	Boot2dockerURL          string   `json:"boot2dockerURL" yaml:"boot2dockerURL"`
	Cfgparam                []string `json:"cfgparam" yaml:"cfgparam"`
	CloneFrom               string   `json:"cloneFrom" yaml:"cloneFrom"`
	CloudConfig             string   `json:"cloudConfig" yaml:"cloudConfig"`
	Cloundinit              string   `json:"cloundinit" yaml:"cloundinit"`
	ContentLibrary          string   `json:"contentLibrary" yaml:"contentLibrary"`
	CPUCount                string   `json:"cpuCount" yaml:"cpuCount"`
	CreationType            string   `json:"creationType" yaml:"creationType"`
	CustomAttribute         []string `json:"customAttribute" yaml:"customAttribute"`
	DatastoreCluster        string   `json:"datastoreCluster" yaml:"datastoreCluster"`
	DiskSize                string   `json:"diskSize" yaml:"diskSize"`
	MemorySize              string   `json:"memorySize" yaml:"memorySize"`
	Network                 []string `json:"network" yaml:"network"`
	GracefulShutdownTimeout string   `json:"gracefulShutdownTimeout" yaml:"gracefulShutdownTimeout"`
	OS                      string   `json:"os" yaml:"os"`
	SSHPassword             string   `json:"sshPassword" yaml:"sshPassword"`
	SSHPort                 string   `json:"sshPort" yaml:"sshPort"`
	SSHUser                 string   `json:"sshUser" yaml:"sshUser"`
	SSHUserGroup            string   `json:"sshUserGroup" yaml:"sshUserGroup"`
	Tag                     []string `json:"tag" yaml:"tag"`
	VappIpallocationplicy   string   `json:"vappIpallocationplicy" yaml:"vappIpallocationplicy"`
	VappIpprotocol          string   `json:"vappIpprotocol" yaml:"vappIpprotocol"`
	VappProperty            []string `json:"vappProperty" yaml:"vappProperty"`
	VappTransport           string   `json:"vappTransport" yaml:"vappTransport"`
}

VsphereMachineConfig is configuration needed to create an rke-machine-config.cattle.io.vmwarevsphereconfig

type VmwarevsphereMachineConfigs

type VmwarevsphereMachineConfigs struct {
	VmwarevsphereMachineConfig []VmwarevsphereMachineConfig `json:"vmwarevsphereMachineConfig" yaml:"vmwarevsphereMachineConfig"`

	Hostsystem   string `json:"hostsystem" yaml:"hostsystem"`
	Datacenter   string `json:"datacenter" yaml:"datacenter"`
	Datastore    string `json:"datastore" yaml:"datastore"`
	DatastoreURL string `json:"datastoreURL" yaml:"datastoreURL"`
	Folder       string `json:"folder" yaml:"folder"`
	Pool         string `json:"pool" yaml:"pool"`
}

Jump to

Keyboard shortcuts

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