A KeptnTaskDefinition is a Kubernetes custom resource that declares executable behavior for a Keptn lifecycle task. Keptn uses these definitions to run custom pre- or post-deployment actions for monitored workloads. section 9.3
A KeptnTaskDefinition participates in a workflow that:
- Associates applications with Keptn through standard Kubernetes annotations. section 9.3
- Runs executable functions before or after deployment events. section 9.3
- Receives lifecycle context describing the workload, application, version, task type, and object type. section 9.3
Inline Deno task
A definition named stdout-notification uses an inline Deno function to read the CONTEXT environment variable and print the Keptn task context. A post-deployment annotation invokes this task for a service, producing workload and application details. section 9.3
Listing 9.4 Keptn TaskDefinition using Deno
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnTaskDefinition
metadata:
name: stdout-notification #1
spec:
function:
inline:
code: |
let context = Deno.env.get("CONTEXT"); #2
console.log("Keptn Task Executed with context: \n");
console.log(context);
Inspect the complete KeptnTaskDefinition manifest, including its lifecycle API version, resource kind, inline function, and context access. section 9.3
