Skip to content

doc: added first version of workload docs #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions content/en/docs/concepts/workloads/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,30 @@ weight: 10
hidechildren: true # this flag hides all sub-pages in the sidebar-multicard.html
---

A Workload contains information about which tasks should be performed during the `preDeployment` as well as the `postDeployment`
phase of a deployment. In its state it keeps track of the currently active `Workload Instances`, which are responsible for doing those checks for
a particular instance of a Deployment/StatefulSet/ReplicaSet (e.g. a Deployment of a certain version).
## What are workloads for Keptn?
Workloads are representing Kubernetes primitives as [Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/), [StatefulSets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset) and [DaemonSets](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/). Workload resources are used to track the state of your deployments and to trigger pre- and post-deployment tasks and evaluations.

## Definition
A workload is created by annotating the Kubernetes resource with the following annotations/labels:
* `app.kubernetes.io/name`
* `keptn.sh/workload`

If one of these annotations exist, the Keptn Lifecycle Toolkit will create a workload resource for it.

Additionally, the following annotations can be used to add functionality to these workloads:
* `app.kubernetes.io/part-of` or `keptn.sh/app`: The name of the [App]({{< ref "/docs/concepts/apps" >}}) the Workload belongs to.
* `app.kubernetes.io/version` or `keptn.sh/version`: The version of the Workload
* `keptn.sh/pre-deployment-tasks`: A comma-separated list of pre-deployment [tasks]({{< ref "/docs/concepts/tasks" >}}) to be executed before the Workload is deployed
* `keptn.sh/post-deployment-tasks`: A comma-separated list of post-deployment [tasks]({{< ref "/docs/concepts/tasks" >}}) to be executed after the Workload is deployed
* `keptn.sh/pre-deployment-evaluations`: A comma-separated list of pre-deployment [evaluations]({{< ref "/docs/concepts/evaluations" >}}) to be executed before the Workload is deployed
* `keptn.sh/post-deployment-evaluations`: A comma-separated list of post-deployment [evaluations]({{< ref "/docs/concepts/evaluations" >}}) to be executed after the Workload is deployed

## Resources
When a workload is detected, the Keptn Lifecycle Toolkit will create a KeptnWorkload resource fort it. This resource is watched by the Keptn Lifecycle Toolkit and if changes are detected, the Keptn Lifecycle Toolkit will create a new KeptnWorkload Instance resource.

### Keptn Workload Instance

A Workload Instance is responsible for executing the pre- and post deployment checks of a workload. In its state, it keeps track of the current status of all checks, as well as the overall state of
the Pre Deployment phase, which can be used by the scheduler to tell that a pod can be allowed to be placed on a node.
A Workload Instance is responsible for executing the pre- and post-deployment [tasks]({{< ref "/docs/concepts/tasks" >}}) of a workload. In its state, it keeps track of the current status of all tasks, as well as the overall state of
the Pre Deployment phase, which is used by the scheduler to tell that a pod can be allowed to be placed on a node.
Workload Instances have a reference to the respective Deployment/StatefulSet/ReplicaSet, to check if it has reached the desired state. If it detects that the referenced object has reached
its desired state (e.g. all pods of a deployment are up and running), it will be able to tell that a `PostDeploymentCheck` can be triggered.
its desired state (e.g. all pods of a deployment are up and running), it will be able to tell that the `PostDeploymentTask` can be triggered.
7 changes: 4 additions & 3 deletions content/en/docs/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The Keptn Lifecycle Toolkit makes your deployments observable, brings applicatio
* Post-Deployment Tasks: e.g. trigger a test, trigger a deployment to another cluster, etc.
* Post-Deployment Evaluations: e.g. evaluate the deployment, evaluate the test results, etc.

All of these things can be executed on a workload or on an application level, whereby an application is a collection of multiple workloads.
All of these things can be executed on a workload or on an application level, whereby an application is a collection of multiple [workloads]({{< ref "/docs/concepts/workloads" >}}).

## What you will learn here
* Use the Keptn Lifecycle Toolkit to control the deployment of your application
Expand Down Expand Up @@ -80,13 +80,14 @@ make deploy-version-1
You can watch the progress of the deployment as follows:
<details>
<summary>Watch workload state</summary>
When the Lifecycle Toolkit detects workload labels ("app.kubernetes.io/name" and "keptn.sh/workload") on a resource, a KeptnWorkloadInstance (kwi) resource will be created. Using this resource you can watch the progress of the deployment.

When the Lifecycle Toolkit detects [workload]({{< ref "/docs/concepts/workloads" >}}) labels ("app.kubernetes.io/name" and "keptn.sh/workload") on a resource, a KeptnWorkloadInstance (kwi) resource will be created. Using this resource you can watch the progress of the deployment.

```shell
kubectl get keptnworkloadinstances -n podtato-kubectl
```

This will show the current status of the Workloads and in which phase they are at the moment. You can get more detailed information about the workloads by describing one of the resources:
This will show the current status of the [Workloads]({{< ref "/docs/concepts/workloads" >}}) and in which phase they are at the moment. You can get more detailed information about the [Workloads]({{< ref "/docs/concepts/workloads" >}}) by describing one of the resources:

```shell
kubectl describe keptnworkloadinstances podtato-head-podtato-head-entry -n podtato-kubectl
Expand Down