Documentation ¶
Overview ¶
Package v1alpha2 contains API Schema definitions for the serverless v1alpha2 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kyma-project/kyma/components/function-controller/pkg/apis/serverless +k8s:defaulter-gen=TypeMeta +groupName=serverless.kyma-project.io +kubebuilder:object:generate=true +groupName=serverless.kyma-project.io
Index ¶
- Constants
- Variables
- func Resource(resource string) schema.GroupResource
- func ValidateDependencies(runtime Runtime, dependencies string) error
- type Condition
- type ConditionReason
- type ConditionType
- type Function
- func (in *Function) DeepCopy() *Function
- func (in *Function) DeepCopyInto(out *Function)
- func (in *Function) DeepCopyObject() runtime.Object
- func (f *Function) EffectiveRuntime() string
- func (f Function) IsUpdating() bool
- func (f *Function) TypeOf(t FunctionType) bool
- func (fn *Function) Validate(vc *ValidationConfig) error
- type FunctionList
- type FunctionSpec
- type FunctionStatus
- type FunctionType
- type GitRepositorySource
- type InlineSource
- type MinBuildJobResourcesValues
- type MinBuildJobValues
- type MinFunctionResourcesValues
- type MinFunctionValues
- type Repository
- type RepositoryAuth
- type RepositoryAuthType
- type ResourceConfiguration
- type ResourceRequirements
- type Runtime
- type ScaleConfig
- type SecretMount
- type Source
- type Template
- type ValidationConfig
Constants ¶
const ( FunctionResourcesPresetLabel = "serverless.kyma-project.io/function-resources-preset" BuildResourcesPresetLabel = "serverless.kyma-project.io/build-resources-preset" )
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" FunctionResourceLabelUserValue = "user" )
const ( FunctionKind = "Function" FunctionVersion = "v1alpha2" FunctionGroup = "serverless.kyma-project.io" FunctionApiVersion = FunctionGroup + "/" + FunctionVersion )
const ValidationConfigKey = "validation-config"
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: FunctionGroup, Version: FunctionVersion} // 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 )
var ErrInvalidGitRepositoryAuthType = fmt.Errorf("invalid git repository authentication type")
var (
ErrUnknownFunctionType = fmt.Errorf("unknown function source type")
)
Functions ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource is required by pkg/client/listers/...
func ValidateDependencies ¶
Types ¶
type Condition ¶
type Condition struct { // Specifies the type of the Function's condition. Type ConditionType `json:"type,omitempty"` // Specifies the status of the condition. The value is either `True`, `False`, or `Unknown`. Status v1.ConditionStatus `json:"status"` // Specifies the last time the condition transitioned from one status to another. LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // Specifies the reason for the condition's last transition. Reason ConditionReason `json:"reason,omitempty"` // Provides a human-readable message indicating details about the transition. Message string `json:"message,omitempty"` }
func (*Condition) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
func (*Condition) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ConditionReason ¶
type ConditionReason string
const ( ConditionReasonConfigMapCreated ConditionReason = "ConfigMapCreated" ConditionReasonConfigMapUpdated ConditionReason = "ConfigMapUpdated" ConditionReasonSourceUpdated ConditionReason = "SourceUpdated" ConditionReasonSourceUpdateFailed ConditionReason = "SourceUpdateFailed" ConditionReasonJobFailed ConditionReason = "JobFailed" ConditionReasonJobCreated ConditionReason = "JobCreated" ConditionReasonJobUpdated ConditionReason = "JobUpdated" ConditionReasonJobRunning ConditionReason = "JobRunning" ConditionReasonJobsDeleted ConditionReason = "JobsDeleted" ConditionReasonJobFinished ConditionReason = "JobFinished" ConditionReasonDeploymentCreated ConditionReason = "DeploymentCreated" ConditionReasonDeploymentUpdated ConditionReason = "DeploymentUpdated" ConditionReasonDeploymentFailed ConditionReason = "DeploymentFailed" ConditionReasonDeploymentWaiting ConditionReason = "DeploymentWaiting" ConditionReasonDeploymentReady ConditionReason = "DeploymentReady" ConditionReasonServiceCreated ConditionReason = "ServiceCreated" ConditionReasonServiceUpdated ConditionReason = "ServiceUpdated" ConditionReasonServiceFailed ConditionReason = "ServiceFailed" ConditionReasonHorizontalPodAutoscalerCreated ConditionReason = "HorizontalPodAutoscalerCreated" ConditionReasonHorizontalPodAutoscalerUpdated ConditionReason = "HorizontalPodAutoscalerUpdated" ConditionReasonMinReplicasNotAvailable ConditionReason = "MinReplicasNotAvailable" )
type ConditionType ¶
type ConditionType string
TODO: Status related things needs to be developed.
const ( ConditionRunning ConditionType = "Running" ConditionConfigurationReady ConditionType = "ConfigurationReady" ConditionBuildReady ConditionType = "BuildReady" )
type Function ¶
type Function struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec FunctionSpec `json:"spec,omitempty"` Status FunctionStatus `json:"status,omitempty"` }
A simple code snippet that you can run without provisioning or managing servers. It implements the exact business logic you define. A Function is based on the Function custom resource (CR) and can be written in either Node.js or Python. A Function can perform a business logic of its own. You can also bind it to an instance of a service and configure it to be triggered whenever it receives a particular event type from the service or a call is made to the service's API. Functions are executed only if they are triggered by an event or an API call.
func (*Function) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Function.
func (*Function) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Function) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Function) EffectiveRuntime ¶
func (Function) IsUpdating ¶
func (*Function) TypeOf ¶
func (f *Function) TypeOf(t FunctionType) bool
func (*Function) Validate ¶
func (fn *Function) Validate(vc *ValidationConfig) error
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 `nodejs16` - deprecated, `nodejs18`, and `python39`. 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. 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/). Env []v1.EnvVar `json:"env,omitempty"` // Specifies resources requested by the Function and the build Job. // +optional ResourceConfiguration *ResourceConfiguration `json:"resourceConfiguration,omitempty"` // Defines the minimum and maximum number of Function's Pods to run at a time. // When it is configured, a HorizontalPodAutoscaler will be deployed and will control the **Replicas** field // to scale the Function based on the CPU utilisation. // +optional ScaleConfig *ScaleConfig `json:"scaleConfig,omitempty"` // Defines the exact number of Function's Pods to run at a time. // If **ScaleConfig** is configured, or 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 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 Labels map[string]string `json:"labels,omitempty"` // Defines annotations used in Deployment's PodTemplate and applied on the Function's runtime Pod. // +optional Annotations map[string]string `json:"annotations,omitempty"` }
Defines the desired state of the 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 { // Specifies the **Runtime** type of the Function. Runtime Runtime `json:"runtime,omitempty"` // Specifies an array of conditions describing the status of the parser. Conditions []Condition `json:"conditions,omitempty"` // Specify the repository which was used to build the function. Repository `json:",inline,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 commit hash used to build the Function. Commit string `json:"commit,omitempty"` // Specifies the image version used to build and run the Function's Pods. RuntimeImage string `json:"runtimeImage,omitempty"` // Deprecated: Specifies the runtime image version which overrides the **RuntimeImage** status parameter. // **RuntimeImageOverride** exists for historical compatibility // and should be removed with v1alpha3 version. RuntimeImageOverride string `json:"runtimeImageOverride,omitempty"` }
FunctionStatus defines the observed state of the Function
func (*FunctionStatus) Condition ¶
func (s *FunctionStatus) Condition(c ConditionType) *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 FunctionType ¶
type FunctionType string
const ( FunctionTypeInline FunctionType = "inline" FunctionTypeGit FunctionType = "git" )
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"` 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 InlineSource ¶
type InlineSource struct { // Specifies the Function's full source code. 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 MinBuildJobResourcesValues ¶
func (*MinBuildJobResourcesValues) DeepCopy ¶
func (in *MinBuildJobResourcesValues) DeepCopy() *MinBuildJobResourcesValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinBuildJobResourcesValues.
func (*MinBuildJobResourcesValues) DeepCopyInto ¶
func (in *MinBuildJobResourcesValues) DeepCopyInto(out *MinBuildJobResourcesValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type MinBuildJobValues ¶
type MinBuildJobValues struct {
Resources MinBuildJobResourcesValues
}
func (*MinBuildJobValues) DeepCopy ¶
func (in *MinBuildJobValues) DeepCopy() *MinBuildJobValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinBuildJobValues.
func (*MinBuildJobValues) DeepCopyInto ¶
func (in *MinBuildJobValues) DeepCopyInto(out *MinBuildJobValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type MinFunctionResourcesValues ¶
func (*MinFunctionResourcesValues) DeepCopy ¶
func (in *MinFunctionResourcesValues) DeepCopy() *MinFunctionResourcesValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinFunctionResourcesValues.
func (*MinFunctionResourcesValues) DeepCopyInto ¶
func (in *MinFunctionResourcesValues) DeepCopyInto(out *MinFunctionResourcesValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type MinFunctionValues ¶
type MinFunctionValues struct {
Resources MinFunctionResourcesValues
}
func (*MinFunctionValues) DeepCopy ¶
func (in *MinFunctionValues) DeepCopy() *MinFunctionValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinFunctionValues.
func (*MinFunctionValues) DeepCopyInto ¶
func (in *MinFunctionValues) DeepCopyInto(out *MinFunctionValues)
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 { // 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 { // Specifies resources requested by the build Job's Pod. // +optional Build *ResourceRequirements `json:"build,omitempty"` // Specifies resources requested by the Function's Pod. // +optional Function *ResourceRequirements `json:"function,omitempty"` }
func (*ResourceConfiguration) DeepCopy ¶
func (in *ResourceConfiguration) DeepCopy() *ResourceConfiguration
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 *v1.ResourceRequirements `json:"resources,omitempty"` }
func (*ResourceRequirements) DeepCopy ¶
func (in *ResourceRequirements) DeepCopy() *ResourceRequirements
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.
func (*ResourceRequirements) EffectiveResource ¶
func (rc *ResourceRequirements) EffectiveResource(defaultProfile string, profiles map[string]v1.ResourceRequirements) v1.ResourceRequirements
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 SecretName string `json:"secretName"` // Specifies the path within the container where the Secret should be mounted. // +kubebuilder:validation:Required 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 ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source.
func (*Source) DeepCopyInto ¶
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 ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template.
func (*Template) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ValidationConfig ¶
type ValidationConfig struct { ReservedEnvs []string Function MinFunctionValues BuildJob MinBuildJobValues }
func (*ValidationConfig) DeepCopy ¶
func (in *ValidationConfig) DeepCopy() *ValidationConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidationConfig.
func (*ValidationConfig) DeepCopyInto ¶
func (in *ValidationConfig) DeepCopyInto(out *ValidationConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.