util

package
v0.8.2-beta.7 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabelToCRD

func AddLabelToCRD(ctx context.Context, crd, label string) error

func AddLabelToPod

func AddLabelToPod(ctx context.Context, podName, namespace, label string) error

func AddLabelToPv

func AddLabelToPv(ctx context.Context, pv, label string) error

func AddLabelToPvc

func AddLabelToPvc(ctx context.Context, pvc, namespace, label string) error

func BuildAddonLabelSelector

func BuildAddonLabelSelector() string

func CRDCountShouldBe

func CRDCountShouldBe(ctx context.Context, name string, count int) error

func CRDShouldExist

func CRDShouldExist(ctx context.Context, name string) error

func CRDShouldNotExist

func CRDShouldNotExist(ctx context.Context, name string) error

func Check added in v0.6.0

func Check(command string, input string) (string, error)

func CheckClusterStatus

func CheckClusterStatus(name, ns string, status string) bool

func CheckCommand added in v0.7.0

func CheckCommand(command string, path string) bool

func CheckKbcliExists

func CheckKbcliExists() error

func CheckPodStatus

func CheckPodStatus(name, ns string) map[string]bool

func Count added in v0.7.0

func Count(filename, substring string) (int, error)

func CreateFileToPod

func CreateFileToPod(ctx context.Context, namespace, podName, volume, filename, content string) error

func CreateSecretFromFiles

func CreateSecretFromFiles(ctx context.Context, client TestClient, namespace string, name string, files map[string]string) error

func DeleteVeleroDs

func DeleteVeleroDs(ctx context.Context) error

func EnsureClusterExists

func EnsureClusterExists(ctx context.Context) error

func ExecCommand

func ExecCommand(strCommand string) string

func ExecCommandReadline

func ExecCommandReadline(strCommand string) []string

func ExecuteCommand

func ExecuteCommand(command string) bool

func GetAPIVersions

func GetAPIVersions(client *TestClient, name string) ([]string, error)

func GetCRD

func GetCRD(ctx context.Context, name string) ([]string, error)

func GetClusterCreateYaml

func GetClusterCreateYaml(files []string) string

func GetClusterVersion

func GetClusterVersion(folder string) (result []string)

func GetConfig

func GetConfig() (*rest.Config, error)

func GetFiles

func GetFiles(path string) ([]string, error)

func GetFolders

func GetFolders(path string) ([]string, error)

func GetName added in v0.6.0

func GetName(fileName string) (name, ns string)

func GetPrefix

func GetPrefix(str string, sub string) (s string)

func GetPvByPvc

func GetPvByPvc(ctx context.Context, namespace, pvc string) ([]string, error)

func GetPvcByPodName

func GetPvcByPodName(ctx context.Context, namespace, podName string) ([]string, error)

func KubectlApplyByFile

func KubectlApplyByFile(ctx context.Context, file string) error

func KubectlConfigUseContext

func KubectlConfigUseContext(ctx context.Context, kubectlContext string) error

func KubectlGetInfo

func KubectlGetInfo(cmdName string, arg []string)

func OpsYaml

func OpsYaml(file string, ops string) bool

func ReadFileFromPodVolume

func ReadFileFromPodVolume(ctx context.Context, namespace, podName, volume, filename string) (string, error)

func ReadLine added in v0.7.0

func ReadLine(fileName string, name string) string

func ReadLineLast added in v0.6.0

func ReadLineLast(fileName string, name string) string

func RemoveElements added in v0.7.0

func RemoveElements(arr []string, elemsToRemove []string) []string

func ReplaceClusterVersionRef

func ReplaceClusterVersionRef(fileName string, clusterVersionRef string)

func StringSplit added in v0.6.0

func StringSplit(str string) string

func StringStrip

func StringStrip(str string) string

func UploadToS3 added in v0.6.0

func UploadToS3(fileName, s3Directory, bucketName string) error

func WaitForCRDEstablished

func WaitForCRDEstablished(crdName string) error

func WaitForPods

func WaitForPods(ctx context.Context, client TestClient, namespace string, pods []string) error

WaitForPods waits till all pods arrive at PodRunning state

func WaitTime

func WaitTime(num int)

Types

type TestClient

type TestClient struct {
	Kubebuilder kbclient.Client
	ClientGo    kubernetes.Interface
	// contains filtered or unexported fields
}

TestClient defines the desired type of Client

func InitTestClient

func InitTestClient(kubecontext string) (TestClient, error)

InitTestClient inits different type clients

func NewTestClient

func NewTestClient(kubecontext string) (TestClient, error)

NewTestClient returns a set of ready-to-use API clients.

Jump to

Keyboard shortcuts

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