Skip to content

Commit

Permalink
feat: add keptn
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com>
  • Loading branch information
Thomas Schuetz committed Mar 15, 2023
1 parent 8f75d9a commit ba856c7
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
21 changes: 21 additions & 0 deletions keptn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# renovate: datasource=github-tags depName=keptn/lifecycle-toolkit
KEPTN_VERSION ?= v0.6.0

.PHONY: install
install:
kubectl apply -f https://github.com/keptn/lifecycle-toolkit/releases/download/$(KEPTN_VERSION)/manifest.yaml

.PHONY: uninstall
uninstall:
kubectl delete -f https://github.com/keptn/lifecycle-toolkit/releases/download/$(KEPTN_VERSION)/manifest.yaml

.PHONY: deploy-sample
deploy-sample:
kustomize build ./app | kubectl apply -f -

.PHONY: test
test: install deploy-sample
kubectl kuttl test --start-kind=false ./kuttl --config=./kuttl/kuttl-test.yaml



16 changes: 16 additions & 0 deletions keptn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Deliver with Keptn
![Keptn](https://img.shields.io/badge/Keptn-v0.6.0-blue)
![PodTatoHead](https://img.shields.io/badge/PodTatoHead-v0.3.0-orange)

## Pre-requisites
* Kubernetes cluster >= 1.24 installed

## Deliver
Keptn hooks in the delivery process by injecting a scheduler and observes the deployment process. Furthermore, pre- & post-deployment tests can be executed and evaluations can be performed to ensure the quality of the service. This can be done on a Workload (Deployment, StatefulSet, DaemonSet, etc.) or on an Application Level (e.g., the whole podtato-head application).

## Install Keptn
Keptn itself is installed using a Kubernetes manifest or a Helm chart. In this example, we will use the manifest to install Keptn. This can be installed using the following command:

```console
kubectl apply -f https://github.com/keptn/lifecycle-toolkit/releases/download/v0.6.0/manifest.yaml
```
20 changes: 20 additions & 0 deletions keptn/app/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnApp
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
version: "0.1.0"
workloads:
- name: podtato-head-left-arm
version: 0.3.0
- name: podtato-head-left-leg
version: 0.3.0
- name: podtato-head-frontend
version: 0.3.0
- name: podtato-head-right-arm
version: 0.3.0
- name: podtato-head-right-leg
version: 0.3.0
- name: podtato-head-hat
version: 0.3.0
7 changes: 7 additions & 0 deletions keptn/app/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
- https://github.com/podtato-head/podtato-head-app/releases/download/v0.3.0/manifest.yaml
- app.yaml

patchesStrategicMerge:
- manifest.yaml

90 changes: 90 additions & 0 deletions keptn/app/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: v1
kind: Namespace
metadata:
name: podtato-kubectl
annotations:
keptn.sh/lifecycle-toolkit: "enabled"

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-frontend
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-frontend
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-hat
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-hat
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-left-leg
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-left-leg
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-right-leg
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-right-leg
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-left-arm
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-left-arm
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-right-arm
namespace: podtato-kubectl
spec:
template:
metadata:
labels:
app.kubernetes.io/name: podtato-head-right-arm
app.kubernetes.io/part-of: podtato-head
app.kubernetes.io/version: 0.3.0
7 changes: 7 additions & 0 deletions keptn/kuttl/kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1
kind: TestSuite
testDirs:
- ./test
timeout: 400
skipDelete: true
namespace: podtato-kubectl
13 changes: 13 additions & 0 deletions keptn/kuttl/test/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnAppVersion
metadata:
name: podtato-head-0.1.0-1
namespace: podtato-kubectl
status:
currentPhase: Completed
postDeploymentEvaluationStatus: Succeeded
postDeploymentStatus: Succeeded
preDeploymentEvaluationStatus: Succeeded
preDeploymentStatus: Succeeded
status: Succeeded
workloadOverallStatus: Succeeded

0 comments on commit ba856c7

Please # to comment.