util

package
v0.0.0-...-53afbcf Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// How often to poll for conditions.
	Poll = 2 * time.Second
)

Variables

View Source
var Scheme = runtime.NewScheme()

Functions

func CreateKubeNamespace

func CreateKubeNamespace(baseName string, kubeClientSet kubernetes.Interface) (*v1.Namespace, error)

CreateKubeNamespace creates a new Kubernetes Namespace for a test.

func DeleteKubeNamespace

func DeleteKubeNamespace(namespace string, kubeClientSet kubernetes.Interface) error

DeleteKubeNamespace will delete a namespace resource.

func ExecCmd

func ExecCmd(client kubernetes.Interface, config *restclient.Config, podName, namespace string,
	command string) (string, error)

ExecCmd exec command on specific pod and wait the command's output.

func GetKubeSA

func GetKubeSA(baseName string, kubeClientSet kubernetes.Interface, ns string) (*v1.ServiceAccount, error)

UpdateKubeSA updates a new Kubernetes Service Account for a test.

func NewConfig

NewConfig loads and returns the kubernetes credentials from the environment. KUBECONFIG env var takes precedence and falls back to in-cluster config.

func UpdateKubeSA

func UpdateKubeSA(baseName string, kubeClientSet kubernetes.Interface, ns string, annotations map[string]string) (*v1.ServiceAccount, error)

UpdateKubeSA updates a new Kubernetes Service Account for a test.

func WaitForKubeNamespaceNotExist

func WaitForKubeNamespaceNotExist(namespace string, kubeClientSet kubernetes.Interface) error

WaitForKubeNamespaceNotExist will wait for the namespace with the given name to not exist for up to 2 minutes.

func WaitForPodsReady

func WaitForPodsReady(kubeClientSet kubernetes.Interface, expectedReplicas int, namespace string, opts metav1.ListOptions) error

WaitForPodsReady waits for a given amount of time until a group of Pods is running in the given namespace.

func WaitForPodsRunning

func WaitForPodsRunning(kubeClientSet kubernetes.Interface, expectedReplicas int, namespace string, opts metav1.ListOptions) (*v1.PodList, error)

WaitForPodsRunning waits for a given amount of time until a group of Pods is running in the given namespace.

func WaitForURL

func WaitForURL(url string) error

WaitForURL tests the provided url. Once a http 200 is returned the func returns with no error. Timeout is 5min.

Types

This section is empty.

Jump to

Keyboard shortcuts

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