Documentation ¶
Index ¶
- Constants
- func AgentAffinityConfigHelper(advancedClusterAffinity *management.Affinity) *corev1.Affinity
- func CheckServiceAccountTokenSecret(client *rancher.Client, clusterName string) (success bool, err error)
- func CreateK3SRKE2Cluster(client *rancher.Client, rke2Cluster *apisV1.Cluster) (*v1.SteveAPIObject, error)
- func CreateRKE1Cluster(client *rancher.Client, rke1Cluster *management.Cluster) (*management.Cluster, error)
- func CreateRancherBaselinePSACT(client *rancher.Client, psact string) 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 HardenK3SClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, ...) *apisV1.Cluster
- func HardenRKE2ClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, ...) *apisV1.Cluster
- func ImportCluster(client *rancher.Client, cluster *apisV1.Cluster, rest *rest.Config) error
- func InTreeSystemConfig(providerName string) (rkeConfig []rkev1.RKESystemConfig)
- 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 NewK3SRKE2ClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, ...) *apisV1.Cluster
- func NewRKE1ClusterConfig(clusterName string, client *rancher.Client, clustersConfig *ClusterConfig) *management.Cluster
- func OutOfTreeSystemConfig(providerName string) (rkeConfig []rkev1.RKESystemConfig)
- func RKESystemConfigTemplate(config map[string]interface{}, selector *metav1.LabelSelector) rkev1.RKESystemConfig
- func ResourceConfigHelper(advancedClusterResourceRequirements *management.ResourceRequirements) *corev1.ResourceRequirements
- func UpdateK3SRKE2Cluster(client *rancher.Client, cluster *v1.SteveAPIObject, ...) (*v1.SteveAPIObject, 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 WatchAndWaitForCluster(client *rancher.Client, steveID string) error
- type ClusterConfig
- 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 AgentAffinityConfigHelper ¶
func AgentAffinityConfigHelper(advancedClusterAffinity *management.Affinity) *corev1.Affinity
AgentAffinityConfigHelper is a "helper" function that converts a management.Affinity struct and returns a corev1.Affinity struct.
func CheckServiceAccountTokenSecret ¶
func CheckServiceAccountTokenSecret(client *rancher.Client, clusterName string) (success bool, err error)
CheckServiceAccountTokenSecret verifies if a serviceAccountTokenSecret exists or not in the cluster.
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 CreateRancherBaselinePSACT ¶
CreateRancherBaselinePSACT creates custom PSACT called rancher-baseline which sets each PSS to baseline.
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 HardenK3SClusterConfig ¶
func HardenK3SClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, machinePools []apisV1.RKEMachinePool, cloudCredentialSecretName string) *apisV1.Cluster
HardenK3SClusterConfig is a constructor for a apisV1.Cluster object, to be used by the rancher.Client.Provisioning client.
func HardenRKE2ClusterConfig ¶
func HardenRKE2ClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, machinePools []apisV1.RKEMachinePool, cloudCredentialSecretName string) *apisV1.Cluster
HardenRKE2ClusterConfig is a constructor for a apisV1.Cluster object, to be used by the rancher.Client.Provisioning client.
func ImportCluster ¶
ImportCluster creates a job using the given rest config that applies the import yaml from the given management cluster.
func InTreeSystemConfig ¶
func InTreeSystemConfig(providerName string) (rkeConfig []rkev1.RKESystemConfig)
InTreeSystemConfig constructs the proper rkeSystemConfig slice for enabling cloud provider in-tree services. Vsphere deprecated 1.21+ AWS deprecated 1.27+ Azure deprecated 1.28+
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 NewK3SRKE2ClusterConfig ¶
func NewK3SRKE2ClusterConfig(clusterName, namespace string, clustersConfig *ClusterConfig, machinePools []apisV1.RKEMachinePool, cloudCredentialSecretName string) *apisV1.Cluster
NewK3SRKE2ClusterConfig is a constructor for a apisV1.Cluster object, to be used by the rancher.Client.Provisioning client.
func NewRKE1ClusterConfig ¶
func NewRKE1ClusterConfig(clusterName string, client *rancher.Client, clustersConfig *ClusterConfig) *management.Cluster
NewRKE1lusterConfig is a constructor for a v3.Cluster object, to be used by the rancher.Client.Provisioning client.
func OutOfTreeSystemConfig ¶
func OutOfTreeSystemConfig(providerName string) (rkeConfig []rkev1.RKESystemConfig)
OutOfTreeSystemConfig constructs the proper rkeSystemConfig slice for enabling the aws cloud provider out-of-tree services
func RKESystemConfigTemplate ¶
func RKESystemConfigTemplate(config map[string]interface{}, selector *metav1.LabelSelector) rkev1.RKESystemConfig
RKESYstemConfigTemplate constructs an RKESystemConfig object given config data and a selector
func ResourceConfigHelper ¶
func ResourceConfigHelper(advancedClusterResourceRequirements *management.ResourceRequirements) *corev1.ResourceRequirements
ResourceConfigHelper is a "helper" function that is used to convert the management.ResourceRequirements struct to a corev1.ResourceRequirements struct.
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 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.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { KubernetesVersion string `json:"kubernetesVersion" yaml:"kubernetesVersion"` CNI string `json:"cni" yaml:"cni"` PSACT string `json:"psact" yaml:"psact"` PNI bool `json:"pni" yaml:"pni"` NodePools []provisioningInput.NodePools `json:"nodepools" yaml:"nodepools"` MachinePools []provisioningInput.MachinePools `json:"machinepools" yaml:"machinepools"` CloudProvider string `json:"cloudProvider" yaml:"cloudProvider"` Providers *[]string `json:"providers" yaml:"providers"` NodeProviders *[]string `json:"nodeProviders" yaml:"nodeProviders"` Hardened bool `json:"hardened" yaml:"hardened"` AddOnConfig *provisioningInput.AddOnConfig `json:"addonConfig" yaml:"addonConfig"` AgentEnvVars *[]rkev1.EnvVar `json:"agentEnvVars" yaml:"agentEnvVars"` AgentEnvVarsRKE1 *[]management.EnvVar `json:"agentEnvVarsRKE1" yaml:"agentEnvVarsRKE1"` ClusterAgent *management.AgentDeploymentCustomization `json:"clusterAgent" yaml:"clusterAgent"` FleetAgent *management.AgentDeploymentCustomization `json:"fleetAgent" yaml:"fleetAgent"` ETCD *rkev1.ETCD `json:"etcd" yaml:"etcd"` ETCDRKE1 *management.ETCDService `json:"etcdRKE1" yaml:"etcdRKE1"` LabelsAndAnnotations *provisioningInput.LabelsAndAnnotations `json:"labelsAndAnnotations" yaml:"labelsAndAnnotations"` Networking *provisioningInput.Networking `json:"networking" yaml:"networking"` Registries *provisioningInput.Registries `json:"registries" yaml:"registries"` UpgradeStrategy *rkev1.ClusterUpgradeStrategy `json:"upgradeStrategy" yaml:"upgradeStrategy"` Advanced *provisioningInput.Advanced `json:"advanced" yaml:"advanced"` ClusterSSHTests []provisioningInput.SSHTestCase `json:"clusterSSHTests" yaml:"clusterSSHTests"` CRIDockerd bool `json:"criDockerd" yaml:"criDockerd"` }
func ConvertConfigToClusterConfig ¶
func ConvertConfigToClusterConfig(provisioningConfig *provisioningInput.Config) *ClusterConfig
ConvertConfigToClusterConfig converts the config from (user) provisioning input to a cluster config
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
}