resources

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package resource contains helpers to generate Kubernetes API objects.

Index

Constants

View Source
const (
	// appNameLabel is the name of the application.
	AppNameLabel = "app.kubernetes.io/name"
	// appInstanceLabel is a unique name identifying the instance of an application.
	AppInstanceLabel = "app.kubernetes.io/instance"
	// appComponentLabel is the component within the architecture.
	AppComponentLabel = "app.kubernetes.io/component"
	// appPartOfLabel is the name of a higher level application this one is part of.
	AppPartOfLabel = "app.kubernetes.io/part-of"
	// appManagedByLabel is the tool being used to manage the operation of an application.
	AppManagedByLabel = "app.kubernetes.io/managed-by"
)

Kubernetes recommended labels https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/

View Source
const (
	PartOf    = "triggermesh"
	ManagedBy = "triggermesh-core"
)

Common label values

Variables

This section is empty.

Functions

func NewCRD

name must be formatted as <plural-resource>.<group>.

func NewCRDVersion

func NewCRDVersion(version string, served, storage bool, spec *apiextensionsv1.JSONSchemaProps, opts ...CRDVersionOption) (*apiextensionsv1.CustomResourceDefinitionVersion, error)

name must be formatted as <plural-resource>.<group>.

func NewContainer

func NewContainer(name, image string, opts ...ContainerOption) *corev1.Container

func NewDeployment

func NewDeployment(namespace, name string, opts ...DeploymentOption) *appsv1.Deployment

func NewKnativeService

func NewKnativeService(namespace, name string, opts ...KnativeServiceOption) *servingv1.Service

func NewMeta

func NewMeta(ns, name string, opts ...MetaOption) *metav1.ObjectMeta

func NewPodSpec

func NewPodSpec(opts ...PodSpecOption) *corev1.PodSpec

func NewRoleBinding

func NewRoleBinding(namespace, name, roleName, subjectName string, opts ...RoleBindingOption) *rbacv1.RoleBinding

func NewSecret

func NewSecret(namespace, name string, opts ...SecretOption) *corev1.Secret

func NewSecurityContext

func NewSecurityContext(opts ...SecurityContextOption) *corev1.SecurityContext

func NewService

func NewService(namespace, name string, opts ...ServiceOption) *corev1.Service

func NewServiceAccount

func NewServiceAccount(namespace, name string, opts ...ServiceAccountOption) *corev1.ServiceAccount

func NewVolume

func NewVolume(name string, opts ...VolumeOption) *corev1.Volume

func NewVolumeMount

func NewVolumeMount(name, mountPath string, opts ...VolumeMountOption) *corev1.VolumeMount

Types

type CRDOption

func CRDWithMetaOptions

func CRDWithMetaOptions(opts ...MetaOption) CRDOption

func CRDWithNames

Plural name should not be informed. In case it is it should be set according to the name and group of the CRD.

type ContainerOption

type ContainerOption func(*corev1.Container)

func ContainerAddArgs

func ContainerAddArgs(s string) ContainerOption

func ContainerAddEnv

func ContainerAddEnv(ev *corev1.EnvVar) ContainerOption

func ContainerAddEnvFromFieldRef

func ContainerAddEnvFromFieldRef(name, path string) ContainerOption

func ContainerAddEnvFromValue

func ContainerAddEnvFromValue(name, value string) ContainerOption

func ContainerAddEnvVarFromConfigMap

func ContainerAddEnvVarFromConfigMap(name, cmName, cmKey string) ContainerOption

func ContainerAddEnvVarFromSecret

func ContainerAddEnvVarFromSecret(name, secretName, secretKey string) ContainerOption

func ContainerAddPort

func ContainerAddPort(name string, containerPort int32) ContainerOption

func ContainerAddVolumeMount

func ContainerAddVolumeMount(vm *corev1.VolumeMount) ContainerOption

func ContainerWithImagePullPolicy

func ContainerWithImagePullPolicy(policy corev1.PullPolicy) ContainerOption

func ContainerWithSecurityContext

func ContainerWithSecurityContext(sc *corev1.SecurityContext) ContainerOption

func ContainerWithTerminationMessagePolicy

func ContainerWithTerminationMessagePolicy(policy corev1.TerminationMessagePolicy) ContainerOption

type DeploymentOption

type DeploymentOption func(*appsv1.Deployment)

func DeploymentAddSelectorForTemplate

func DeploymentAddSelectorForTemplate(key, value string) DeploymentOption

func DeploymentSetReplicas

func DeploymentSetReplicas(replicas int32) DeploymentOption

func DeploymentWithMetaOptions

func DeploymentWithMetaOptions(opts ...MetaOption) DeploymentOption

func DeploymentWithTemplateSpecOptions

func DeploymentWithTemplateSpecOptions(opts ...PodTemplateSpecOption) DeploymentOption

type KnativeServiceOption

type KnativeServiceOption func(*servingv1.Service)

func KnativeServiceWithMetaOptions

func KnativeServiceWithMetaOptions(opts ...MetaOption) KnativeServiceOption

func KnativeServiceWithRevisionOptions

func KnativeServiceWithRevisionOptions(opts ...RevisionTemplateOption) KnativeServiceOption

type MetaOption

type MetaOption func(*metav1.ObjectMeta)

func MetaAddAnnotation

func MetaAddAnnotation(key, value string) MetaOption

func MetaAddLabel

func MetaAddLabel(key, value string) MetaOption

func MetaAddOwner

func MetaAddOwner(o metav1.Object, gvk schema.GroupVersionKind) MetaOption

type PodSpecOption

type PodSpecOption func(*corev1.PodSpec)

func PodSpecAddContainer

func PodSpecAddContainer(c *corev1.Container) PodSpecOption

func PodSpecAddVolume

func PodSpecAddVolume(v *corev1.Volume) PodSpecOption

func PodSpecWithServiceAccountName

func PodSpecWithServiceAccountName(saName string) PodSpecOption

type PodTemplateSpecOption

type PodTemplateSpecOption func(*corev1.PodTemplateSpec)

func PodTemplateSpecWithMetaOptions

func PodTemplateSpecWithMetaOptions(opts ...MetaOption) PodTemplateSpecOption

func PodTemplateSpecWithPodSpecOptions

func PodTemplateSpecWithPodSpecOptions(opts ...PodSpecOption) PodTemplateSpecOption

type RevisionTemplateOption

type RevisionTemplateOption func(*servingv1.RevisionTemplateSpec)

func RevisionSpecWithPodSpecOptions

func RevisionSpecWithPodSpecOptions(opts ...PodSpecOption) RevisionTemplateOption

func RevisionWithMetaOptions

func RevisionWithMetaOptions(opts ...MetaOption) RevisionTemplateOption

type RoleBindingOption

type RoleBindingOption func(*rbacv1.RoleBinding)

func RoleBindingWithMetaOptions

func RoleBindingWithMetaOptions(opts ...MetaOption) RoleBindingOption

type SecretOption

type SecretOption func(*corev1.Secret)

func SecretSetData

func SecretSetData(key string, value []byte) SecretOption

func SecretWithMetaOptions

func SecretWithMetaOptions(opts ...MetaOption) SecretOption

type SecurityContextOption

type SecurityContextOption func(*corev1.SecurityContext)

func SecurityContextWithPrivilegeEscalation

func SecurityContextWithPrivilegeEscalation(pe bool) SecurityContextOption

func SecurityContextWithReadOnlyRootFilesystem

func SecurityContextWithReadOnlyRootFilesystem(ro bool) SecurityContextOption

type ServiceAccountOption

type ServiceAccountOption func(*corev1.ServiceAccount)

func ServiceAccountWithMetaOptions

func ServiceAccountWithMetaOptions(opts ...MetaOption) ServiceAccountOption

type ServiceOption

type ServiceOption func(*corev1.Service)

func ServiceAddPort

func ServiceAddPort(name string, port int32, targetPort int32) ServiceOption

func ServiceAddSelectorLabel

func ServiceAddSelectorLabel(key, value string) ServiceOption

func ServiceSetType

func ServiceSetType(st corev1.ServiceType) ServiceOption

func ServiceWithMetaOptions

func ServiceWithMetaOptions(opts ...MetaOption) ServiceOption

type VolumeMountOption

type VolumeMountOption func(*corev1.VolumeMount)

func VolumeMountWithReadOnlyOption

func VolumeMountWithReadOnlyOption(b bool) VolumeMountOption

type VolumeOption

type VolumeOption func(*corev1.Volume)

func VolumeFromSecretOption

func VolumeFromSecretOption(secretName, secretKey, mountFile string) VolumeOption

Jump to

Keyboard shortcuts

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