generators

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultRequiredCompletionsForJobs indicates the number of Pod
	// completions that will be required by default for any generated
	// Job resources.
	DefaultRequiredCompletionsForJobs int32 = 1
)

Functions

func GenerateBashJob added in v0.7.0

func GenerateBashJob(image, imageTag string, commands ...string) (*corev1.ConfigMap, *batchv1.Job)

GenerateBashJob will create a ConfigMap and a Job that can be deployed to run a bash script given the container image you want the job to run and the shell commands you want the job to execute as arguments. By default this will only generate a single container, and you can provide env vars to be loaded into it.

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 NewIngressForContainerWithDeploymentAndService added in v0.8.0

func NewIngressForContainerWithDeploymentAndService(
	kubernetesVersion semver.Version,
	c corev1.Container,
	serviceType corev1.ServiceType,
	annotations map[string]string,
	path string,
) (*appsv1.Deployment, *corev1.Service, runtime.Object)

NewIngressForContainerWithDeploymentAndService generates a Deployment, Service, and Ingress given a container. The idea is that if you have a container that provides an HTTP endpoint, this function can be used to generate everything you need to deploy to the cluster to start accessing that HTTP server from outside the cluster via Ingress. This effectively just compiles together multiple generators for convenience, look at the individual generators used here if you're looking for something more granular.

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 the ports and targetports from the service will match the container ports.

func NewServiceForDeploymentWithMappedPorts added in v0.11.0

func NewServiceForDeploymentWithMappedPorts(d *appsv1.Deployment, serviceType corev1.ServiceType, portMap map[int32]int32) *corev1.Service

NewServiceForDeployment provides a minimal and opinionated service to expose the provided *appsv1.Deployment but accepts an optional map of container ports to service ports to allow custom port declarations rather than mapping ports according to the container ports. The keys on the portmap are the container ports, the values are the service ports you want them mapped to. The portmap doesn't have to have a mapping for every port you can leave any blank you want, if you do they will be defaulted to the containerports found in the deployment.

Types

This section is empty.

Jump to

Keyboard shortcuts

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