clusters

package
v0.0.0-...-1338e51 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 29 Imported by: 24

Documentation

Index

Constants

View Source
const (
	FleetSteveResourceType               = "fleet.cattle.io.cluster"
	PodSecurityAdmissionSteveResoureType = "management.cattle.io.podsecurityadmissionconfigurationtemplate"
	ProvisioningSteveResourceType        = "provisioning.cattle.io.cluster"
	ErrMsgListDownstreamClusters         = "Couldn't list downstream clusters"
)

Variables

This section is empty.

Functions

func CreateK3SRKE2Cluster

func CreateK3SRKE2Cluster(client *rancher.Client, rke2Cluster *apisV1.Cluster) (*v1.SteveAPIObject, error)

CreateK3SRKE2Cluster is a "helper" functions that takes a rancher client, and the rke2 cluster config as parameters. This function registers a delete cluster fuction with a wait.WatchWait to ensure the cluster is removed cleanly.

func CreateRKE1Cluster

func CreateRKE1Cluster(client *rancher.Client, rke1Cluster *management.Cluster) (*management.Cluster, error)

CreateRKE1Cluster is a "helper" functions that takes a rancher client, and the rke1 cluster config as parameters. This function registers a delete cluster fuction with a wait.WatchWait to ensure the cluster is removed cleanly.

func DeleteK3SRKE2Cluster

func DeleteK3SRKE2Cluster(client *rancher.Client, clusterID string) error

DeleteK3SRKE2Cluster is a "helper" functions that takes a rancher client, and the non-rke1 cluster ID as parameters to delete the cluster.

func DeleteRKE1Cluster

func DeleteRKE1Cluster(client *rancher.Client, clusterID string) error

DeleteKE1Cluster is a "helper" functions that takes a rancher client, and the rke1 cluster ID as parameters to delete the cluster.

func GetClusterIDByName

func GetClusterIDByName(client *rancher.Client, clusterName string) (string, error)

GetClusterIDByName is a helper function that returns the cluster ID by name

func GetClusterNameByID

func GetClusterNameByID(client *rancher.Client, clusterID string) (string, error)

GetClusterNameByID is a helper function that returns the cluster ID by name

func GetProvisioningClusterByName

func GetProvisioningClusterByName(client *rancher.Client, clusterName string, namespace string) (*apisV1.Cluster, *v1.SteveAPIObject, error)

GetProvisioningClusterByName is a helper function to get cluster object with the cluster name

func GetV1ProvisioningClusterByName

func GetV1ProvisioningClusterByName(client *rancher.Client, clusterName string) (string, error)

GetV1ProvisioningClusterByName is a helper function that returns the cluster ID by name

func ImportCluster

func ImportCluster(client *rancher.Client, cluster *apisV1.Cluster, rest *rest.Config) error

ImportCluster creates a job using the given rest config that applies the import yaml from the given management cluster.

func IsClusterImported

func IsClusterImported(client *rancher.Client, clusterID string) (isImported bool, err error)

IsClusterImported is a function to get a boolean value about if the cluster is imported or not. For custom and imported clusters the node driver value is different than "imported".

func IsHostedProvider

func IsHostedProvider(provider KubernetesProvider) (isHosted bool)

IsHostedProvider is a function to get a boolean value about if the cluster is hosted or not.

func IsHostedProvisioningClusterReady

func IsHostedProvisioningClusterReady(event watch.Event) (ready bool, err error)

IsHostedProvisioningClusterReady is basic check function that would be used for the wait.WatchWait func in pkg/wait. This functions just waits until a hosted cluster becomes ready.

func IsImportedClusterReady

func IsImportedClusterReady(event watch.Event) (ready bool, err error)

IsImportedClusterReady is basic check function that would be used for the wait.WatchWait func in pkg/wait. This functions just waits until an imported cluster becomes ready.

func IsProvisioningClusterReady

func IsProvisioningClusterReady(event watch.Event) (ready bool, err error)

IsProvisioningClusterReady is basic check function that would be used for the wait.WatchWait func in pkg/wait. This functions just waits until a cluster becomes ready.

func ListDownstreamClusters

func ListDownstreamClusters(client *rancher.Client) (clusterNames []string, err error)

ListDownstreamClusters is a helper function to get the name of the downstream clusters

func UpdateK3SRKE2Cluster

func UpdateK3SRKE2Cluster(client *rancher.Client, cluster *v1.SteveAPIObject, updatedCluster *apisV1.Cluster) (*v1.SteveAPIObject, error)

UpdateK3SRKE2Cluster is a "helper" functions that takes a rancher client, old rke2/k3s cluster config, and the new rke2/k3s cluster config as parameters.

func UpdateRKE1Cluster

func UpdateRKE1Cluster(client *rancher.Client, cluster, updatedCluster *management.Cluster) (*management.Cluster, error)

UpdateRKE1Cluster is a "helper" functions that takes a rancher client, old rke1 cluster config, and the new rke1 cluster config as parameters.

func WaitClusterToBeInUpgrade

func WaitClusterToBeInUpgrade(client *rancher.Client, clusterID string) (err error)

WaitClusterToBeInUpgrade is a helper function that takes a rancher client, and the cluster id as parameters. Waits cluster to be in upgrade state. Cluster error states that declare control plane is inaccessible and cluster object modified are ignored. Same cluster summary information logging is ignored.

func WaitClusterToBeUpgraded

func WaitClusterToBeUpgraded(client *rancher.Client, clusterID string) (err error)

WaitForClusterToBeUpgraded is a "helper" functions that takes a rancher client, and the cluster id as parameters. This function contains two stages. First stage is to wait to be cluster in upgrade state. And the other is to wait until cluster is ready. Cluster error states that declare control plane is inaccessible and cluster object modified are ignored. Same cluster summary information logging is ignored.

func WaitClusterUntilUpgrade

func WaitClusterUntilUpgrade(client *rancher.Client, clusterID string) (err error)

WaitClusterUntilUpgrade is a helper function that takes a rancher client, and the cluster id as parameters. Waits until cluster is ready. Cluster error states that declare control plane is inaccessible and cluster object modified are ignored. Same cluster summary information logging is ignored.

func WaitForActiveRKE1Cluster

func WaitForActiveRKE1Cluster(client *rancher.Client, clusterID string) error

WaitForActiveCluster is a "helper" function that waits for the cluster to reach the active state. The function accepts a Rancher client and a cluster ID as parameters.

func WaitOnClusterAfterSnapshot

func WaitOnClusterAfterSnapshot(client *rancher.Client, clusterID string) error

WaitOnClusterAfterSnapshot waits for a cluster to finish taking a snapshot and return to an active state.

func WatchAndWaitForCluster

func WatchAndWaitForCluster(client *rancher.Client, steveID string) error

WatchAndWaitForCluster is function that waits for a cluster to go unactive before checking its active state.

Types

type ClusterMeta

type ClusterMeta struct {
	// ID used for value of cluster's ID
	ID string

	// Name used for cluster's name.
	Name string

	// Provider is used for cluster's provider.
	Provider KubernetesProvider

	// IsHosted is used for cluster's hosted information.
	IsHosted bool

	// IsImported is used for cluster's imported information.
	IsImported bool

	// IsLocal is used for cluster's local information.
	IsLocal bool
}

ClusterMeta is a struct that contains a cluster's meta

func NewClusterMeta

func NewClusterMeta(client *rancher.Client, clusterName string) (clusterMeta *ClusterMeta, err error)

NewClusterMeta is a function to initialize new ClusterMeta for a specific cluster.

type ClusterType

type ClusterType string
const (
	K3SClusterType  ClusterType = "k3s"
	RKE1ClusterType ClusterType = "rke1"
	RKE2ClusterType ClusterType = "rke2"
)

func (ClusterType) String

func (p ClusterType) String() string

type Default

type Default struct {
	StringValue      string `json:"stringValue"`
	IntValue         int    `json:"intValue"`
	BoolValue        bool   `json:"boolValue"`
	StringSliceValue []int  `json:"stringSliceValue"`
}

type DynamicSchemaSpec

type DynamicSchemaSpec struct {
	ResourceFields ResourceFields `json:"resourceFields"`
}

DynamicSchemaSpec contains ResourceFields that contains all the data for the DynamicSchemaSpec which a type in provisioning.cattle.io.clusters this is how we get an ssh user for a node pool

type KubernetesProvider

type KubernetesProvider string

KubernetesProvider is a string type to determine cluster's provider.

const (

	// KubernetesProvider string enums are to determine cluster's provider.
	KubernetesProviderRKE  KubernetesProvider = rke
	KubernetesProviderRKE2 KubernetesProvider = rke2
	KubernetesProviderK3S  KubernetesProvider = k3s
	KubernetesProviderAKS  KubernetesProvider = aks
	KubernetesProviderEKS  KubernetesProvider = eks
	KubernetesProviderGKE  KubernetesProvider = gke
)

func GetClusterProvider

func GetClusterProvider(client *rancher.Client, clusterID string) (provider KubernetesProvider, err error)

GetClusterProvider is a function to get cluster's KubernetesProvider.

type ResourceFields

type ResourceFields struct {
	SSHUser SSHUser
}

type SSHUser

type SSHUser struct {
	Type        string `json:"type"`
	Default     Default
	Create      bool   `json:"create"`
	Update      bool   `json:"update"`
	Description string `json:"description"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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