generators

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TestResourceLabel is a label used on any resources to indicate that they
	// were created as part of a testing run and can be cleaned up in bulk based
	// on the value provided to the label.
	TestResourceLabel = "created-by-ktf"
)

Variables

This section is empty.

Functions

func CleanupGeneratedResources added in v0.6.1

func CleanupGeneratedResources(ctx context.Context, cluster clusters.Cluster, creatorID string) error

CleanupGeneratedResources cleans up all resources created by the given creator ID.

func GenerateNamespace added in v0.6.1

func GenerateNamespace(ctx context.Context, cluster clusters.Cluster, creatorID string) (*corev1.Namespace, error)

GenerateNamespace creates a transient testing namespace given the cluster to create it on and a creator ID. The namespace will be given a UUID for a name, and the creatorID will be applied to the TestResourceLabel for automated cleanup.

func NewClientConfigForRestConfig added in v0.3.0

func NewClientConfigForRestConfig(name string, restcfg *rest.Config) *clientcmdapi.Config

NewClientConfigForRestConfig provides the *clientcmdapi.Config for a cluster given a valid *rest.Config for the target cluster.

func NewContainer

func NewContainer(name, image string, port int32) corev1.Container

NewContainer creates a minimal and opinionated corev1.Container object for testing

func NewDeploymentForContainer

func NewDeploymentForContainer(c corev1.Container) *appsv1.Deployment

NewDeploymentForContainer creates a minimal and opinionated *appsv1.Deployment object for testing based on a provided corev1.Container.

func NewIngressForService

func NewIngressForService(path string, annotations map[string]string, s *corev1.Service) *netv1.Ingress

NewIngressForService provides a basic and opinionated *netv1.Ingress object for the provided *corev1.Service to expose it via an ingress controller for testing purposes.

func NewIngressForServiceWithClusterVersion added in v0.6.1

func NewIngressForServiceWithClusterVersion(kubernetesVersion semver.Version, path string, annotations map[string]string, s *corev1.Service) runtime.Object

NewIngressForServiceWithClusterVersion provides an Ingress record for the provided service, but uses a provided Kubernetes cluster version to determine which Ingress version to provide (provides latest available for release).

func NewKubeConfigForRestConfig added in v0.3.0

func NewKubeConfigForRestConfig(name string, restcfg *rest.Config) ([]byte, error)

NewKubeConfigForRestConfig provides the bytes for a kubeconfig file for use by kubectl or helm given a valid *rest.Config for the target cluster.

func NewLegacyIngressForService added in v0.3.0

func NewLegacyIngressForService(path string, annotations map[string]string, s *corev1.Service) *netv1beta1.Ingress

NewLegacyIngressForService provides a basic and opinionated *netv1beta1.Ingress object for the provided *corev1.Service to expose it via an ingress controller for testing purposes.

func NewServiceForDeployment

func NewServiceForDeployment(d *appsv1.Deployment, serviceType corev1.ServiceType) *corev1.Service

NewServiceForDeployment provides a minimal and opinionated service to expose the provided *appsv1.Deployment for testing purposes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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