v1alpha2

package
v1.0.2-0...-81fcf91 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package v1alpha2 contains API Schema definitions for the serverless v1alpha2 API group. +kubebuilder:object:generate=true +groupName=serverless.kyma-project.io

Index

Constants

View Source
const (
	FunctionNameLabel                    = "serverless.kyma-project.io/function-name"
	FunctionManagedByLabel               = "serverless.kyma-project.io/managed-by"
	FunctionControllerValue              = "function-controller"
	FunctionUUIDLabel                    = "serverless.kyma-project.io/uuid"
	FunctionResourceLabel                = "serverless.kyma-project.io/resource"
	FunctionResourceLabelDeploymentValue = "deployment"
	PodAppNameLabel                      = "app.kubernetes.io/name"
)
View Source
const MaxConditionMessageLength = 32768

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "serverless.kyma-project.io", Version: "v1alpha2"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type ConditionReason

type ConditionReason string
const (
	ConditionReasonInvalidFunctionSpec      ConditionReason = "InvalidFunctionSpec"
	ConditionReasonFunctionSpecValidated    ConditionReason = "FunctionSpecValidated"
	ConditionReasonSourceUpdated            ConditionReason = "SourceUpdated"
	ConditionReasonSourceUpdateFailed       ConditionReason = "SourceUpdateFailed"
	ConditionReasonDeploymentCreated        ConditionReason = "DeploymentCreated"
	ConditionReasonDeploymentUpdated        ConditionReason = "DeploymentUpdated"
	ConditionReasonDeploymentFailed         ConditionReason = "DeploymentFailed"
	ConditionReasonDeploymentDeleted        ConditionReason = "DeploymentDeleted"
	ConditionReasonDeploymentDeletionFailed ConditionReason = "DeploymentDeletionFailed"
	ConditionReasonDeploymentWaiting        ConditionReason = "DeploymentWaiting"
	ConditionReasonDeploymentReady          ConditionReason = "DeploymentReady"
	ConditionReasonServiceCreated           ConditionReason = "ServiceCreated"
	ConditionReasonServiceUpdated           ConditionReason = "ServiceUpdated"
	ConditionReasonServiceFailed            ConditionReason = "ServiceFailed"
	ConditionReasonMinReplicasNotAvailable  ConditionReason = "MinReplicasNotAvailable"
)

type ConditionType

type ConditionType string
const (
	ConditionRunning            ConditionType = "Running"
	ConditionConfigurationReady ConditionType = "ConfigurationReady"
)

type Function

type Function struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   FunctionSpec   `json:"spec"`
	Status FunctionStatus `json:"status,omitempty"`
}

Function is the Schema for the functions API.

func (*Function) CopyAnnotationsToStatus

func (f *Function) CopyAnnotationsToStatus()

func (*Function) DeepCopy

func (in *Function) DeepCopy() *Function

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Function.

func (*Function) DeepCopyInto

func (in *Function) DeepCopyInto(out *Function)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Function) DeepCopyObject

func (in *Function) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Function) FunctionLabels

func (f *Function) FunctionLabels() map[string]string

func (*Function) HasGitAuth

func (f *Function) HasGitAuth() bool

func (*Function) HasGitSources

func (f *Function) HasGitSources() bool

func (*Function) HasInlineSources

func (f *Function) HasInlineSources() bool

func (*Function) HasLabel

func (f *Function) HasLabel(labelName, value string) bool

func (*Function) HasNodejsRuntime

func (f *Function) HasNodejsRuntime() bool

func (*Function) HasPythonRuntime

func (f *Function) HasPythonRuntime() bool

func (*Function) InternalFunctionLabels

func (f *Function) InternalFunctionLabels() map[string]string

func (*Function) PodLabels

func (f *Function) PodLabels() map[string]string

func (*Function) SelectorLabels

func (f *Function) SelectorLabels() map[string]string

func (*Function) UpdateCondition

func (f *Function) UpdateCondition(c ConditionType, s metav1.ConditionStatus, r ConditionReason, msg string)

type FunctionList

type FunctionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Function `json:"items"`
}

FunctionList contains a list of Function.

func (*FunctionList) DeepCopy

func (in *FunctionList) DeepCopy() *FunctionList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionList.

func (*FunctionList) DeepCopyInto

func (in *FunctionList) DeepCopyInto(out *FunctionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*FunctionList) DeepCopyObject

func (in *FunctionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type FunctionSpec

type FunctionSpec struct {
	// Specifies the runtime of the Function. The available values are `nodejs20`, `nodejs22`, and `python312`.
	// +kubebuilder:validation:Enum=nodejs20;nodejs22;python312;
	Runtime Runtime `json:"runtime"`

	// Specifies the runtime image used instead of the default one.
	// +optional
	RuntimeImageOverride string `json:"runtimeImageOverride,omitempty"`

	// Contains the Function's source code configuration.
	// +kubebuilder:validation:XValidation:message="Use GitRepository or Inline source",rule="has(self.gitRepository) && !has(self.inline) || !has(self.gitRepository) && has(self.inline)"
	// +kubebuilder:validation:Required
	Source Source `json:"source"`

	// Specifies an array of key-value pairs to be used as environment variables for the Function.
	// You can define values as static strings or reference values from ConfigMaps or Secrets.
	// For configuration details, see the [official Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/).
	// +kubebuilder:validation:XValidation:message="Following envs are reserved and cannot be used: ['FUNC_RUNTIME','FUNC_HANDLER','FUNC_PORT','FUNC_HANDLER_SOURCE','FUNC_HANDLER_DEPENDENCIES','MOD_NAME','NODE_PATH','PYTHONPATH']",rule="(self.all(e, !(e.name in ['FUNC_RUNTIME','FUNC_HANDLER','FUNC_PORT','FUNC_HANDLER_SOURCE','FUNC_HANDLER_DEPENDENCIES','MOD_NAME','NODE_PATH','PYTHONPATH'])))"
	Env []corev1.EnvVar `json:"env,omitempty"`

	// Specifies resources requested by the Function and the build Job.
	// +optional
	ResourceConfiguration *ResourceConfiguration `json:"resourceConfiguration,omitempty"`

	// Deprecated:
	// This setting will be removed. Serverless no longer automatically creates HPA.
	// +optional
	ScaleConfig *ScaleConfig `json:"scaleConfig,omitempty"`

	// Defines the exact number of Function's Pods to run at a time.
	// If the Function is targeted by an external scaler,
	// then the **Replicas** field is used by the relevant HorizontalPodAutoscaler to control the number of active replicas.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default:=1
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Deprecated: Use **Labels** and **Annotations** to label and/or annotate Function's Pods.
	// +optional
	// +kubebuilder:validation:XValidation:message="Not supported: Use spec.labels and spec.annotations to label and/or annotate Function's Pods.",rule="!has(self.labels) && !has(self.annotations)"
	Template *Template `json:"template,omitempty"`

	// Specifies Secrets to mount into the Function's container filesystem.
	SecretMounts []SecretMount `json:"secretMounts,omitempty"`

	// Defines labels used in Deployment's PodTemplate and applied on the Function's runtime Pod.
	// +optional
	// +kubebuilder:validation:XValidation:message="Labels has key starting with serverless.kyma-project.io/ which is not allowed",rule="!(self.exists(e, e.startsWith('serverless.kyma-project.io/')))"
	// +kubebuilder:validation:XValidation:message="Label value cannot be longer than 63",rule="self.all(e, size(e)<64)"
	Labels map[string]string `json:"labels,omitempty"`

	// Defines annotations used in Deployment's PodTemplate and applied on the Function's runtime Pod.
	// +optional
	// +kubebuilder:validation:XValidation:message="Annotations has key starting with serverless.kyma-project.io/ which is not allowed",rule="!(self.exists(e, e.startsWith('serverless.kyma-project.io/')))"
	// +kubebuilder:validation:XValidation:message="Annotations has key proxy.istio.io/config which is not allowed",rule="!(self.exists(e, e=='proxy.istio.io/config'))"
	Annotations map[string]string `json:"annotations,omitempty"`
}

FunctionSpec defines the desired state of Function.

func (*FunctionSpec) DeepCopy

func (in *FunctionSpec) DeepCopy() *FunctionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionSpec.

func (*FunctionSpec) DeepCopyInto

func (in *FunctionSpec) DeepCopyInto(out *FunctionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FunctionStatus

type FunctionStatus struct {
	// The generation observed by the function controller.
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
	// Specifies the **Runtime** type of the Function.
	Runtime Runtime `json:"runtime,omitempty"`
	// Specifies the image version used to build and run the Function's Pods.
	RuntimeImage string `json:"runtimeImage,omitempty"`
	// Specifies the total number of non-terminated Pods targeted by this Function.
	Replicas int32 `json:"replicas,omitempty"`
	// Specifies the Pod selector used to match Pods in the Function's Deployment.
	PodSelector string `json:"podSelector,omitempty"`
	// Specifies the preset used for the function
	FunctionResourceProfile string `json:"functionResourceProfile,omitempty"`
	// Specifies the last used annotations the Function's Pod template
	FunctionAnnotations map[string]string `json:"functionAnnotations,omitempty"`
	// Specifies an array of conditions describing the status of the parser.
	Conditions []metav1.Condition `json:"conditions,omitempty"`
	// Deprecated: Specifies the commit hash used to build the Function.
	// Field moved to GitRepositoryStatus.
	Commit string `json:"commit,omitempty"`
	// Deprecated: Specify the repository which was used to build the function.
	// Field moved to GitRepositoryStatus.
	Repository `json:",inline,omitempty"`
	// Specifies the GitRepository status when the Function is sourced from a Git repository.
	GitRepository *GitRepositoryStatus `json:"gitRepository,omitempty"`
}

FunctionStatus defines the observed state of the Function.

func (*FunctionStatus) Condition

func (s *FunctionStatus) Condition(c ConditionType) *metav1.Condition

func (*FunctionStatus) DeepCopy

func (in *FunctionStatus) DeepCopy() *FunctionStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionStatus.

func (*FunctionStatus) DeepCopyInto

func (in *FunctionStatus) DeepCopyInto(out *FunctionStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GitRepositorySource

type GitRepositorySource struct {

	// Specifies the URL of the Git repository with the Function's code and dependencies.
	// Depending on whether the repository is public or private and what authentication method is used to access it,
	// the URL must start with the `http(s)`, `git`, or `ssh` prefix.
	URL string `json:"url"`

	// Specifies the authentication method. Required for SSH.
	// +optional
	Auth *RepositoryAuth `json:"auth,omitempty"`

	// +kubebuilder:validation:XValidation:message="BaseDir is required and cannot be empty",rule="has(self.baseDir) && (self.baseDir.trim().size() != 0)"
	// +kubebuilder:validation:XValidation:message="Reference is required and cannot be empty",rule="has(self.reference) && (self.reference.trim().size() != 0)"
	Repository `json:",inline"`
}

func (*GitRepositorySource) DeepCopy

func (in *GitRepositorySource) DeepCopy() *GitRepositorySource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositorySource.

func (*GitRepositorySource) DeepCopyInto

func (in *GitRepositorySource) DeepCopyInto(out *GitRepositorySource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GitRepositoryStatus

type GitRepositoryStatus struct {
	URL        string `json:"url"`
	Repository `json:",inline,omitempty"`
	Commit     string `json:"commit,omitempty"`
}

func (*GitRepositoryStatus) DeepCopy

func (in *GitRepositoryStatus) DeepCopy() *GitRepositoryStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryStatus.

func (*GitRepositoryStatus) DeepCopyInto

func (in *GitRepositoryStatus) DeepCopyInto(out *GitRepositoryStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type InlineSource

type InlineSource struct {
	// Specifies the Function's full source code.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Source string `json:"source"`

	// Specifies the Function's dependencies.
	//+optional
	Dependencies string `json:"dependencies,omitempty"`
}

func (*InlineSource) DeepCopy

func (in *InlineSource) DeepCopy() *InlineSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InlineSource.

func (*InlineSource) DeepCopyInto

func (in *InlineSource) DeepCopyInto(out *InlineSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Repository

type Repository struct {
	// Specifies the relative path to the Git directory that contains the source code
	// from which the Function is built.
	BaseDir string `json:"baseDir,omitempty"`

	// Specifies either the branch name, tag or commit revision from which the Function Controller
	// automatically fetches the changes in the Function's code and dependencies.
	Reference string `json:"reference,omitempty"`
}

func (*Repository) DeepCopy

func (in *Repository) DeepCopy() *Repository

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository.

func (*Repository) DeepCopyInto

func (in *Repository) DeepCopyInto(out *Repository)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RepositoryAuth

type RepositoryAuth struct {
	// +kubebuilder:validation:Required
	// Defines the repository authentication method. The value is either `basic` if you use a password or token,
	// or `key` if you use an SSH key.
	Type RepositoryAuthType `json:"type"`

	// Specifies the name of the Secret with credentials used by the Function Controller
	// to authenticate to the Git repository in order to fetch the Function's source code and dependencies.
	// This Secret must be stored in the same Namespace as the Function CR.
	SecretName string `json:"secretName"`
}

RepositoryAuth defines authentication method used for repository operations

func (*RepositoryAuth) DeepCopy

func (in *RepositoryAuth) DeepCopy() *RepositoryAuth

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryAuth.

func (*RepositoryAuth) DeepCopyInto

func (in *RepositoryAuth) DeepCopyInto(out *RepositoryAuth)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RepositoryAuthType

type RepositoryAuthType string

RepositoryAuthType is the enum of available authentication types +kubebuilder:validation:Enum=basic;key

const (
	RepositoryAuthBasic  RepositoryAuthType = "basic"
	RepositoryAuthSSHKey RepositoryAuthType = "key"
)

type ResourceConfiguration

type ResourceConfiguration struct {
	// Deprecated: Specifies resources requested by the build Job's Pod.
	// This setting will be removed. Functions don't require building images.
	// +optional
	// +kubebuilder:validation:XValidation:message="Use profile or resources",rule="has(self.profile) && !has(self.resources) || !has(self.profile) && has(self.resources)"
	// +kubebuilder:validation:XValidation:message="Invalid profile, please use one of: ['local-dev','slow','normal','fast']",rule="(!has(self.profile) || self.profile in ['local-dev','slow','normal','fast'])"
	Build *ResourceRequirements `json:"build,omitempty"`

	// Specifies resources requested by the Function's Pod.
	// +optional
	// +kubebuilder:validation:XValidation:message="Use profile or resources",rule="has(self.profile) && !has(self.resources) || !has(self.profile) && has(self.resources)"
	// +kubebuilder:validation:XValidation:message="Invalid profile, please use one of: ['XS','S','M','L','XL']",rule="(!has(self.profile) || self.profile in ['XS','S','M','L','XL'])"
	Function *ResourceRequirements `json:"function,omitempty"`
}

func (*ResourceConfiguration) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceConfiguration.

func (*ResourceConfiguration) DeepCopyInto

func (in *ResourceConfiguration) DeepCopyInto(out *ResourceConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceRequirements

type ResourceRequirements struct {
	// Defines the name of the predefined set of values of the resource.
	// Can't be used together with **Resources**.
	// +optional
	Profile string `json:"profile,omitempty"`

	// Defines the amount of resources available for the Pod.
	// Can't be used together with **Profile**.
	// For configuration details, see the [official Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/).
	// +optional
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}

func (*ResourceRequirements) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRequirements.

func (*ResourceRequirements) DeepCopyInto

func (in *ResourceRequirements) DeepCopyInto(out *ResourceRequirements)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Runtime

type Runtime string

Runtime specifies the name of the Function's runtime.

const (
	Python312 Runtime = "python312"
	NodeJs20  Runtime = "nodejs20"
	NodeJs22  Runtime = "nodejs22"
)

type ScaleConfig

type ScaleConfig struct {
	// Defines the minimum number of Function's Pods to run at a time.
	// +kubebuilder:validation:Minimum:=1
	MinReplicas *int32 `json:"minReplicas"`

	// Defines the maximum number of Function's Pods to run at a time.
	// +kubebuilder:validation:Minimum:=1
	MaxReplicas *int32 `json:"maxReplicas"`
}

func (*ScaleConfig) DeepCopy

func (in *ScaleConfig) DeepCopy() *ScaleConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleConfig.

func (*ScaleConfig) DeepCopyInto

func (in *ScaleConfig) DeepCopyInto(out *ScaleConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SecretMount

type SecretMount struct {
	// Specifies the name of the Secret in the Function's Namespace.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:MinLength=1
	SecretName string `json:"secretName"`

	// Specifies the path within the container where the Secret should be mounted.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	MountPath string `json:"mountPath"`
}

func (*SecretMount) DeepCopy

func (in *SecretMount) DeepCopy() *SecretMount

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretMount.

func (*SecretMount) DeepCopyInto

func (in *SecretMount) DeepCopyInto(out *SecretMount)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Source

type Source struct {
	// Defines the Function as git-sourced. Can't be used together with **Inline**.
	// +optional
	GitRepository *GitRepositorySource `json:"gitRepository,omitempty"`

	// Defines the Function as the inline Function. Can't be used together with **GitRepository**.
	// +optional
	Inline *InlineSource `json:"inline,omitempty"`
}

func (*Source) DeepCopy

func (in *Source) DeepCopy() *Source

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source.

func (*Source) DeepCopyInto

func (in *Source) DeepCopyInto(out *Source)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Template

type Template struct {
	// Deprecated: Use **FunctionSpec.Labels**  to label Function's Pods.
	// +optional
	Labels map[string]string `json:"labels,omitempty"`
	// Deprecated: Use **FunctionSpec.Annotations** to annotate Function's Pods.
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

func (*Template) DeepCopy

func (in *Template) DeepCopy() *Template

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template.

func (*Template) DeepCopyInto

func (in *Template) DeepCopyInto(out *Template)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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