Documentation ¶
Index ¶
- Constants
- Variables
- func Backoff(baseDelay, maxDelay time.Duration, retries int) time.Duration
- func CheckAppDeployment(namespace, deployment string, timeout time.Duration, kubeconfig string) error
- func CheckDeployment(ctx context.Context, namespace, deployment string, kubeconfig string) error
- func CheckDeploymentRemoved(namespace, deployment string, kubeconfig string) error
- func CheckDeployments(namespace string, timeout time.Duration, kubeconfig string) error
- func CheckDeploymentsReady(ns string, kubeconfig string) (int, error)
- func CheckPodRunning(n, name string, kubeconfig string) error
- func CheckPodsRunning(n string, kubeconfig string) (ready bool)
- func CheckPodsRunningWithMaxDuration(n string, maxDuration time.Duration, kubeconfig string) (ready bool)
- func Compare(out, model []byte) error
- func CompareFiles(outFile, modelFile string) error
- func CompareToFile(out []byte, modelFile string) error
- func CopyFile(src, dst string) error
- func CreateAndFill(outDir, templateFile string, values interface{}) (string, error)
- func CreateMultiClusterSecret(namespace string, RemoteKubeConfig string, localKubeConfig string) error
- func CreateNamespace(n string, kubeconfig string) error
- func CreateTLSSecret(secretName, n, keyFile, certFile string, kubeconfig string) (string, error)
- func CreateTempfile(tmpDir, prefix, suffix string) (string, error)
- func DeleteDeployment(d string, n string, kubeconfig string) error
- func DeleteMultiClusterSecret(namespace string, RemoteKubeConfig string, localKubeConfig string) error
- func DeleteNamespace(n string, kubeconfig string) error
- func DownloadRelease(version, tmpDir string) (string, error)
- func ExtractTarGz(gzipStream io.Reader) error
- func FetchAndSaveClusterLogs(namespace string, tempDir string, kubeconfig string) error
- func Fill(outFile, inFile string, values interface{}) error
- func GetAppPods(n string, kubeconfig string) (map[string][]string, error)
- func GetAppPodsInfo(n string, kubeconfig string, label string) ([]string, map[string][]string, error)
- func GetClusterSubnet(kubeconfig string) (string, error)
- func GetConfigs(kubeconfig string, names ...string) (string, error)
- func GetHeadCommitSHA(org, repo, branch string) (string, error)
- func GetIngress(serviceName, podLabel, namespace, kubeconfig string, serviceType string) (string, error)
- func GetIngressPodNames(n string, kubeconfig string) ([]string, error)
- func GetKubeConfig(filename string) error
- func GetKubeMasterIP(kubeconfig string) (string, error)
- func GetOsExt() (string, error)
- func GetPodLabelValues(n, label string, kubeconfig string) (map[string]string, error)
- func GetPodLogs(n, pod, container string, tail, alsoShowPreviousPodLogs bool, ...) string
- func GetPodLogsForLabel(n, labelSelector string, container string, tail, alsoShowPreviousPodLogs bool, ...) string
- func GetPodName(n, labelSelector string, kubeconfig string) (pod string, err error)
- func GetPodNames(n string) (pods []string, kubeconfig string)
- func GetPodStatus(n, pod string, kubeconfig string) string
- func GetResourcePath(p string) string
- func GitRootDir() (string, error)
- func HTTPDownload(dst string, src string) error
- func HelmClientInit() error
- func HelmDelete(chartName string) error
- func HelmDepUpdate(chartDir string) error
- func HelmInit(serviceAccount string) error
- func HelmInstall(chartDir, chartName, valueFile, namespace, setValue string) error
- func HelmInstallDryRun(chartDir, chartName, valueFile, namespace, setValue string) error
- func HelmParams(chartDir, chartName, valueFile, namespace, setValue string) string
- func HelmTemplate(chartDir, chartName, namespace, setValue, outfile string) error
- func HelmTest(releaseName string) error
- func HelmTillerRunning() error
- func IsProcessRunning(p *os.Process) (bool, error)
- func IsProcessRunningInt(pid int) (bool, error)
- func IsProcessRunningString(pidS string) (bool, error)
- func KillProcess(p *os.Process) (err error)
- func KubeApply(namespace, yamlFileName string, kubeconfig string) error
- func KubeApplyContentSilent(namespace, yamlContents string, kubeconfig string) error
- func KubeApplyContents(namespace, yamlContents string, kubeconfig string) error
- func KubeApplySilent(namespace, yamlFileName string, kubeconfig string) error
- func KubeDelete(namespace, yamlFileName string, kubeconfig string) error
- func KubeDeleteContents(namespace, yamlContents string, kubeconfig string) error
- func KubeGetYaml(namespace, resource, name string, kubeconfig string) (string, error)
- func KubeScale(namespace, typeName string, replicaCount int, kubeconfig string) error
- func NamespaceDeleted(n string, kubeconfig string) (bool, error)
- func PodExec(n, pod, container, command string, muteOutput bool, kubeconfig string) (string, error)
- func Poll(interval time.Duration, numTrials int, do func() (bool, error)) error
- func Record(command, record string) error
- func RunBackground(format string, args ...interface{}) (*os.Process, error)
- func RunGRPC(port int, version, crt, key string)
- func RunHTTP(port int, version string)
- func Shell(format string, args ...interface{}) (string, error)
- func ShellContext(ctx context.Context, format string, args ...interface{}) (string, error)
- func ShellMuteOutput(format string, args ...interface{}) (string, error)
- func ShellSilent(format string, args ...interface{}) (string, error)
- func ValidatingWebhookConfigurationExists(name string, kubeconfig string) bool
- func WaitForDeploymentsReady(ns string, timeout time.Duration, kubeconfig string) error
- func WriteTempfile(tmpDir, prefix, suffix, contents string) (string, error)
- func WriteTextFile(filePath, content string) error
- type Break
- type EchoClient
- type PodInfo
- type Retrier
- type TearDownFunc
Constants ¶
const ( // NodePortServiceType NodePort type of Kubernetes Service NodePortServiceType = "NodePort" // LoadBalancerServiceType LoadBalancer type of Kubernetes Service LoadBalancerServiceType = "LoadBalancer" )
Variables ¶
var ( // MockPilotGrpcAddr is the address to be used for grpc connections. MockPilotGrpcAddr string // MockPilotSecureAddr is the address to be used for secure grpc connections. MockPilotSecureAddr string // MockPilotSecurePort is the secure port MockPilotSecurePort int // MockPilotHTTPPort is the dynamic port for pilot http MockPilotHTTPPort int // MockPilotGrpcPort is the dynamic port for pilot grpc MockPilotGrpcPort int )
Functions ¶
func Backoff ¶
Backoff returns a random value in [0, maxDelay] that increases exponentially with retries, starting from baseDelay. It is the Go equivalent to C++'s //util/time/backoff.cc.
func CheckAppDeployment ¶
func CheckAppDeployment(namespace, deployment string, timeout time.Duration, kubeconfig string) error
CheckAppDeployment checks whether or not an app in a namespace is ready
func CheckDeployment ¶
CheckDeployment gets status of a deployment from a namespace
func CheckDeploymentRemoved ¶
CheckDeploymentRemoved waits until a deployment is removed or times out
func CheckDeployments ¶
CheckDeployments checks whether all deployments in a given namespace are ready
func CheckDeploymentsReady ¶
CheckDeploymentsReady checks if deployment resources are ready. get podsReady() sometimes gets pods created by the "Job" resource which never reach the "Running" steady state.
func CheckPodRunning ¶
CheckPodRunning return if a given pod with labeled name in a namespace are in "Running" status
func CheckPodsRunning ¶
CheckPodsRunning returns readiness of all pods within a namespace. It will wait for upto 2 mins. use WithMaxDuration to specify a duration.
func CheckPodsRunningWithMaxDuration ¶
func CheckPodsRunningWithMaxDuration(n string, maxDuration time.Duration, kubeconfig string) (ready bool)
CheckPodsRunningWithMaxDuration returns if all pods in a namespace are in "Running" status Also check container status to be running.
func Compare ¶
Compare compares two byte slices. It returns an error with a contextual diff if they are not equal.
func CompareFiles ¶
CompareFiles compares the content of two files
func CompareToFile ¶
CompareToFile compares a content with a file
func CreateAndFill ¶
CreateAndFill fills in the given yaml template with the values and generates a temp file for the completed yaml.
func CreateMultiClusterSecret ¶
func CreateMultiClusterSecret(namespace string, RemoteKubeConfig string, localKubeConfig string) error
CreateMultiClusterSecret will create the secret associated with the remote cluster
func CreateNamespace ¶
CreateNamespace create a kubernetes namespace
func CreateTLSSecret ¶
CreateTLSSecret creates a secret from the provided cert and key files
func CreateTempfile ¶
CreateTempfile creates a tempfile string.
func DeleteDeployment ¶
DeleteDeployment deletes deployment from the specified namespace
func DeleteMultiClusterSecret ¶
func DeleteMultiClusterSecret(namespace string, RemoteKubeConfig string, localKubeConfig string) error
DeleteMultiClusterSecret delete the remote cluster secret
func DeleteNamespace ¶
DeleteNamespace delete a kubernetes namespace
func DownloadRelease ¶
DownloadRelease gets the specified release from istio repo to tmpDir.
func ExtractTarGz ¶
ExtractTarGz extracts a .tar.gz file into current dir.
func FetchAndSaveClusterLogs ¶
FetchAndSaveClusterLogs will dump the logs for a cluster.
func GetAppPods ¶
GetAppPods gets a map of app names to the pods for the app, for the given namespace
func GetAppPodsInfo ¶
func GetAppPodsInfo(n string, kubeconfig string, label string) ([]string, map[string][]string, error)
GetAppPodsInfo returns a map of a list of PodInfo
func GetClusterSubnet ¶
GetClusterSubnet returns the subnet (in CIDR form, e.g. "24") for the nodes in the cluster.
func GetConfigs ¶
GetConfigs retrieves the configurations for the list of resources.
func GetHeadCommitSHA ¶
GetHeadCommitSHA finds the SHA of the commit to which the HEAD of branch points
func GetIngress ¶
func GetIngress(serviceName, podLabel, namespace, kubeconfig string, serviceType string) (string, error)
GetIngress get istio ingress ip and port. Could relate to either Istio Ingress or to Istio Ingress Gateway, by serviceName and podLabel. Handles two cases: when the Ingress/Ingress Gateway Kubernetes Service is a LoadBalancer or NodePort (for tests within the cluster, including for minikube)
func GetIngressPodNames ¶
GetIngressPodNames get the pod names for the Istio ingress deployment.
func GetKubeConfig ¶
GetKubeConfig will create a kubeconfig file based on the active environment the test is run in
func GetKubeMasterIP ¶
GetKubeMasterIP returns the IP address of the kubernetes master service.
func GetPodLabelValues ¶
GetPodLabelValues gets a map of pod name to label value for the given label and namespace
func GetPodLogs ¶
func GetPodLogs(n, pod, container string, tail, alsoShowPreviousPodLogs bool, kubeconfig string) string
GetPodLogs retrieves the logs for the given namespace, pod and container.
func GetPodLogsForLabel ¶
func GetPodLogsForLabel(n, labelSelector string, container string, tail, alsoShowPreviousPodLogs bool, kubeconfig string) string
GetPodLogsForLabel gets the logs for the given label selector and container
func GetPodName ¶
GetPodName gets the pod name for the given namespace and label selector
func GetPodNames ¶
GetPodNames gets names of all pods in specific namespace and return in a slice
func GetPodStatus ¶
GetPodStatus gets status of a pod from a namespace Note: It is not enough to check pod phase, which only implies there is at least one container running. Use kubectl CLI to get status so that we can ensure that all containers are running.
func GetResourcePath ¶
GetResourcePath give "path from WORKSPACE", return absolute path at runtime
func GitRootDir ¶
GitRootDir returns the absolute path to the root directory of the git repo where this function is called
func HTTPDownload ¶
HTTPDownload download from src(url) and store into dst(local file)
func HelmDepUpdate ¶
HelmDepUpdate helm dep update to update dependencies for umrella charts
func HelmInstall ¶
HelmInstall helm install from a chart for a given namespace
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
func HelmInstallDryRun ¶
HelmInstallDryRun helm install dry run from a chart for a given namespace
func HelmParams ¶
HelmParams provides a way to construct helm params
func HelmTemplate ¶
HelmTemplate helm template from a chart for a given namespace
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
func HelmTillerRunning ¶
func HelmTillerRunning() error
HelmTillerRunning will block for up to 120 seconds waiting for Tiller readiness
func IsProcessRunning ¶
IsProcessRunning check if a os.Process is running
func IsProcessRunningInt ¶
IsProcessRunningInt check if a process of the given pid(int) is running
func IsProcessRunningString ¶
IsProcessRunningString check if a process of the given pid(string) is running
func KubeApplyContentSilent ¶
KubeApplyContentSilent kubectl apply from contents silently
func KubeApplyContents ¶
KubeApplyContents kubectl apply from contents
func KubeApplySilent ¶
KubeApplySilent kubectl apply from file silently
func KubeDelete ¶
KubeDelete kubectl delete from file
func KubeDeleteContents ¶
KubeDeleteContents kubectl apply from contents
func KubeGetYaml ¶
KubeGetYaml kubectl get yaml content for given resource.
func NamespaceDeleted ¶
NamespaceDeleted check if a kubernete namespace is deleted
func PodExec ¶
PodExec runs the specified command on the container for the specified namespace and pod
func Poll ¶
Poll executes do() after time interval for a max of numTrials times. The bool returned by do() indicates if polling succeeds in that trial
func RunBackground ¶
RunBackground starts a background process and return the Process if succeed
func ShellContext ¶
ShellContext run command on shell and get back output and error if get one
func ShellMuteOutput ¶
ShellMuteOutput run command on shell and get back output and error if get one without logging the output
func ShellSilent ¶
ShellSilent runs command on shell and get back output and error if get one without logging the command or output.
func ValidatingWebhookConfigurationExists ¶
ValidatingWebhookConfigurationExists check if a kubernetes ValidatingWebhookConfiguration is deleted
func WaitForDeploymentsReady ¶
WaitForDeploymentsReady wait up to 'timeout' duration return an error if deployments are not ready
func WriteTempfile ¶
WriteTempfile creates a tempfile with the specified contents.
func WriteTextFile ¶
WriteTextFile overwrites the file on the given path with content
Types ¶
type Break ¶
type Break struct {
Err error
}
Break the retry loop if the error returned is of this type.
type EchoClient ¶
type EchoClient struct {
// contains filtered or unexported fields
}
EchoClient controls the client
type PodInfo ¶
type PodInfo struct { // Name is the pod's name Name string // IPAddr is the pod's IP IPAddr string }
PodInfo contains pod's information such as name and IP address
type Retrier ¶
type Retrier struct { // BaseDelay is the minimum delay between retry attempts. BaseDelay time.Duration // MaxDelay is the maximum delay allowed between retry attempts. MaxDelay time.Duration // MaxDuration is the maximum cumulative duration allowed for all retries MaxDuration time.Duration // Retries defines number of retry attempts Retries int }
Retrier contains the retry configuration parameters.
type TearDownFunc ¶
type TearDownFunc func()
TearDownFunc is to be called to tear down a test server.
func EnsureTestServer ¶
func EnsureTestServer(args ...func(*bootstrap.PilotArgs)) (*bootstrap.Server, TearDownFunc)
EnsureTestServer will ensure a pilot server is running in process and initializes the MockPilotUrl and MockPilotGrpcAddr to allow connections to the test pilot.