Documentation ¶
Index ¶
- Variables
- func CreateNSForTest(ctx context.Context, cfg *envconf.Config, t *testing.T) (context.Context, error)
- func DeleteNSForTest(ctx context.Context, cfg *envconf.Config, t *testing.T) (context.Context, error)
- func EnsureExternalDns(ctx context.Context, client klient.Client, name string) error
- func EnsureExternalDnsCleaned(ctx context.Context, client klient.Client, name string) error
- func GetDeployment(ctx context.Context) (*appsv1.Deployment, error)
- func GetHostname(ns, dnsZoneId string) string
- func GetNamespaceKey(t *testing.T) string
- func RetryBackoff(tries int, initialSleep time.Duration, f func() error) error
- func SetDeployment(ctx context.Context, deployment *appsv1.Deployment) context.Context
- func UpdateContainerDnsZoneIds(deployment *appsv1.Deployment, dnsIds []string) ([]corev1.Container, error)
- func UpdateContainers(ctx context.Context, client klient.Client, deployment *appsv1.Deployment, ...) error
Constants ¶
This section is empty.
Variables ¶
View Source
var Purge = func(ctx context.Context, cfg *envconf.Config) (context.Context, error) { client, err := cfg.NewClient() if err != nil { return nil, fmt.Errorf("failed to create client during setup/purge: %s", err) } var list corev1.NamespaceList err = client.Resources().List(ctx, &list, func(opts *metav1.ListOptions) { opts.LabelSelector = "app.kubernetes.io/managed-by=e2eutil" }) if err != nil { fmt.Printf("error while listing namespaces to purge past test runs: %s\n", err) return ctx, err } for _, item := range list.Items { err = client.Resources().Delete(ctx, &item) if err != nil { fmt.Printf("error while cleaning up namespace %q: %s\n", item.Name, err) return ctx, err } } promClusterRoleBinding := &rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{ Name: fixtures.PromServer, }} if err := client.Resources().Delete(ctx, promClusterRoleBinding); err != nil && !k8serrors.IsNotFound(err) { return ctx, err } promClusterRole := &rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{ Name: fixtures.PromServer, }} if err := client.Resources().Delete(ctx, promClusterRole); err != nil && !k8serrors.IsNotFound(err) { return ctx, err } return ctx, nil }
Purge cleans up resources created by the previous run.
Functions ¶
func CreateNSForTest ¶ added in v0.0.2
func CreateNSForTest(ctx context.Context, cfg *envconf.Config, t *testing.T) (context.Context, error)
CreateNSForTest creates a random namespace with the runID as a prefix. It is stored in the context so that the deleteNSForTest routine can look it up and delete it.
func DeleteNSForTest ¶ added in v0.0.2
func DeleteNSForTest(ctx context.Context, cfg *envconf.Config, t *testing.T) (context.Context, error)
DeleteNSForTest looks up the namespace corresponding to the given test and deletes it.
func EnsureExternalDns ¶ added in v0.0.3
func EnsureExternalDnsCleaned ¶ added in v0.0.3
func GetDeployment ¶ added in v0.0.3
func GetDeployment(ctx context.Context) (*appsv1.Deployment, error)
func GetHostname ¶ added in v0.0.2
func GetNamespaceKey ¶ added in v0.0.2
GetNamespaceKey returns the context key for a given test
func RetryBackoff ¶ added in v0.0.3
func SetDeployment ¶ added in v0.0.3
func UpdateContainerDnsZoneIds ¶ added in v0.0.3
func UpdateContainerDnsZoneIds(deployment *appsv1.Deployment, dnsIds []string) ([]corev1.Container, error)
UpdateContainerDnsZoneIds updates the dns zone ids for the operator container in the given deployment and returns the new containers. This does not update the deployment.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.