Documentation ¶
Index ¶
- Constants
- Variables
- func AddRancherCharts()
- func CheckMapKeys(map1, map2 map[string]string) (exists bool)
- func CheckRancherPods(wait bool)
- func ClusterIsReadyChecks(cluster *management.Cluster, client *rancher.Client, clusterName string)
- func CommonSynchronizedBeforeSuite()
- func ContainsString(slice []string, item string) bool
- func CreateCloudCredentials(client *rancher.Client) (string, error)
- func CreateStdUserClient(ctx *Context)
- func DefaultK8sVersion(descVersions []string, forUpgrade bool) (string, error)
- func DeployRancherManager(fullVersion string, checkPods bool)
- func DowngradeProviderChart(downgradeChartVersion string)
- func FilterUIUnsupportedVersions(versions []string, client *rancher.Client) (filteredVersions []string)
- func GetAKSLocation() string
- func GetCommonMetadataLabels() map[string]string
- func GetCurrentOperatorChartVersion() string
- func GetDowngradeOperatorChartVersion(currentChartVersion string) string
- func GetEKSRegion() string
- func GetGKEProjectID() string
- func GetGKERegion() string
- func GetGKEZone() string
- func GetRancherIP() (rancherIP string)
- func HighestK8sMinorVersionSupportedByUI(client *rancher.Client) (value string)
- func SetTempKubeConfig(clusterName string)
- func UninstallOperatorCharts()
- func UpdateOperatorChartsVersion(updateChartVersion string)
- func VersionCompare(v, o string) int
- func WaitUntilClusterIsReady(cluster *management.Cluster, client *rancher.Client) (*management.Cluster, error)
- func WaitUntilOperatorChartInstallation(chartVersion, comparator string, compareTo int)
- type Context
- type HelmChart
- type RancherVersionInfo
Constants ¶
const ( Timeout = 30 * time.Minute CattleSystemNS = "cattle-system" )
Variables ¶
var ( RancherPassword = os.Getenv("RANCHER_PASSWORD") RancherHostname = os.Getenv("RANCHER_HOSTNAME") RancherChannel = func() string { if channel := os.Getenv("RANCHER_CHANNEL"); channel != "" { return channel } else { return "latest" } }() Provider = os.Getenv("PROVIDER") ClusterNamePrefix = func() string { if clusterCleanup { return fmt.Sprintf("%s-hp-ci", Provider) } else { return fmt.Sprintf("%s-%s-hp-ci", Provider, testuser.Username) } }() RancherVersion = os.Getenv("RANCHER_VERSION") RancherUpgradeVersion = os.Getenv("RANCHER_UPGRADE_VERSION") Kubeconfig = os.Getenv("KUBECONFIG") DownstreamKubeconfig = func(clusterName string) string { return fmt.Sprintf("%s_KUBECONFIG", clusterName) } K8sUpgradedMinorVersion = os.Getenv("K8S_UPGRADE_MINOR_VERSION") DownstreamK8sMinorVersion = os.Getenv("DOWNSTREAM_K8S_MINOR_VERSION") IsImport = func() bool { if strings.Contains(os.Getenv("CATTLE_TEST_CONFIG"), "import") { return true } return false }() )
Functions ¶
func AddRancherCharts ¶
func AddRancherCharts()
AddRancherCharts adds the repo from which rancher can be installed
func CheckMapKeys ¶
CheckMapElements checks if map1 keys are subset of map2
func CheckRancherPods ¶
func CheckRancherPods(wait bool)
func ClusterIsReadyChecks ¶
func ClusterIsReadyChecks(cluster *management.Cluster, client *rancher.Client, clusterName string)
ClusterIsReadyChecks runs the basic checks on a cluster such as cluster name, service account, nodes and pods check
func CommonSynchronizedBeforeSuite ¶
func CommonSynchronizedBeforeSuite()
func ContainsString ¶
func CreateStdUserClient ¶
func CreateStdUserClient(ctx *Context)
func DefaultK8sVersion ¶
DefaultK8sVersion receives a list of version sorted in descending order (1.29, 1.28, 1.27, etc.); it returns the k8s version to be used by the test depending on forUpgrade param
func DeployRancherManager ¶
DeployRancherManager deploys Rancher. If checkPods is true, it waits until all the necessary pods are running fullVersion: devel/2.9, 2.9.0, 2.9.0-rc1
func DowngradeProviderChart ¶
func DowngradeProviderChart(downgradeChartVersion string)
func FilterUIUnsupportedVersions ¶
func FilterUIUnsupportedVersions(versions []string, client *rancher.Client) (filteredVersions []string)
FilterUIUnsupportedVersions filters all k8s versions that are not supported by the UI
func GetAKSLocation ¶
func GetAKSLocation() string
GetAKSLocation fetches the value of AKS Region; it first obtains the value from env var AKS_REGION, if the value is empty, it fetches the information from config file(cattle_config-import.yaml/cattle_config-provisioning.yaml) if none of the sources can provide a value, it returns the default value
func GetCommonMetadataLabels ¶
GetCommonMetadataLabels returns a list of common metadata labels/tabs
func GetCurrentOperatorChartVersion ¶
func GetCurrentOperatorChartVersion() string
GetCurrentOperatorChartVersion returns the current version of a Provider chart.
func GetDowngradeOperatorChartVersion ¶
GetDowngradeOperatorChartVersion returns a version to downgrade to from a given chart version.
func GetEKSRegion ¶
func GetEKSRegion() string
GetEKSRegion fetches the value of EKS Region; it first obtains the value from env var EKS_REGION, if the value is empty, it fetches the information from config file(cattle_config-import.yaml/cattle_config-provisioning.yaml) if none of the sources can provide a value, it returns the default value
func GetGKEProjectID ¶
func GetGKEProjectID() string
GetGKEProjectID returns the value of GKE project by fetching the value of env var GKE_PROJECT_ID
func GetGKERegion ¶
func GetGKERegion() string
GetGKERegion fetches the value of GKE region; it first obtains the value from env var GKE_REGION, if the value is empty, it fetches the information from config file(cattle_config-provisioning.yaml) if none of the sources can provide a value, it returns the default value
func GetGKEZone ¶
func GetGKEZone() string
GetGKEZone fetches the value of GKE zone; it first obtains the value from env var GKE_ZONE, if the value is empty, it fetches the information from config file(cattle_config-import.yaml/cattle_config-provisioning.yaml) if none of the sources can provide a value, it returns the default value
func GetRancherIP ¶
func GetRancherIP() (rancherIP string)
Returns Rancher ipv4 address based on hostname
func HighestK8sMinorVersionSupportedByUI ¶
HighestK8sMinorVersionSupportedByUI returns the highest k8s version supported by UI TODO(pvala): Use this by default when fetching a list of k8s version for all the downstream providers.
func SetTempKubeConfig ¶
func SetTempKubeConfig(clusterName string)
func UninstallOperatorCharts ¶
func UninstallOperatorCharts()
UninstallOperatorCharts uninstalls the operator charts
func UpdateOperatorChartsVersion ¶
func UpdateOperatorChartsVersion(updateChartVersion string)
UpdateOperatorChartsVersion updates the operator charts to a given chart version and validates that the current version is same as provided
func VersionCompare ¶
VersionCompare compares Versions v to o: -1 == v is less than o 0 == v is equal to o 1 == v is greater than o
func WaitUntilClusterIsReady ¶
func WaitUntilClusterIsReady(cluster *management.Cluster, client *rancher.Client) (*management.Cluster, error)
WaitUntilClusterIsReady waits until the cluster is in a Ready state, fetch the cluster again once it's ready so that it has everything up to date and then return it. For e.g. once the cluster has been updated, it contains information such as Version.GitVersion which it does not have before it's ready If the cluster is imported; it also updates the ProviderConfig with ProviderStatus.UpstreamSpec data
func WaitUntilOperatorChartInstallation ¶
WaitUntilOperatorChartInstallation waits until the current operator chart version compares to the input chartVersion using the comparator. comparator values can be >,<,<=,>=,==,!= compareTo value can be 0 if current == input; -1 if current < input; 1 if current > input; defaults to 0 compareTo is helpful in case either of the chart version is unknown; for e.g. after a rancher upgrade, if only the old chart version is known then we can wait until the current chart version is greater than it
Types ¶
type Context ¶
type Context struct { RancherAdminClient *rancher.Client StdUserClient *rancher.Client Session *session.Session ClusterCleanup bool CloudCredID string }
func CommonBeforeSuite ¶
func CommonBeforeSuite() Context
type HelmChart ¶
type HelmChart struct { Name string `json:"name"` Chart string `json:"chart"` AppVersion string `json:"app_version"` DerivedVersion string `json:"version"` }
func ListChartVersions ¶
ListChartVersions lists all the available the chart version for a given chart name
func ListOperatorChart ¶
func ListOperatorChart() (operatorCharts []HelmChart)
ListOperatorChart lists the installed provider charts for a provider in cattle-system; it fetches the provider value using Provider