util

package
v0.0.0-...-d3d374b Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyCachePollInterval = 100 * time.Millisecond
	PolicyCachePollTimeout  = 5 * time.Second
)

Variables

This section is empty.

Functions

func CleanupServiceAndPod

func CleanupServiceAndPod(pod *kapi.Pod, service *kapi.Service, ns string)

CleanupServiceAndPod removes the Service and the Pod

func CreateNamespace

func CreateNamespace(clusterAdminKubeConfig, name string) (err error)

CreateNamespace creates a namespace with the specified name using the provided kubeconfig DO NOT USE, use create project instead

func CreatePodFromImage

func CreatePodFromImage(stream *imageapi.ImageStream, tag, ns string) *kapi.Pod

CreatePodFromImage creates a Pod from the latest image available in the Image Stream

func CreateServiceForPod

func CreateServiceForPod(pod *kapi.Pod, ns string) *kapi.Service

CreateServiceForPod creates a service to serve the provided Pod

func DeleteAndWaitForNamespaceTermination

func DeleteAndWaitForNamespaceTermination(c *kclient.Client, name string) error

func DumpEtcdOnFailure

func DumpEtcdOnFailure(t *testing.T)

func GetBaseDir

func GetBaseDir() string

GetBaseDir returns the base directory used for test.

func GetClientForServiceAccount

func GetClientForServiceAccount(adminClient *kclient.Client, clientConfig restclient.Config, namespace, name string) (*client.Client, *kclient.Client, *restclient.Config, error)

func GetClientForUser

func GetClientForUser(clientConfig restclient.Config, username string) (*client.Client, *kclient.Client, *restclient.Config, error)

func GetClusterAdminClient

func GetClusterAdminClient(adminKubeConfigFile string) (*client.Client, error)

func GetClusterAdminClientConfig

func GetClusterAdminClientConfig(adminKubeConfigFile string) (*restclient.Config, error)

func GetClusterAdminKubeClient

func GetClusterAdminKubeClient(adminKubeConfigFile string) (*kclient.Client, error)

func GetEtcdURL

func GetEtcdURL() string

func GetImageFixture

func GetImageFixture(filename string) (*imageapi.Image, error)

func GetScopedClientForUser

func GetScopedClientForUser(adminClient *client.Client, clientConfig restclient.Config, username string, scopes []string) (*client.Client, *kclient.Client, *restclient.Config, error)

func GetTemplateFixture

func GetTemplateFixture(filename string) (*templateapi.Template, error)

func KubeConfigPath

func KubeConfigPath() string

func MakeNewEtcdClient

func MakeNewEtcdClient() (etcdclient.Client, error)

func Namespace

func Namespace() string

Namespace returns the test namespace. The default namespace is set to 'integration-test'. You can override it by setting the 'OS_TEST_NAMESPACE' environment variable

func NewDockerClient

func NewDockerClient() (*dockerClient.Client, error)

newDockerClient creates a docker client using the env var DOCKER_ENDPOINT or, if not supplied, uses the default docker endpoint /var/run/docker.sock

func NewEtcdClient

func NewEtcdClient() etcdclient.Client

func NewTestLDAPServer

func NewTestLDAPServer() *testLDAPServer

func RandomNamespace

func RandomNamespace(prefix string) string

RandomNamespace provides random Kubernetes namespace name based on the UNIX timestamp. Optionally you can set the prefix.

func RequireDocker

func RequireDocker()

RequireDocker ensures that a new docker client can be created and that a ListImages command can be run on the client or it fails with glog.Fatal

func RequireEtcd

func RequireEtcd(t *testing.T) *etcdtest.EtcdTestServer

RequireEtcd verifies if the etcd is running and accessible for testing

func VerifyImage

func VerifyImage(stream *imageapi.ImageStream, tag, ns string, validator ValidateFunc) error

VerifyImage verifies if the latest image in given ImageStream is valid

func WaitForAddress

func WaitForAddress(pod *kapi.Pod, service *kapi.Service, ns string) (string, error)

WaitForAddress waits for the Pod to be running and then for the Service to get the endpoint.

func WaitForClusterPolicyUpdate

func WaitForClusterPolicyUpdate(c *client.Client, verb string, resource unversioned.GroupResource, allowed bool) error

WaitForClusterPolicyUpdate checks if the given client can perform the named verb and action. If PolicyCachePollTimeout is reached without the expected condition matching, an error is returned

func WaitForPolicyUpdate

func WaitForPolicyUpdate(c *client.Client, namespace, verb string, resource unversioned.GroupResource, allowed bool) error

WaitForPolicyUpdate checks if the given client can perform the named verb and action. If PolicyCachePollTimeout is reached without the expected condition matching, an error is returned

func WaitForResourceQuotaLimitSync

func WaitForResourceQuotaLimitSync(
	client kclient.ResourceQuotaInterface,
	name string,
	hardLimit kapi.ResourceList,
	timeout time.Duration,
) error

WaitForResourceQuotaSync watches given resource quota until its hard limit is updated to match the desired spec or timeout occurs.

Types

type ValidateFunc

type ValidateFunc func(string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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