Skip to content

Commit

Permalink
chore: adapt examples to use v1beta1 API resources (#2868)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
odubajDT committed Jan 25, 2024
1 parent 7e71022 commit 587773f
Show file tree
Hide file tree
Showing 35 changed files with 72 additions and 244 deletions.
4 changes: 0 additions & 4 deletions examples/sample-app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ deploy-version-1:
deploy-version-2:
kubectl apply -k version-2

.PHONY: deploy-version-3
deploy-version-3:
kubectl apply -k version-3

.PHONY: undeploy-podtatohead
undeploy-podtatohead:
kubectl delete ns "$(PODTATO_NAMESPACE)" --ignore-not-found=true
Expand Down
13 changes: 3 additions & 10 deletions examples/sample-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubectl create secret generic slack-secret --from-literal=SECURE_DATA='{"slack_h
### Enable post deployment task

To enable Slack notification add `post-deployment-notification` in as a postDeploymentTasks in the
[app.yaml](base/app.yaml) file as shown below.
[appcontext.yaml](base/appcontext.yaml) file as shown below.

```yaml
postDeploymentTasks:
Expand Down Expand Up @@ -60,17 +60,10 @@ You could also open up a browser and watch the progress in Jaeger.
You can find the Context ID in the "TraceId" Field of
the KeptnAppVersion

The deployment should fail because of too few cpu resources
After some time, you should see that everything is successful

## Deploy Version 2 of the PodTatoHead
## Deploy Version 2

```make deploy-version-2```

* Watch the progress of the deployments
* After some time, you should see that everything is successful

## Deploy Version 3

```make deploy-version-3```

* This should only change one service, you can see that only this changed in the trace
2 changes: 1 addition & 1 deletion examples/sample-app/base/app-post-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: post-deployment-notification
Expand Down
16 changes: 0 additions & 16 deletions examples/sample-app/base/app.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions examples/sample-app/base/appcontext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: podtato-head
namespace: podtato-kubectl
2 changes: 1 addition & 1 deletion examples/sample-app/base/container-task.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: container-sleep
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-app/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resources:
- https://github.com/podtato-head/podtato-head-app/releases/download/v0.3.1/manifest.yaml
- app.yaml
- app-post-deploy.yaml
- appcontext.yaml
- provider.yaml
- metric.yaml
- container-task.yaml
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-app/base/python-task.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: python-secret
Expand Down
6 changes: 3 additions & 3 deletions examples/sample-app/version-1/app-pre-deploy-eval.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnEvaluationDefinition
metadata:
name: app-pre-deploy-eval-1
name: app-pre-deploy-eval-2
namespace: podtato-kubectl
spec:
objectives:
- keptnMetricRef:
name: available-cpus
namespace: podtato-kubectl
evaluationTarget: ">100"
evaluationTarget: ">1"
2 changes: 1 addition & 1 deletion examples/sample-app/version-1/app-pre-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: pre-deployment-check-frontend
Expand Down
21 changes: 0 additions & 21 deletions examples/sample-app/version-1/app.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions examples/sample-app/version-1/appcontext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
preDeploymentEvaluations:
- app-pre-deploy-eval-2
preDeploymentTasks:
- container-sleep
- python-secret
2 changes: 1 addition & 1 deletion examples/sample-app/version-1/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ resources:
- app-pre-deploy-eval.yaml

patchesStrategicMerge:
- app.yaml
- appcontext.yaml
- manifest.yaml
2 changes: 1 addition & 1 deletion examples/sample-app/version-2/app-pre-deploy-eval.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnEvaluationDefinition
metadata:
name: app-pre-deploy-eval-2
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-app/version-2/app-pre-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: pre-deployment-check-frontend
Expand Down
21 changes: 0 additions & 21 deletions examples/sample-app/version-2/app.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions examples/sample-app/version-2/appcontext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
preDeploymentTasks:
- container-sleep
- python-secret
2 changes: 1 addition & 1 deletion examples/sample-app/version-2/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ resources:
- app-pre-deploy-eval.yaml

patchesStrategicMerge:
- app.yaml
- appcontext.yaml
- manifest.yaml
2 changes: 1 addition & 1 deletion examples/sample-app/version-2/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
metadata:
labels:
keptn.sh/pre-deployment-tasks: pre-deployment-check-frontend
app.kubernetes.io/version: 0.1.1
app.kubernetes.io/version: 0.1.2

---
apiVersion: apps/v1
Expand Down
11 changes: 0 additions & 11 deletions examples/sample-app/version-3/app-pre-deploy-eval.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions examples/sample-app/version-3/app-pre-deploy.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions examples/sample-app/version-3/app.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions examples/sample-app/version-3/kustomization.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions examples/sample-app/version-3/manifest.yaml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
postDeploymentTasks:
- post-deployment-hello
preDeploymentEvaluations: # Comment out this four lines if you do not have a prometheus installation
- my-prometheus-definition1
postDeploymentEvaluations:
- my-prometheus-definition2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha2
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: check-entry-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: lifecycle.keptn.sh/v1alpha2
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: post-deployment-hello
Expand Down
Loading

0 comments on commit 587773f

Please sign in to comment.