From 14a4e7a777cf333039c60b9d79fd74a0ff9b72e3 Mon Sep 17 00:00:00 2001 From: odubajDT Date: Mon, 29 Jan 2024 10:15:52 +0100 Subject: [PATCH] docs: adapt lifecycle-management and observability getting started guides to use KeptnAppContext Signed-off-by: odubajDT --- .github/actions/spelling/expect.txt | 1 + .../getting-started/lifecycle-management.md | 34 ++++- docs/docs/getting-started/observability.md | 117 ------------------ .../installation/configuration/namespace.md | 1 - .../reference/crd-reference/taskdefinition.md | 4 +- 5 files changed, 34 insertions(+), 123 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index eefd70498b..1078b88e9b 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -675,3 +675,4 @@ Yash yml YOURNAME yourregistry +linkedtrace diff --git a/docs/docs/getting-started/lifecycle-management.md b/docs/docs/getting-started/lifecycle-management.md index d7ac3145e6..b15334bb62 100644 --- a/docs/docs/getting-started/lifecycle-management.md +++ b/docs/docs/getting-started/lifecycle-management.md @@ -33,7 +33,7 @@ and > Pre and post deployments can be run either on individual workloads > or on a group of associated workloads that are grouped into -> a`KeptnApp` resource. +> a `KeptnApp` resource. > For instructions about how to identify the workloads to combine into `KeptnApp` resource, > see > [annotations to KeptnApp](../guides/integrate.md#basic-annotations). @@ -100,7 +100,7 @@ Apply this manifest: ```yaml --- -apiVersion: lifecycle.keptn.sh/v1alpha3 +apiVersion: lifecycle.keptn.sh/v1beta1 kind: KeptnTaskDefinition metadata: name: send-event @@ -135,7 +135,7 @@ Apply this manifest: ```yaml --- -apiVersion: lifecycle.keptn.sh/v1alpha3 +apiVersion: lifecycle.keptn.sh/v1beta1 kind: KeptnTask metadata: name: runsendevent1 @@ -249,6 +249,34 @@ Do this by using the `keptn.sh/pre-deployment-tasks` label or annotation. > Note: If a pre-deployment task fails, the `Pod` remains in a Pending state. +## More control over the application + +To customize checks associated with the application, we can create a `KeptnAppContext` resource and define +a set of pre/post deployment tasks or evaluations for the whole application. +Note that the name of the `KeptnAppContext` resource needs to match the name of the automatically +created `KeptnApp` and the value present in the `keptn.sh/app` or `app.kubernetes.io/part-of` +annotations. +In this case it needs to be `keptndemoapp`. +An example of `KeptnAppContext`: + +```yaml +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppContext +metadata: + name: keptndemoapp + namespace: keptndemo +spec: + postDeploymentTasks: + - send-event +``` + +This way, the `send-event` task is executed after the deployment of the whole application; +in other words, after all of the workloads present in the `KeptnApp` +are in a `Running` state. + +A detailed description of all the available fields of the `KeptnAppContext` resource can be found in the +[KeptnAppContext API reference page](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappcontext). + ## Further Information You can do much more with `KeptnTask` resources. diff --git a/docs/docs/getting-started/observability.md b/docs/docs/getting-started/observability.md index 0eb2fd754a..b9cff34938 100644 --- a/docs/docs/getting-started/observability.md +++ b/docs/docs/getting-started/observability.md @@ -474,123 +474,6 @@ View the Keptn Applications Dashboard and you should see the DORA metrics and an ![deployment trace](./assets/deploymenttrace.png) -## Step 14: More control over KeptnApp - -To customize workloads and checks associated with the application, we can edit the autogenerated KeptnApp or create our own. - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: - namespace: -spec: - version: "x.y" - revision: x - workloads: - - name: - version: - - name: - version: - preDeploymentTasks: - - - postDeploymentTasks: - - - preDeploymentEvaluations: - - - postDeploymentEvaluations: - - -``` - -## Fields - -- **apiVersion** -- API version being used. -- **kind** -- Resource type. - Must be set to `KeptnApp` - -- **metadata** - - **name** -- Unique name of this application. - Names must comply with the - [Kubernetes Object Names and IDs](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names) - specification. - -- **spec** - - **version** -- version of the Keptn application. - Changing this version number causes a new execution - of all application-level checks - - **revision** -- revision of a `version`. - The value is an integer that can be modified - to trigger another deployment of a `KeptnApp` of the same version. - For example, increment this number to restart a `KeptnApp` version - that failed to deploy, perhaps because a - `preDeploymentEvaluation` or `preDeploymentTask` failed. - See - [Restart an Application Deployment](../guides/restart-application-deployment.md) - for a longer discussion of this. - - **workloads** - - **name** - name of this Kubernetes - [workload](https://kubernetes.io/docs/concepts/workloads/). - Use the same naming rules listed above for the application name. - Provide one entry for each workload - associated with this Keptn application. - - **version** -- version number for this workload. - Changing this number causes a new execution - of checks for this workload only, - not the entire application. - -The remaining fields are required only when implementing -the release lifecycle management feature. -If used, these fields must be populated manually: - -- **preDeploymentTasks** -- list each task - to be run as part of the pre-deployment stage. - Task names must match the value of the `metadata.name` field - for the associated [KeptnTaskDefinition](../reference/crd-reference/taskdefinition.md) resource. -- **postDeploymentTasks** -- list each task - to be run as part of the post-deployment stage. - Task names must match the value of the `metadata.name` field - for the associated - [KeptnTaskDefinition](../reference/crd-reference/taskdefinition.md) - resource. -- **preDeploymentEvaluations** -- list each evaluation to be run - as part of the pre-deployment stage. - Evaluation names must match the value of the `metadata.name` field - for the associated - [KeptnEvaluationDefinition](../reference/crd-reference/evaluationdefinition.md) - resource. -- **postDeploymentEvaluations** -- list each evaluation to be run - as part of the post-deployment stage. - Evaluation names must match the value of the `metadata.name` field - for the associated [KeptnEvaluationDefinition](../reference/crd-reference/evaluationdefinition.md) - resource. - -## Example - -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "latest" - workloads: - - name: podtato-head-left-arm - version: "my_vers12.5" - - name: podtato-head-left-leg - version: "my_v24" - postDeploymentTasks: - - post-deployment-hello - preDeploymentEvaluations: - - my-prometheus-definition -``` - -You may have noticed that the `KeptnApp` Custom Resources are created automatically by Keptn. - -However, you can override this automatic behaviour by creating a custom `KeptnApp` CRD. -In this way, you are in full control of what constitutes a Keptn Application. -See [KeptnApp Reference page](../reference/crd-reference/app.md) for more information. - ## What's next? Keptn can run pre and post deployment tasks and SLO evaluations automatically. diff --git a/docs/docs/installation/configuration/namespace.md b/docs/docs/installation/configuration/namespace.md index 9bf5d09bef..7ef035db7a 100644 --- a/docs/docs/installation/configuration/namespace.md +++ b/docs/docs/installation/configuration/namespace.md @@ -18,7 +18,6 @@ Some considerations for Keptn: [Workload](https://kubernetes.io/docs/concepts/workloads/) resources and [KeptnApp](../../reference/crd-reference/app.md) - [KeptnApp](../../reference/crd-reference/app.md) resources that are activated and defined by annotations to each workload. * [KeptnMetricsProvider](../../reference/crd-reference/metricsprovider.md) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 31cc16b314..29311a9f43 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -149,7 +149,7 @@ spec: * **container** -- Container definition. * **name** -- Name of the container that will run, which is not the same as the `metadata.name` field - that is used in the `KeptnApp` resource. + that is used in the `KeptnTaskDefinition` resource. * **image** -- name of the image you defined according to [image reference](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#image) and @@ -270,7 +270,7 @@ spec: possibly with different parameters that are set in the calling `KeptnTaskDefinition` resource. - You must annotate the `KeptnApp` resource to run the + You must create the `KeptnAppContext` resource to run the calling `KeptnTaskDefinition` resource. The `KeptnTaskDefinition` called with `functionref`