Documentation ¶
Index ¶
- Constants
- func CreateK3SRKE2Cluster(client *rancher.Client, rke2Cluster *apisV1.Cluster) (*v1.SteveAPIObject, error)
- func CreateRKE1Cluster(client *rancher.Client, rke1Cluster *management.Cluster) (*management.Cluster, error)
- func DeleteK3SRKE2Cluster(client *rancher.Client, clusterID string) error
- func DeleteRKE1Cluster(client *rancher.Client, clusterID string) error
- func GetClusterIDByName(client *rancher.Client, clusterName string) (string, error)
- func GetClusterNameByID(client *rancher.Client, clusterID string) (string, error)
- func GetProvisioningClusterByName(client *rancher.Client, clusterName string, namespace string) (*apisV1.Cluster, *v1.SteveAPIObject, error)
- func GetV1ProvisioningClusterByName(client *rancher.Client, clusterName string) (string, error)
- func ImportCluster(client *rancher.Client, cluster *apisV1.Cluster, rest *rest.Config) error
- func IsClusterImported(client *rancher.Client, clusterID string) (isImported bool, err error)
- func IsHostedProvider(provider KubernetesProvider) (isHosted bool)
- func IsHostedProvisioningClusterReady(event watch.Event) (ready bool, err error)
- func IsImportedClusterReady(event watch.Event) (ready bool, err error)
- func IsProvisioningClusterReady(event watch.Event) (ready bool, err error)
- func ListDownstreamClusters(client *rancher.Client) (clusterNames []string, err error)
- func UpdateK3SRKE2Cluster(client *rancher.Client, cluster *v1.SteveAPIObject, ...) (*v1.SteveAPIObject, error)
- func UpdateRKE1Cluster(client *rancher.Client, cluster, updatedCluster *management.Cluster) (*management.Cluster, error)
- func WaitClusterToBeInUpgrade(client *rancher.Client, clusterID string) (err error)
- func WaitClusterToBeUpgraded(client *rancher.Client, clusterID string) (err error)
- func WaitClusterUntilUpgrade(client *rancher.Client, clusterID string) (err error)
- func WaitForActiveRKE1Cluster(client *rancher.Client, clusterID string) error
- func WaitOnClusterAfterSnapshot(client *rancher.Client, clusterID string) error
- func WatchAndWaitForCluster(client *rancher.Client, steveID string) error
- type ClusterMeta
- type ClusterType
- type Default
- type DynamicSchemaSpec
- type KubernetesProvider
- type ResourceFields
- type SSHUser
Constants ¶
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 ¶
DeleteK3SRKE2Cluster is a "helper" functions that takes a rancher client, and the non-rke1 cluster ID as parameters to delete the cluster.
func DeleteRKE1Cluster ¶
DeleteKE1Cluster is a "helper" functions that takes a rancher client, and the rke1 cluster ID as parameters to delete the cluster.
func GetClusterIDByName ¶
GetClusterIDByName is a helper function that returns the cluster ID by name
func GetClusterNameByID ¶
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 ¶
GetV1ProvisioningClusterByName is a helper function that returns the cluster ID by name
func ImportCluster ¶
ImportCluster creates a job using the given rest config that applies the import yaml from the given management cluster.
func IsClusterImported ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
WaitOnClusterAfterSnapshot waits for a cluster to finish taking a snapshot and return to an 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 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
}