Documentation ¶
Overview ¶
Package resource contains helpers to generate Kubernetes API objects.
Index ¶
- Constants
- func NewCRD(name string, opts ...CRDOption) (*apiextensionsv1.CustomResourceDefinition, error)
- func NewCRDVersion(version string, served, storage bool, spec *apiextensionsv1.JSONSchemaProps, ...) (*apiextensionsv1.CustomResourceDefinitionVersion, error)
- func NewContainer(name, image string, opts ...ContainerOption) *corev1.Container
- func NewDeployment(namespace, name string, opts ...DeploymentOption) *appsv1.Deployment
- func NewKnativeService(namespace, name string, opts ...KnativeServiceOption) *servingv1.Service
- func NewMeta(ns, name string, opts ...MetaOption) *metav1.ObjectMeta
- func NewPodSpec(opts ...PodSpecOption) *corev1.PodSpec
- func NewRoleBinding(namespace, name, roleName, subjectName string, opts ...RoleBindingOption) *rbacv1.RoleBinding
- func NewSecret(namespace, name string, opts ...SecretOption) *corev1.Secret
- func NewSecurityContext(opts ...SecurityContextOption) *corev1.SecurityContext
- func NewService(namespace, name string, opts ...ServiceOption) *corev1.Service
- func NewServiceAccount(namespace, name string, opts ...ServiceAccountOption) *corev1.ServiceAccount
- func NewVolume(name string, opts ...VolumeOption) *corev1.Volume
- func NewVolumeMount(name, mountPath string, opts ...VolumeMountOption) *corev1.VolumeMount
- type CRDOption
- type CRDVersionOption
- type ContainerOption
- func ContainerAddArgs(s string) ContainerOption
- func ContainerAddEnv(ev *corev1.EnvVar) ContainerOption
- func ContainerAddEnvFromFieldRef(name, path string) ContainerOption
- func ContainerAddEnvFromValue(name, value string) ContainerOption
- func ContainerAddEnvVarFromConfigMap(name, cmName, cmKey string) ContainerOption
- func ContainerAddEnvVarFromSecret(name, secretName, secretKey string) ContainerOption
- func ContainerAddPort(name string, containerPort int32) ContainerOption
- func ContainerAddVolumeMount(vm *corev1.VolumeMount) ContainerOption
- func ContainerWithImagePullPolicy(policy corev1.PullPolicy) ContainerOption
- func ContainerWithSecurityContext(sc *corev1.SecurityContext) ContainerOption
- func ContainerWithTerminationMessagePolicy(policy corev1.TerminationMessagePolicy) ContainerOption
- type DeploymentOption
- type KnativeServiceOption
- type MetaOption
- type PodSpecOption
- type PodTemplateSpecOption
- type RevisionTemplateOption
- type RoleBindingOption
- type SecretOption
- type SecurityContextOption
- type ServiceAccountOption
- type ServiceOption
- type VolumeMountOption
- type VolumeOption
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 ¶
func NewCRD(name string, opts ...CRDOption) (*apiextensionsv1.CustomResourceDefinition, error)
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 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 NewVolumeMount ¶
func NewVolumeMount(name, mountPath string, opts ...VolumeMountOption) *corev1.VolumeMount
Types ¶
type CRDOption ¶
type CRDOption func(*apiextensionsv1.CustomResourceDefinition) error
func CRDAddVersion ¶
func CRDAddVersion(v *apiextensionsv1.CustomResourceDefinitionVersion) CRDOption
func CRDWithMetaOptions ¶
func CRDWithMetaOptions(opts ...MetaOption) CRDOption
func CRDWithNames ¶
func CRDWithNames(crdn *apiextensionsv1.CustomResourceDefinitionNames) CRDOption
Plural name should not be informed. In case it is it should be set according to the name and group of the CRD.
type CRDVersionOption ¶
type CRDVersionOption func(*apiextensionsv1.CustomResourceDefinitionVersion) error
type ContainerOption ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func VolumeFromSecretOption ¶
func VolumeFromSecretOption(secretName, secretKey, mountFile string) VolumeOption
Click to show internal directories.
Click to hide internal directories.