From 594f1b430d42133fb1a49180a990ace9cef33b7c Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Wed, 31 Jan 2024 13:54:57 +0100 Subject: [PATCH 01/11] docs: adapt day 2 operations guide Signed-off-by: Florian Bacher --- .../use-cases/assets/deployment-initial.yaml | 28 +++++++-- .../deployment-new-image-and-version.yaml | 6 +- .../assets/deployment-new-image.yaml | 6 +- docs/docs/use-cases/day-2-operations.md | 60 ++++++++++--------- 4 files changed, 61 insertions(+), 39 deletions(-) diff --git a/docs/docs/use-cases/assets/deployment-initial.yaml b/docs/docs/use-cases/assets/deployment-initial.yaml index 14afc57b4b..7cd33ebbfc 100644 --- a/docs/docs/use-cases/assets/deployment-initial.yaml +++ b/docs/docs/use-cases/assets/deployment-initial.yaml @@ -12,18 +12,20 @@ metadata: name: podtato-head-frontend namespace: podtato-kubectl spec: + selector: + matchLabels: + app.kubernetes.io/name: podtato-head-frontend template: metadata: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.0 - keptn.sh/pre-deployment-evaluations: my-evaluation - keptn.sh/pre-deployment-tasks: my-task + app.kubernetes.io/version: 0.3.1 + keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend - image: podtato-head-frontend:a + image: ghcr.io/podtato-head/entry:latest --- apiVersion: apps/v1 kind: Deployment @@ -31,14 +33,28 @@ metadata: name: podtato-head-hat namespace: podtato-kubectl spec: + selector: + matchLabels: + app.kubernetes.io/name: podtato-head-hat replicas: 1 template: metadata: labels: app.kubernetes.io/name: podtato-head-hat app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.1 + app.kubernetes.io/version: 0.3.1 spec: containers: - name: podtato-head-hat - image: podtato-head-hat:a + image: ghcr.io/podtato-head/hat:latest +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check + namespace: podtato-kubectl +spec: + function: + inline: + code: | + console.error("Success") diff --git a/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml b/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml index 70b48d3a5d..a24360e5dc 100644 --- a/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml +++ b/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml @@ -4,14 +4,16 @@ metadata: name: podtato-head-frontend namespace: podtato-kubectl spec: + selector: + matchLabels: + app.kubernetes.io/name: podtato-head-frontend template: metadata: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head app.kubernetes.io/version: 0.2.0 # The version label is now updated as well - keptn.sh/pre-deployment-evaluations: my-evaluation - keptn.sh/pre-deployment-tasks: my-task + keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend diff --git a/docs/docs/use-cases/assets/deployment-new-image.yaml b/docs/docs/use-cases/assets/deployment-new-image.yaml index 64bbb7541f..dcb0665529 100644 --- a/docs/docs/use-cases/assets/deployment-new-image.yaml +++ b/docs/docs/use-cases/assets/deployment-new-image.yaml @@ -4,14 +4,16 @@ metadata: name: podtato-head-frontend namespace: podtato-kubectl spec: + selector: + matchLabels: + app.kubernetes.io/name: podtato-head-frontend template: metadata: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head app.kubernetes.io/version: 0.1.0 # The version label stays the same and therefore no related KeptnWorkload will be affected - keptn.sh/pre-deployment-evaluations: my-evaluation - keptn.sh/pre-deployment-tasks: my-task + keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index efc323b8e6..b780ba641b 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -43,8 +43,8 @@ completed for the version set in the labels/annotations. To illustrate the update of a [workload](https://kubernetes.io/docs/concepts/workloads/), let's assume the following example, including -a [workload](https://kubernetes.io/docs/concepts/workloads/) called `podtato-head-frontend` that includes a pre-task and -a pre-evaluation. +a [workload](https://kubernetes.io/docs/concepts/workloads/) called `podtato-head-frontend` that includes a +pre-deployment task. ```yaml {% include "./assets/deployment-initial.yaml" %} @@ -76,25 +76,27 @@ In this case, the deployment should be changed as follows: {% include "./assets/deployment-new-image-and-version.yaml" %} ``` -If you have defined the related `KeptnApp` resource yourself, -this must also be updated to refer to the updated `KeptnWorkload`. -This is a mandatory step, since the `KeptnWorkload` associated with -this updated deployment is not able to progress otherwise. -Therefore, make sure that the version of `podtato-head-frontend` -is updated accordingly: -```yaml -{% include "./assets/app-updated-version.yaml" %} -``` - -Updating the `KeptnApp` also causes all pre-/post-tasks/evaluations -of the `KeptnApp` to be executed again. -In this example, this means that the tasks `wait-for-prometheus`, -and `post-deployment-loadtests` will run again. -If you are using the [automatic app discovery](../guides/auto-app-discovery.md), -you do not need to update the `KeptnApp` resource. -Keptn will take care of that for you. + OBSOLETE If you have defined the related `KeptnApp` resource yourself, + OBSOLETE this must also be updated to refer to the updated `KeptnWorkload`. + OBSOLETE This is a mandatory step, since the `KeptnWorkload` associated with + OBSOLETE this updated deployment is not able to progress otherwise. + OBSOLETE Therefore, make sure that the version of `podtato-head-frontend` + OBSOLETE is updated accordingly: + OBSOLETE + OBSOLETE ```yaml + OBSOLETE {% include "./assets/app-updated-version.yaml" %} + OBSOLETE ``` + OBSOLETE + OBSOLETE Updating the `KeptnApp` also causes all pre-/post-tasks/evaluations + OBSOLETE of the `KeptnApp` to be executed again. + OBSOLETE In this example, this means that the tasks `wait-for-prometheus`, + OBSOLETE and `post-deployment-loadtests` will run again. + OBSOLETE + OBSOLETE If you are using the [automatic app discovery](../guides/auto-app-discovery.md), + OBSOLETE you do not need to update the `KeptnApp` resource. + OBSOLETE Keptn will take care of that for you. After applying the updated manifests, you can monitor the status of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: @@ -145,16 +147,16 @@ would look like this, with the required label being set: {% include "./assets/new-deployment.yaml" %} ``` -The `KeptnApp`, if defined by the user, should contain the -reference to the newly added [workload](https://kubernetes.io/docs/concepts/workloads/). -This is mandatory, as the [workload](https://kubernetes.io/docs/concepts/workloads/) itself is not able to -progress if it is not part of a `KeptnApp`. -For automatically discovered apps this is done -automatically. - -```yaml -{% include "./assets/app-with-new-workload.yaml" %} -``` + OBSOLETE The `KeptnApp`, if defined by the user, should contain the + OBSOLETE reference to the newly added [workload](https://kubernetes.io/docs/concepts/workloads/). + OBSOLETE This is mandatory, as the [workload](https://kubernetes.io/docs/concepts/workloads/) itself is not able to + OBSOLETE progress if it is not part of a `KeptnApp`. + OBSOLETE For automatically discovered apps this is done + OBSOLETE automatically. + OBSOLETE + OBSOLETE ```yaml + OBSOLETE {% include "./assets/app-with-new-workload.yaml" %} + OBSOLETE ``` After applying the updated manifests, you can monitor the status of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: From 9632c74d8927381be1f58bfe18843bfd2996ae0c Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 1 Feb 2024 10:04:14 +0100 Subject: [PATCH 02/11] docs: update documentation for day 2 operations Signed-off-by: Florian Bacher --- .../use-cases/assets/app-updated-version.yaml | 16 ----- .../assets/app-with-new-workload.yaml | 18 ------ .../use-cases/assets/deployment-initial.yaml | 20 ++++-- .../deployment-new-image-and-version.yaml | 4 +- .../assets/deployment-new-image.yaml | 4 +- .../docs/use-cases/assets/new-deployment.yaml | 9 ++- docs/docs/use-cases/day-2-operations.md | 61 ++++++------------- 7 files changed, 43 insertions(+), 89 deletions(-) delete mode 100644 docs/docs/use-cases/assets/app-updated-version.yaml delete mode 100644 docs/docs/use-cases/assets/app-with-new-workload.yaml diff --git a/docs/docs/use-cases/assets/app-updated-version.yaml b/docs/docs/use-cases/assets/app-updated-version.yaml deleted file mode 100644 index 0a0b04f758..0000000000 --- a/docs/docs/use-cases/assets/app-updated-version.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "0.1.0" - preDeploymentTasks: - - wait-for-prometheus - postDeploymentTasks: - - post-deployment-loadtests - workloads: - - name: podtato-head-frontend - version: 0.2.0 # Updated version. Needs to be set to the value of the 'app.kubernetes.io/version' label of the updated deployment - - name: podtato-head-hat - version: 1.1.1 diff --git a/docs/docs/use-cases/assets/app-with-new-workload.yaml b/docs/docs/use-cases/assets/app-with-new-workload.yaml deleted file mode 100644 index 694e379b7c..0000000000 --- a/docs/docs/use-cases/assets/app-with-new-workload.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "0.1.0" - preDeploymentTasks: - - wait-for-prometheus - postDeploymentTasks: - - post-deployment-loadtests - workloads: - - name: podtato-head-frontend - version: 0.1.0 - - name: podtato-head-hat - version: 1.1.1 - - name: podtato-head-left-leg # The newly added workload - version: 0.1.0 diff --git a/docs/docs/use-cases/assets/deployment-initial.yaml b/docs/docs/use-cases/assets/deployment-initial.yaml index 7cd33ebbfc..44d87113a0 100644 --- a/docs/docs/use-cases/assets/deployment-initial.yaml +++ b/docs/docs/use-cases/assets/deployment-initial.yaml @@ -20,12 +20,12 @@ spec: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.3.1 + app.kubernetes.io/version: 0.3.0 keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend - image: ghcr.io/podtato-head/entry:latest + image: ghcr.io/podtato-head/podtato-server:v0.3.0 --- apiVersion: apps/v1 kind: Deployment @@ -42,11 +42,11 @@ spec: labels: app.kubernetes.io/name: podtato-head-hat app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.3.1 + app.kubernetes.io/version: 0.3.0 spec: containers: - name: podtato-head-hat - image: ghcr.io/podtato-head/hat:latest + image: ghcr.io/podtato-head/podtato-server:v0.3.0 --- apiVersion: lifecycle.keptn.sh/v1beta1 kind: KeptnTaskDefinition @@ -57,4 +57,14 @@ spec: function: inline: code: | - console.error("Success") + console.log("Success") +--- +--- +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnAppContext +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + preDeploymentTasks: + - pre-deployment-check diff --git a/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml b/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml index a24360e5dc..76870fcc20 100644 --- a/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml +++ b/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml @@ -12,9 +12,9 @@ spec: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.2.0 # The version label is now updated as well + app.kubernetes.io/version: 0.3.1 # The version label is now updated as well keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend - image: podtato-head-frontend:b # The image tag has been updated from 'a' to 'b' + image: ghcr.io/podtato-head/podtato-server:v0.3.1 # The image tag has been updated from 'a' to 'b' diff --git a/docs/docs/use-cases/assets/deployment-new-image.yaml b/docs/docs/use-cases/assets/deployment-new-image.yaml index dcb0665529..d6b9659745 100644 --- a/docs/docs/use-cases/assets/deployment-new-image.yaml +++ b/docs/docs/use-cases/assets/deployment-new-image.yaml @@ -12,9 +12,9 @@ spec: labels: app.kubernetes.io/name: podtato-head-frontend app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.0 # The version label stays the same and therefore no related KeptnWorkload will be affected + app.kubernetes.io/version: 0.3.0 # the version number stays the same keptn.sh/pre-deployment-tasks: pre-deployment-check spec: containers: - name: podtato-head-frontend - image: podtato-head-frontend:b # Only the image tag has been updated from 'a' to 'b' + image: ghcr.io/podtato-head/podtato-server:v0.3.2 # the image tag has been updated to v0.3.1 diff --git a/docs/docs/use-cases/assets/new-deployment.yaml b/docs/docs/use-cases/assets/new-deployment.yaml index 51d0abb165..cad13511a7 100644 --- a/docs/docs/use-cases/assets/new-deployment.yaml +++ b/docs/docs/use-cases/assets/new-deployment.yaml @@ -4,13 +4,16 @@ metadata: name: podtato-head-left-leg namespace: podtato-kubectl spec: + selector: + matchLabels: + app.kubernetes.io/name: podtato-head-left-leg template: metadata: labels: app.kubernetes.io/name: podtato-head-left-leg app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.0 + app.kubernetes.io/version: 0.3.0 spec: containers: - - name: podtato-head-frontend - image: podtato-head-left-leg:a + - name: podtato-head-left-leg + image: ghcr.io/podtato-head/podtato-server:v0.3.0 diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index b780ba641b..89783dfbb1 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -50,7 +50,8 @@ pre-deployment task. {% include "./assets/deployment-initial.yaml" %} ``` -Now, let's assume that the configuration of that [workload](https://kubernetes.io/docs/concepts/workloads/) needs to be changed. +Now, let's assume that the configuration of that [workload](https://kubernetes.io/docs/concepts/workloads/) +needs to be changed. In this example we assume that the image of that [workload](https://kubernetes.io/docs/concepts/workloads/) should be updated, but a configuration change is not limited to that. From here, you essentially have two options: @@ -76,27 +77,11 @@ In this case, the deployment should be changed as follows: {% include "./assets/deployment-new-image-and-version.yaml" %} ``` - - - OBSOLETE If you have defined the related `KeptnApp` resource yourself, - OBSOLETE this must also be updated to refer to the updated `KeptnWorkload`. - OBSOLETE This is a mandatory step, since the `KeptnWorkload` associated with - OBSOLETE this updated deployment is not able to progress otherwise. - OBSOLETE Therefore, make sure that the version of `podtato-head-frontend` - OBSOLETE is updated accordingly: - OBSOLETE - OBSOLETE ```yaml - OBSOLETE {% include "./assets/app-updated-version.yaml" %} - OBSOLETE ``` - OBSOLETE - OBSOLETE Updating the `KeptnApp` also causes all pre-/post-tasks/evaluations - OBSOLETE of the `KeptnApp` to be executed again. - OBSOLETE In this example, this means that the tasks `wait-for-prometheus`, - OBSOLETE and `post-deployment-loadtests` will run again. - OBSOLETE - OBSOLETE If you are using the [automatic app discovery](../guides/auto-app-discovery.md), - OBSOLETE you do not need to update the `KeptnApp` resource. - OBSOLETE Keptn will take care of that for you. +Applying this causes the `KeptnApp` to be updated with a new +version, and a new `KeptnAppVersion` to be created. +Due to this, all checks defined in the `KeptnAppContext`, +as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` +label are executed again. After applying the updated manifests, you can monitor the status of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: @@ -105,9 +90,9 @@ of the application and related [workloads](https://kubernetes.io/docs/concepts/w $ kubectl get keptnworkloadversion -n podtato-kubectl NAMESPACE NAME APPNAME WORKLOADNAME WORKLOADVERSION PHASE -podtato-kubectl podtato-head-podtato-head-frontend-0.1.0 podtato-head podtato-head-podtato-head-frontend 0.1.0 Completed -podtato-kubectl podtato-head-podtato-head-hat-0.1.1 podtato-head podtato-head-podtato-head-hat 0.1.1 Completed -podtato-kubectl podtato-head-podtato-head-frontend-0.2.0 podtato-head podtato-head-podtato-head-frontend 0.2.0 Completed +podtato-kubectl podtato-head-podtato-head-frontend-0.3.0 podtato-head podtato-head-podtato-head-frontend 0.3.0 Completed +podtato-kubectl podtato-head-podtato-head-hat-0.3.0 podtato-head podtato-head-podtato-head-hat 0.3.0 Completed +podtato-kubectl podtato-head-podtato-head-frontend-0.3.1 podtato-head podtato-head-podtato-head-frontend 0.3.1 Completed ``` As can be seen in the output of the command, the `KeptnWorkloadVersions` from the previous deployment @@ -122,9 +107,9 @@ returning a newly created `KeptnAppVersion`. ```shell $ kubectl get keptnappversion -n podtato-kubectl -NAMESPACE NAME APPNAME VERSION PHASE -podtato-kubectl podtato-head-0.1.0-6bch3iak podtato-head 0.1.0 Completed -podtato-kubectl podtato-head-0.1.0-hf52kauz podtato-head 0.1.0 Completed +NAMESPACE NAME APPNAME VERSION PHASE +podtato-kubectl podtato-head-f13dcb00ea-6b86b273 podtato-head 0.1.0 Completed +podtato-kubectl podtato-head-1c40c739cf-d4735e3a podtato-head 0.1.0 Completed ``` ## Adding a new Workload to an Application @@ -147,17 +132,6 @@ would look like this, with the required label being set: {% include "./assets/new-deployment.yaml" %} ``` - OBSOLETE The `KeptnApp`, if defined by the user, should contain the - OBSOLETE reference to the newly added [workload](https://kubernetes.io/docs/concepts/workloads/). - OBSOLETE This is mandatory, as the [workload](https://kubernetes.io/docs/concepts/workloads/) itself is not able to - OBSOLETE progress if it is not part of a `KeptnApp`. - OBSOLETE For automatically discovered apps this is done - OBSOLETE automatically. - OBSOLETE - OBSOLETE ```yaml - OBSOLETE {% include "./assets/app-with-new-workload.yaml" %} - OBSOLETE ``` - After applying the updated manifests, you can monitor the status of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: @@ -165,12 +139,13 @@ of the application and related [workloads](https://kubernetes.io/docs/concepts/w $ kubectl get keptnworkloadversion -n podtato-kubectl NAMESPACE NAME APPNAME WORKLOADNAME WORKLOADVERSION PHASE -podtato-kubectl podtato-head-podtato-head-frontend-0.1.0 podtato-head podtato-head-podtato-head-frontend 0.1.0 Completed -podtato-kubectl podtato-head-podtato-head-hat-0.1.1 podtato-head podtato-head-podtato-head-hat 0.1.1 Completed -podtato-kubectl podtato-head-podtato-head-left-leg-0.1.0 podtato-head podtato-head-podtato-head-left-leg 0.1.0 Completed +podtato-kubectl podtato-head-podtato-head-frontend-0.3.0 podtato-head podtato-head-podtato-head-frontend 0.3.0 Completed +podtato-kubectl podtato-head-podtato-head-frontend-0.3.1 podtato-head podtato-head-podtato-head-frontend 0.3.1 Completed +podtato-kubectl podtato-head-podtato-head-hat-0.3.0 podtato-head podtato-head-podtato-head-hat 0.3.0 Completed +podtato-kubectl podtato-head-podtato-head-left-leg-0.3.0 podtato-head podtato-head-podtato-head-left-leg 0.3.0 Completed ``` As can be seen in the output of the command, in addition to the previous `KeptnWorkloadVersions`, the newly created -`KeptnWorkloadVersion`, `podtato-head-podtato-head-left-leg-0.1.0` has been added +`KeptnWorkloadVersion`, `podtato-head-podtato-head-left-leg-0.3.0` has been added to the results. From 290baca990ac05cdbcff8bb34a28d503b3341b95 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 1 Feb 2024 10:07:02 +0100 Subject: [PATCH 03/11] fix typo Signed-off-by: Florian Bacher --- docs/docs/use-cases/assets/deployment-new-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/use-cases/assets/deployment-new-image.yaml b/docs/docs/use-cases/assets/deployment-new-image.yaml index d6b9659745..6b386a3439 100644 --- a/docs/docs/use-cases/assets/deployment-new-image.yaml +++ b/docs/docs/use-cases/assets/deployment-new-image.yaml @@ -17,4 +17,4 @@ spec: spec: containers: - name: podtato-head-frontend - image: ghcr.io/podtato-head/podtato-server:v0.3.2 # the image tag has been updated to v0.3.1 + image: ghcr.io/podtato-head/podtato-server:v0.3.1 # the image tag has been updated to v0.3.1 From 6fab90654115198f506a54c3e27cf595948a77a3 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 1 Feb 2024 14:05:16 +0100 Subject: [PATCH 04/11] move assets into dedicated directory Signed-off-by: Florian Bacher --- .../assets/{ => day-2-operations}/deployment-initial.yaml | 0 .../deployment-new-image-and-version.yaml | 0 .../{ => day-2-operations}/deployment-new-image.yaml | 0 .../assets/{ => day-2-operations}/new-deployment.yaml | 2 +- docs/docs/use-cases/day-2-operations.md | 8 ++++---- 5 files changed, 5 insertions(+), 5 deletions(-) rename docs/docs/use-cases/assets/{ => day-2-operations}/deployment-initial.yaml (100%) rename docs/docs/use-cases/assets/{ => day-2-operations}/deployment-new-image-and-version.yaml (100%) rename docs/docs/use-cases/assets/{ => day-2-operations}/deployment-new-image.yaml (100%) rename docs/docs/use-cases/assets/{ => day-2-operations}/new-deployment.yaml (88%) diff --git a/docs/docs/use-cases/assets/deployment-initial.yaml b/docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml similarity index 100% rename from docs/docs/use-cases/assets/deployment-initial.yaml rename to docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml diff --git a/docs/docs/use-cases/assets/deployment-new-image-and-version.yaml b/docs/docs/use-cases/assets/day-2-operations/deployment-new-image-and-version.yaml similarity index 100% rename from docs/docs/use-cases/assets/deployment-new-image-and-version.yaml rename to docs/docs/use-cases/assets/day-2-operations/deployment-new-image-and-version.yaml diff --git a/docs/docs/use-cases/assets/deployment-new-image.yaml b/docs/docs/use-cases/assets/day-2-operations/deployment-new-image.yaml similarity index 100% rename from docs/docs/use-cases/assets/deployment-new-image.yaml rename to docs/docs/use-cases/assets/day-2-operations/deployment-new-image.yaml diff --git a/docs/docs/use-cases/assets/new-deployment.yaml b/docs/docs/use-cases/assets/day-2-operations/new-deployment.yaml similarity index 88% rename from docs/docs/use-cases/assets/new-deployment.yaml rename to docs/docs/use-cases/assets/day-2-operations/new-deployment.yaml index cad13511a7..0f0f8ea2c5 100644 --- a/docs/docs/use-cases/assets/new-deployment.yaml +++ b/docs/docs/use-cases/assets/day-2-operations/new-deployment.yaml @@ -16,4 +16,4 @@ spec: spec: containers: - name: podtato-head-left-leg - image: ghcr.io/podtato-head/podtato-server:v0.3.0 + image: ghcr.io/podtato-head/podtato-server:v0.3.1 diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index 89783dfbb1..ed84c08254 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -47,7 +47,7 @@ a [workload](https://kubernetes.io/docs/concepts/workloads/) called `podtato-hea pre-deployment task. ```yaml -{% include "./assets/deployment-initial.yaml" %} +{% include "./assets/day-2-operations/deployment-initial.yaml" %} ``` Now, let's assume that the configuration of that [workload](https://kubernetes.io/docs/concepts/workloads/) @@ -63,7 +63,7 @@ and the image must be updated as quickly as possible. To do that, change `podtato-head-frontend` as follows: ```yaml -{% include "./assets/deployment-new-image.yaml" %} +{% include "./assets/day-2-operations/deployment-new-image.yaml" %} ``` * **Update the configuration *and* the version label:** @@ -74,7 +74,7 @@ are executed before the updated pods are scheduled. In this case, the deployment should be changed as follows: ```yaml -{% include "./assets/deployment-new-image-and-version.yaml" %} +{% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} ``` Applying this causes the `KeptnApp` to be updated with a new @@ -129,7 +129,7 @@ For example, to add the deployment `podtato-head-left-leg` to the would look like this, with the required label being set: ```yaml -{% include "./assets/new-deployment.yaml" %} +{% include "./assets/day-2-operations/new-deployment.yaml" %} ``` After applying the updated manifests, you can monitor the status From 9706e20bd7b8bac7b690fdd5e0a1864f42675bb2 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 1 Feb 2024 15:40:58 +0100 Subject: [PATCH 05/11] Apply suggestions from code review Co-authored-by: Moritz Wiesinger Signed-off-by: Florian Bacher --- .../use-cases/assets/day-2-operations/deployment-initial.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml b/docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml index 44d87113a0..34d8dbcedd 100644 --- a/docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml +++ b/docs/docs/use-cases/assets/day-2-operations/deployment-initial.yaml @@ -4,7 +4,6 @@ metadata: name: podtato-kubectl annotations: keptn.sh/lifecycle-toolkit: "enabled" - --- apiVersion: apps/v1 kind: Deployment @@ -59,7 +58,6 @@ spec: code: | console.log("Success") --- ---- apiVersion: lifecycle.keptn.sh/v1beta1 kind: KeptnAppContext metadata: From acb0447784e5ce1362b8f95059d96fe7d60f8687 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Fri, 2 Feb 2024 08:10:40 +0100 Subject: [PATCH 06/11] Apply suggestions from code review Co-authored-by: Meg McRoberts Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index ed84c08254..e08816010b 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -77,9 +77,15 @@ In this case, the deployment should be changed as follows: {% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} ``` -Applying this causes the `KeptnApp` to be updated with a new -version, and a new `KeptnAppVersion` to be created. -Due to this, all checks defined in the `KeptnAppContext`, +Applying this causes the +[KeptnApp](../reference/crd-reference/app.md) +resource to be updated with a new +version, and a new +[KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1#keptnappversion) +resource to be created. +Due to this, all checks defined in the +[KeptnAppContext](../reference/api-reference/appcontext.md) +resource as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` label are executed again. @@ -95,7 +101,9 @@ podtato-kubectl podtato-head-podtato-head-hat-0.3.0 podtato-head pod podtato-kubectl podtato-head-podtato-head-frontend-0.3.1 podtato-head podtato-head-podtato-head-frontend 0.3.1 Completed ``` -As can be seen in the output of the command, the `KeptnWorkloadVersions` from the previous deployment +As can be seen in the output of the command, the +[KeptnWorkloadVersion](reference/api-reference/lifecycle/v1beta1#keptnworkloadversion) +resources from the previous deployment are still here, but a new `KeptnWorkloadVersion` for the updated [workload](https://kubernetes.io/docs/concepts/workloads/) has been added. For the [workload](https://kubernetes.io/docs/concepts/workloads/) that From 67dd1b9bbb0f18cf7d361064231067c6dc4e1bb2 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Fri, 2 Feb 2024 08:32:42 +0100 Subject: [PATCH 07/11] adapt to comments from pr review Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index e08816010b..d2e2ee9604 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -41,18 +41,18 @@ a change of a [workload](https://kubernetes.io/docs/concepts/workloads/) configu and therefore no pre- and post-tasks/evaluations are executed because they have already been completed for the version set in the labels/annotations. -To illustrate the update of a [workload](https://kubernetes.io/docs/concepts/workloads/), +To illustrate the update of a workload, let's assume the following example, including a [workload](https://kubernetes.io/docs/concepts/workloads/) called `podtato-head-frontend` that includes a pre-deployment task. -```yaml -{% include "./assets/day-2-operations/deployment-initial.yaml" %} -``` + ```yaml + {% include "./assets/day-2-operations/deployment-initial.yaml" %} + ``` -Now, let's assume that the configuration of that [workload](https://kubernetes.io/docs/concepts/workloads/) +Now, let's assume that the configuration of that workload needs to be changed. -In this example we assume that the image of that [workload](https://kubernetes.io/docs/concepts/workloads/) +In this example we assume that the image of that workload should be updated, but a configuration change is not limited to that. From here, you essentially have two options: @@ -62,9 +62,9 @@ of the result of any task or evaluation, e.g., when the previously used image ha and the image must be updated as quickly as possible. To do that, change `podtato-head-frontend` as follows: -```yaml -{% include "./assets/day-2-operations/deployment-new-image.yaml" %} -``` + ```yaml + {% include "./assets/day-2-operations/deployment-new-image.yaml" %} + ``` * **Update the configuration *and* the version label:** Doing so causes the `KeptnWorkload` that is associated @@ -73,9 +73,9 @@ and therefore the pre-task `my-task` and pre-evaluation `my-evaluation` are executed before the updated pods are scheduled. In this case, the deployment should be changed as follows: -```yaml -{% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} -``` + ```yaml + {% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} + ``` Applying this causes the [KeptnApp](../reference/crd-reference/app.md) @@ -84,13 +84,13 @@ version, and a new [KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1#keptnappversion) resource to be created. Due to this, all checks defined in the -[KeptnAppContext](../reference/api-reference/appcontext.md) +[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1#appcontext.md) resource as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` label are executed again. After applying the updated manifests, you can monitor the status -of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: +of the application and related workloads using the following commands: ```shell $ kubectl get keptnworkloadversion -n podtato-kubectl @@ -102,11 +102,11 @@ podtato-kubectl podtato-head-podtato-head-frontend-0.3.1 podtato-head pod ``` As can be seen in the output of the command, the -[KeptnWorkloadVersion](reference/api-reference/lifecycle/v1beta1#keptnworkloadversion) +[KeptnWorkloadVersion](../reference/api-reference/lifecycle/v1beta1#keptnworkloadversion) resources from the previous deployment -are still here, but a new `KeptnWorkloadVersion` for the updated [workload](https://kubernetes.io/docs/concepts/workloads/) +are still here, but a new `KeptnWorkloadVersion` for the updated workload has been added. -For the [workload](https://kubernetes.io/docs/concepts/workloads/) that +For the workload that remained unchanged (`podtato-head-hat`), no new `KeptnWorkloadVersion` needed to be created. Similarly, retrieving the list of `KeptnAppVersions` will reflect the update by @@ -122,7 +122,7 @@ podtato-kubectl podtato-head-1c40c739cf-d4735e3a podtato-head 0.1.0 Co ## Adding a new Workload to an Application -To add a new [workload](https://kubernetes.io/docs/concepts/workloads/) (e.g. a new deployment) to an existing app, +To add a new workload (e.g. a new deployment) to an existing app, you must: * Make sure the @@ -136,12 +136,12 @@ For example, to add the deployment `podtato-head-left-leg` to the `podtato-head` application, the configuration for that new deployment would look like this, with the required label being set: -```yaml -{% include "./assets/day-2-operations/new-deployment.yaml" %} -``` + ```yaml + {% include "./assets/day-2-operations/new-deployment.yaml" %} + ``` After applying the updated manifests, you can monitor the status -of the application and related [workloads](https://kubernetes.io/docs/concepts/workloads/) using the following commands: +of the application and related workloads using the following commands: ```shell $ kubectl get keptnworkloadversion -n podtato-kubectl From 37e8eedffcaaaa37e1aa20e7b8aeb7e4d8c36b44 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Fri, 2 Feb 2024 08:39:35 +0100 Subject: [PATCH 08/11] adapt to comments from pr review Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index d2e2ee9604..15d6a1c2ac 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -46,9 +46,9 @@ let's assume the following example, including a [workload](https://kubernetes.io/docs/concepts/workloads/) called `podtato-head-frontend` that includes a pre-deployment task. - ```yaml - {% include "./assets/day-2-operations/deployment-initial.yaml" %} - ``` +```yaml +{% include "./assets/day-2-operations/deployment-initial.yaml" %} +``` Now, let's assume that the configuration of that workload needs to be changed. @@ -62,9 +62,9 @@ of the result of any task or evaluation, e.g., when the previously used image ha and the image must be updated as quickly as possible. To do that, change `podtato-head-frontend` as follows: - ```yaml - {% include "./assets/day-2-operations/deployment-new-image.yaml" %} - ``` + ```yaml + {% include "./assets/day-2-operations/deployment-new-image.yaml" %} + ``` * **Update the configuration *and* the version label:** Doing so causes the `KeptnWorkload` that is associated @@ -73,9 +73,9 @@ and therefore the pre-task `my-task` and pre-evaluation `my-evaluation` are executed before the updated pods are scheduled. In this case, the deployment should be changed as follows: - ```yaml - {% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} - ``` + ```yaml + {% include "./assets/day-2-operations/deployment-new-image-and-version.yaml" %} + ``` Applying this causes the [KeptnApp](../reference/crd-reference/app.md) @@ -136,9 +136,9 @@ For example, to add the deployment `podtato-head-left-leg` to the `podtato-head` application, the configuration for that new deployment would look like this, with the required label being set: - ```yaml - {% include "./assets/day-2-operations/new-deployment.yaml" %} - ``` +```yaml +{% include "./assets/day-2-operations/new-deployment.yaml" %} +``` After applying the updated manifests, you can monitor the status of the application and related workloads using the following commands: From 071375417565490e357192817232187bee406611 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Mon, 5 Feb 2024 07:37:44 +0100 Subject: [PATCH 09/11] fix links Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index 15d6a1c2ac..3d464ac91a 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -81,10 +81,10 @@ Applying this causes the [KeptnApp](../reference/crd-reference/app.md) resource to be updated with a new version, and a new -[KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1#keptnappversion) +[KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappversion) resource to be created. Due to this, all checks defined in the -[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1#appcontext.md) +[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1/index.md#appcontext.md) resource as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` label are executed again. @@ -102,7 +102,7 @@ podtato-kubectl podtato-head-podtato-head-frontend-0.3.1 podtato-head pod ``` As can be seen in the output of the command, the -[KeptnWorkloadVersion](../reference/api-reference/lifecycle/v1beta1#keptnworkloadversion) +[KeptnWorkloadVersion](../reference/api-reference/lifecycle/v1beta1/index.md#keptnworkloadversion) resources from the previous deployment are still here, but a new `KeptnWorkloadVersion` for the updated workload has been added. From 169b3afba294af56791647b2ba2ae41eaa780a73 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Mon, 5 Feb 2024 08:04:24 +0100 Subject: [PATCH 10/11] Update docs/docs/use-cases/day-2-operations.md Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index 3d464ac91a..c381812a88 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -84,7 +84,7 @@ version, and a new [KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappversion) resource to be created. Due to this, all checks defined in the -[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1/index.md#appcontext.md) +[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappcontext.md) resource as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` label are executed again. From 5c3fc5015ccb9d11bc68616cc4a7e7a73e45641b Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Mon, 5 Feb 2024 08:33:20 +0100 Subject: [PATCH 11/11] Update docs/docs/use-cases/day-2-operations.md Co-authored-by: Moritz Wiesinger Signed-off-by: Florian Bacher --- docs/docs/use-cases/day-2-operations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/use-cases/day-2-operations.md b/docs/docs/use-cases/day-2-operations.md index c381812a88..6c577c3356 100644 --- a/docs/docs/use-cases/day-2-operations.md +++ b/docs/docs/use-cases/day-2-operations.md @@ -84,7 +84,7 @@ version, and a new [KeptnAppVersion](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappversion) resource to be created. Due to this, all checks defined in the -[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappcontext.md) +[KeptnAppContext](../reference/api-reference/lifecycle/v1beta1/index.md#keptnappcontext) resource as well as those defined in the deployment's `keptn.sh/pre-deployment-tasks` label are executed again.