From 20b3afb4ec99d2254fc33570ce1ec81712324d35 Mon Sep 17 00:00:00 2001 From: Christian Kreuzberger Date: Mon, 6 Apr 2020 14:56:46 +0200 Subject: [PATCH] Added cleanup instructions; Fixed some issues within the template --- README.md | 43 ++++++++++++++++--- postgres/templates/postgres-deployment.yaml | 1 + postgres/templates/postgres-service.yaml | 1 - .../tempberry-backend-deployment.yaml | 11 +++-- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 248f6fa..bac86aa 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,46 @@ # Keptn Tempberry +This is an example project for [Keptn](https://keptn.sh) for [Tempberry](https://github.com/ChristianKreuzberger/tempberry). + +## Prerequesits + +* A Kubernetes cluster (version 1.14 or 1.15) +* A working Keptn 0.6.1 installation + ## Setup +1. Specify for project name in a variable +```console +PROJECT=tempberry +``` + +2. Create the project using Keptn Cli +```console +keptn create project $PROJECT --shipyard=shipyard.yaml +``` + +3. Onboard postgres and tempberry-backend ```console -keptn create project ck-tempberry --shipyard=shipyard.yaml +keptn onboard service postgres --project=$PROJECT --chart=./postgres --deployment-strategy=direct +keptn onboard service tempberry-backend --project=$PROJECT --chart=./tempberry-backend +``` -keptn onboard service postgres --project=ck-tempberry --chart=./postgres --deployment-strategy=direct -keptn onboard service tempberry-backend --project=ck-tempberry --chart=./tempberry-backend +4. And finally, send new artifacts for postgres and tempberry-backend +```console +keptn send event new-artifact --project=$PROJECT --service=postgres --image=postgres:10.4 +keptn send event new-artifact --project=$PROJECT --service=tempberry-backend --image=ckreuzberger/tempberry-backend:0.1 ``` -send new artifacts +## Cleanup + +Make sure you have set the environment variable `$PROJECT` as specified in the Setup instructions above. ```console -keptn send event new-artifact --project=ck-tempberry --service=postgres --image=postgres:10.4 -keptn send event new-artifact --project=ck-tempberry --service=tempberry-backend --image=ckreuzberger/tempberry-backend:master -``` \ No newline at end of file +keptn delete project $PROJECT +kubectl delete namespace $PROJECT-dev $PROJECT-hardening $PROJECT-production +``` + +## License + +See [LICENSE](LICENSE). + diff --git a/postgres/templates/postgres-deployment.yaml b/postgres/templates/postgres-deployment.yaml index 61df63d..f50fbd8 100644 --- a/postgres/templates/postgres-deployment.yaml +++ b/postgres/templates/postgres-deployment.yaml @@ -36,6 +36,7 @@ spec: template: metadata: labels: + app: postgres app.kubernetes.io/name: {{ .Values.keptn.service | default "" }} # = Keptn Service Name app.kubernetes.io/instance: "{{ .Values.keptn.service | default "" }}-{{ .Values.keptn.deployment | default "" }}" app.kubernetes.io/component: database diff --git a/postgres/templates/postgres-service.yaml b/postgres/templates/postgres-service.yaml index 11b3491..45ab48c 100644 --- a/postgres/templates/postgres-service.yaml +++ b/postgres/templates/postgres-service.yaml @@ -5,7 +5,6 @@ kind: Service metadata: name: postgres spec: - type: ClusterIP ports: - port: 5432 selector: diff --git a/tempberry-backend/templates/tempberry-backend-deployment.yaml b/tempberry-backend/templates/tempberry-backend-deployment.yaml index fab0ab8..3c44e1a 100644 --- a/tempberry-backend/templates/tempberry-backend-deployment.yaml +++ b/tempberry-backend/templates/tempberry-backend-deployment.yaml @@ -48,6 +48,9 @@ spec: - name: DATABASE_HOST value: "postgres" + - name: DATABASE_PORT + value: "5432" + - name: DATABASE_URL value: postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@$(DATABASE_HOST)/$(DATABASE_NAME) @@ -67,15 +70,15 @@ spec: cpu: 100m livenessProbe: httpGet: - path: / - port: 8080 + path: /api/ + port: 8000 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 readinessProbe: httpGet: - path: / - port: 8080 + path: /api/ + port: 8000 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15