Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
docs: Added example for manual testing (#81)
Browse files Browse the repository at this point in the history
* docs: Added example for manual testing

Signed-off-by: Christian Kreuzberger <[email protected]>

* fix typos from review

Signed-off-by: Christian Kreuzberger <[email protected]>
  • Loading branch information
christian-kreuzberger-dtx authored Jun 20, 2022
1 parent 636d0b0 commit 882fa6f
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ It is recommended to make use of branches as follows:

When writing code, it is recommended to follow the coding style suggested by the [Golang community](https://github.com/golang/go/wiki/CodeReviewComments).

To manually verify your changes, please follow the guide in the [example/ folder](example).

### How to release a new version of this service

It is assumed that the current development takes place in the `main` branch (either via Pull Requests or directly).
Expand Down
10 changes: 10 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# How to manually test unleash-service

1. Install and configure Unleash (out of scope here)
2. Install unleash-service (see [Installation instructions](../README.md#Installation))
3. Create Kubernetes secret for unleash-service to connect to Unleash: `kubectl -n keptn create secret generic unleash --from-literal="UNLEASH_SERVER_URL=http://unleash.unleash-dev/api" --from-literal="UNLEASH_USER=keptn" --from-literal="UNLEASH_TOKEN=keptn"`
4. Create your Keptn project with a stage `production` and a sequence `remediation`: `keptn create project sockshop --shipyard=shipyard.yaml`
5. Create a service: `keptn create service carts --project sockshop`
6. Add remediation.yaml to your project: `keptn add-resource --project sockshop --service carts --stage production --resource remediation.yaml --resourceUri remediation.yaml`
7. Trigger remediation using CLI: `keptn send event -f remediation-triggered.json`
8. Watch :)
17 changes: 17 additions & 0 deletions example/remediation-triggered.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "sh.keptn.event.production.remediation.triggered",
"specversion": "1.0",
"source": "https:\/\/github.com\/keptn-contrib\/prometheus-service",
"id": "f2b878d3-03c0-4e8f-bc3f-454bc1b3d79d",
"time": "2019-06-07T07:02:15.64489Z",
"contenttype": "application\/json",
"data": {
"project": "sockshop",
"stage": "production",
"service": "carts",
"problem": {
"problemTitle": "failure_rate_increase",
"rootCause": "Failure rate increase"
}
}
}
13 changes: 13 additions & 0 deletions example/remediation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: spec.keptn.sh/0.1.4
kind: Remediation
metadata:
name: carts-remediation
spec:
remediations:
- problemType: Failure rate increase
actionsOnOpen:
- action: toggle-feature
name: Toogle feature flag
description: Toogle feature flag EnablePromotion to OFF
value:
EnablePromotion: "off"
21 changes: 21 additions & 0 deletions example/shipyard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: "spec.keptn.sh/0.2.2"
kind: "Shipyard"
metadata:
name: "shipyard-sockshop"
spec:
stages:
- name: "production"
sequences:
- name: "remediation"
triggeredOn:
- event: "production.remediation.finished"
selector:
match:
evaluation.result: "fail"
tasks:
- name: "get-action"
- name: "action"
- name: "evaluation"
triggeredAfter: "3m"
properties:
timeframe: "3m"

0 comments on commit 882fa6f

Please sign in to comment.