diff --git a/operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go b/operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go index a42b162808..178d84aaf8 100644 --- a/operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go +++ b/operator/apis/lifecycle/v1alpha2/keptntaskdefinition_types.go @@ -71,19 +71,125 @@ type FunctionStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status - -// KeptnTaskDefinition is the Schema for the keptntaskdefinitions API +// +// A `KeptnTaskDefinition` defines the tasks +// that the Keptn Lifecycle Toolkit can run +// as part of pre- and post-deployment phases of a deployment. + +// ## YAML synopsis + +// ```yaml +// apiVersion: lifecycle.keptn.sh/v1alpha2 +// kind: KeptnTaskDefinition +// metadata: +// name: +// spec: +// function: +// inline: | httpRef | functionRef +// [parameters: +// map: +// textMessage: "This is my configuration"] +// [secureParameters: +// secret: slack-token] +// ``` +// +// * **apiVersion** - API version being used. +// The default for KLT Release 0.5.0 is `lifecycle.keptn.sh/v1alpha2`. +// * This must match +// * Other information +// +// * **kind** CRD type. This is `KeptnTaskDefinition` +// +// * **name** Unique name of this task. +// This must be an alphanumeric string and, by convention, is all lowercase. +// It can use the special characters `_`, `-` ... . +// It should not include spaces. +// +// * **function** - Code to be executed. +// This can be expressed as one of the following: +// +// * **inline** - Include the actual executable code to execute. +// This can be written as a full-fledged Deno script. +// For example: +// ```function: +// inline: +// code: | +// console.log("Deployment Task has been executed"); +// ``` +// The task definition is a [Deno](https://deno.land/) script. +// Please, refer to the [function runtime](https://github.com/keptn/lifecycle-toolkit/tree/main/functions-runtime) +// for more information about the runtime. +// In the future, we also intend to support other runtimes, +// especially running a container image directly. +// * **httpRef** - Specify a Deno script to be executed at runtime +// from the remote webserver that is specified. +// For example: +// +// ```yaml +// name: hello-keptn-http +// spec: +// function: +// httpRef: +// url: +// ``` +// * **functionRef** -- Execute another `KeptnTaskDefinition` that has been defined. +// Populate this field with the value of the `name` field +// for the `KeptnTaskDefinition` to be called. +// This is commonly used to call a general function +// that is used in multiple place with different parameters. +// An example is: +// ```yaml +// spec: +// function: +// functionRef: +// name: slack-notification +// ``` +// +// This can also be used to group a set of tasks into a single `KeptnTaskDefinitions`, +// such as defining a `KeptnTaskDefinition` for testing +// and have it call a `KeptnTaskDefinition` for each type of test to be run. +// +// +// +// +// +// ## Examples +// +// This section can do any of the following: +// +// * Include annotated examples +// * Link to formal `examples`; include an annotation about what they illustrate +// +// ## Files +// +// * link to source code file where this is defined. +// +// ## Differences between versions +// +// ## See also +// +// [function runtime](https://github.com/keptn/lifecycle-toolkit/tree/main/functions-runtime) +// +// * Link to "use-case" guide pages that do something interesting with this CRD +// * Link to reference pages for any related CRDs +