diff --git a/README.md b/README.md index a0a33b0..b8f83ba 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ the [LitmusChaos](https://litmuschaos.io) framework. | Keptn Version | [litmus-service Docker Image](https://hub.docker.com/r/keptnsandbox/litmus-service/tags) | |:----------------:|:----------------------------------------:| | 0.7.1 | keptnsandbox/litmus-service:0.1.0 | -| 0.7.2 | TBD | +| 0.7.2 | keptnsandbox/litmus-service:0.1.0 | +| 0.7.3 | keptnsandbox/litmus-service:0.1.0 | ## Prerequisites diff --git a/test-data/carts-db/Chart.yaml b/test-data/carts-db/Chart.yaml deleted file mode 100755 index 1d6030e..0000000 --- a/test-data/carts-db/Chart.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -description: A Helm chart for service carts-db -name: carts-db -version: 0.1.0 diff --git a/test-data/carts-db/templates/carts-db-deployment.yaml b/test-data/carts-db/templates/carts-db-deployment.yaml deleted file mode 100755 index 8846fa7..0000000 --- a/test-data/carts-db/templates/carts-db-deployment.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: carts-db-mongodata -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: carts-db - labels: - app: carts-db -spec: - replicas: {{ .Values.replicaCount }} - strategy: - type: Recreate - selector: - matchLabels: - app: carts-db - template: - metadata: - labels: - app: carts-db - deployment: carts-db - app.kubernetes.io/name: {{ .Values.keptn.service }} - app.kubernetes.io/instance: "{{ .Values.keptn.service }}-{{ .Values.keptn.deployment }}" - app.kubernetes.io/component: database - app.kubernetes.io/part-of: "{{ .Values.keptn.project }}" - app.kubernetes.io/managed-by: Keptn - app.kubernetes.io/version: {{ (split ":" .Values.image)._1 | default "latest" }} - spec: - containers: - - name: carts-db - image: {{ .Values.image }} - imagePullPolicy: IfNotPresent - ports: - - containerPort: 27017 - resources: {} - volumeMounts: - - mountPath: /data/db - name: carts-db-mongodata - restartPolicy: Always - volumes: - - name: carts-db-mongodata - persistentVolumeClaim: - claimName: carts-db-mongodata diff --git a/test-data/carts-db/templates/carts-db-service.yaml b/test-data/carts-db/templates/carts-db-service.yaml deleted file mode 100755 index 6fa9e78..0000000 --- a/test-data/carts-db/templates/carts-db-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: carts-db -spec: - ports: - - name: {{ .Values.service.name }} - port: {{ .Values.service.externalPort }} - targetPort: {{ .Values.service.internalPort }} - selector: - app: carts-db \ No newline at end of file diff --git a/test-data/carts-db/values.yaml b/test-data/carts-db/values.yaml deleted file mode 100755 index 646b7e4..0000000 --- a/test-data/carts-db/values.yaml +++ /dev/null @@ -1,6 +0,0 @@ -image: mongo -service: - externalPort: 27017 - internalPort: 27017 - name: carts-db -replicaCount: 1 diff --git a/test-data/carts/Chart.yaml b/test-data/carts/Chart.yaml deleted file mode 100755 index cfb84b9..0000000 --- a/test-data/carts/Chart.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -description: A Helm chart for service carts -name: carts -version: 0.1.0 diff --git a/test-data/carts/templates/deployment.yaml b/test-data/carts/templates/deployment.yaml deleted file mode 100755 index 5fa744a..0000000 --- a/test-data/carts/templates/deployment.yaml +++ /dev/null @@ -1,72 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: carts -spec: - replicas: {{ .Values.replicaCount }} - strategy: - rollingUpdate: - maxUnavailable: 0 - type: RollingUpdate - selector: - matchLabels: - app: carts - template: - metadata: - labels: - app: carts - app.kubernetes.io/name: {{ .Values.keptn.service }} - app.kubernetes.io/instance: "{{ .Values.keptn.service }}-{{ .Values.keptn.deployment }}" - app.kubernetes.io/component: api - app.kubernetes.io/part-of: "{{ .Values.keptn.project }}" - app.kubernetes.io/managed-by: Keptn - app.kubernetes.io/version: {{ (split ":" .Values.image)._1 | default "latest" }} - spec: - containers: - - name: carts - image: "{{ .Values.image }}" - imagePullPolicy: IfNotPresent - ports: - - name: http - protocol: TCP - containerPort: 8080 - env: - - name: DT_CUSTOM_PROP - value: "version={{ .Chart.Version }} revision={{ .Release.Revision }} releasename={{ .Release.Name }} keptn_project={{ .Values.keptn.project }} keptn_service={{ .Values.keptn.service }} keptn_stage={{ .Values.keptn.stage }} keptn_deployment={{ .Values.keptn.deployment }}" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: "metadata.name" - - name: DEPLOYMENT_NAME - valueFrom: - fieldRef: - fieldPath: "metadata.labels['deployment']" - - name: CONTAINER_IMAGE - value: "{{ .Values.image }}" - - name: KEPTN_PROJECT - value: "{{ .Chart.Name }}" - - name: KEPTN_STAGE - valueFrom: - fieldRef: - fieldPath: "metadata.namespace" - - name: KEPTN_SERVICE - value: "carts" - - name: UNLEASH_SERVER_URL - value: "http://unleash.unleash-dev/api" - livenessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: 60 - periodSeconds: 10 - timeoutSeconds: 15 - readinessProbe: - httpGet: - path: /health - port: 8080 - initialDelaySeconds: 60 - periodSeconds: 10 - timeoutSeconds: 15 - - diff --git a/test-data/carts/templates/service.yaml b/test-data/carts/templates/service.yaml deleted file mode 100755 index daea781..0000000 --- a/test-data/carts/templates/service.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: carts -spec: - type: ClusterIP - ports: - - name: http - port: 80 - protocol: TCP - targetPort: 8080 - selector: - app: carts diff --git a/test-data/carts/values.yaml b/test-data/carts/values.yaml deleted file mode 100755 index 2eeb3df..0000000 --- a/test-data/carts/values.yaml +++ /dev/null @@ -1,2 +0,0 @@ -image: docker.io/keptnexamples/carts:0.11.1 -replicaCount: 1 \ No newline at end of file diff --git a/test-data/helloservice/deploy-event.json b/test-data/helloservice/deploy-event.json index a1e7ae3..6a50423 100644 --- a/test-data/helloservice/deploy-event.json +++ b/test-data/helloservice/deploy-event.json @@ -12,7 +12,7 @@ "stage": "", "valuesCanary": { "image": "jetzlstorfer/hello-server:v0.1.0", - "replicaCount": 1 + "replicaCount": 3 } }, "source": "https://github.com/keptn/keptn/cli#configuration-change", diff --git a/test-data/helloservice/helm/templates/service.yaml b/test-data/helloservice/helm/templates/service.yaml index 936dc1a..c031ab3 100644 --- a/test-data/helloservice/helm/templates/service.yaml +++ b/test-data/helloservice/helm/templates/service.yaml @@ -12,4 +12,3 @@ spec: port: 80 protocol: TCP targetPort: 9000 - type: LoadBalancer diff --git a/test-data/helloservice/setup.sh b/test-data/helloservice/setup.sh deleted file mode 100644 index afdc9fd..0000000 --- a/test-data/helloservice/setup.sh +++ /dev/null @@ -1,26 +0,0 @@ -### DEMO INSTRUCTIONS - -## ONBOARD SERVICE -keptn onboard service helloservice --chart=./helm/ --project=litmus - -## ADD JMETER TESTS & CONFIG -keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=jmeter/load.jmx --resourceUri=jmeter/load.jmx - -keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=jmeter/jmeter.conf.yaml --resourceUri=jmeter/jmeter.conf.yaml - -## ADD QUALITY GATE -keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=prometheus/sli.yaml --resourceUri=prometheus/sli.yaml - -keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=slo.yaml --resourceUri=slo.yaml - -## ADD LITMUS EXPERIMENT -keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=litmus/experiment.yaml --resourceUri=litmus/experiment.yaml - -## first deployment event -keptn send event new-artifact --project=litmus --service=helloservice --image=jetzlstorfer/hello-server:v0.1.1 - -## second deployment event (able to scale by editing the deploy-event.json) -keptn send event -f test-data/helloservice/deploy-event.json - -### TODO -# configure prometheus diff --git a/test-data/setup.sh b/test-data/setup.sh index 99cb271..9fac4c6 100644 --- a/test-data/setup.sh +++ b/test-data/setup.sh @@ -6,31 +6,40 @@ # 3. configure Istio + Keptn shttps://tutorials.keptn.sh/tutorials/keptn-full-tour-prometheus-07/index.html?index=..%2F..index#5 # 4. connect the Keptn CLI to the cluster https://tutorials.keptn.sh/tutorials/keptn-full-tour-prometheus-07/index.html?index=..%2F..index#6 +## CREATE PROJECT keptn create project litmus --shipyard=./shipyard.yaml -keptn onboard service carts-db --chart=./carts-db/ --project=litmus +## ONBOARD SERVICE +keptn onboard service helloservice --chart=./helloservice/helm/ --project=litmus -keptn onboard service carts --chart=./carts --project=litmus +## ADD JMETER TESTS & CONFIG +keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=helloservice/jmeter/load.jmx --resourceUri=jmeter/load.jmx -keptn send event new-artifact --project=litmus --service=carts-db --image=docker.io/mongo --tag=4.2.2 +keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=helloservice/jmeter/jmeter.conf.yaml --resourceUri=jmeter/jmeter.conf.yaml -keptn send event new-artifact --project=litmus --service=carts --image=docker.io/keptnexamples/carts --tag=0.11.1 +## ADD QUALITY GATE +keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=helloservice/prometheus/sli.yaml --resourceUri=prometheus/sli.yaml -keptn add-resource --project=litmus --stage=chaos --service=carts --resource=jmeter/load.jmx --resourceUri=jmeter/load.jmx +keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=helloservice/slo.yaml --resourceUri=slo.yaml -keptn add-resource --project=litmus --stage=chaos --service=carts --resource=jmeter/jmeter.conf.yaml --resourceUri=jmeter/jmeter.conf.yaml +## ADD LITMUS EXPERIMENT +keptn add-resource --project=litmus --stage=chaos --service=helloservice --resource=helloservice/litmus/experiment.yaml --resourceUri=litmus/experiment.yaml + +## ADD PROMETHEUS kubectl apply -f https://raw.githubusercontent.com/keptn-contrib/prometheus-service/release-0.3.5/deploy/service.yaml kubectl apply -f https://raw.githubusercontent.com/keptn-contrib/prometheus-sli-service/release-0.2.2/deploy/service.yaml -keptn add-resource --project=litmus --stage=chaos --service=carts --resource=prometheus/sli.yaml --resourceUri=prometheus/sli.yaml +keptn configure monitoring prometheus --project=litmus --service=helloservice + +kubectl apply -f helloservice/prometheus/blackbox-exporter.yaml -keptn add-resource --project=litmus --stage=chaos --service=carts --resource=slo.yaml --resourceUri=slo.yaml +kubectl apply -f helloservice/prometheus/prometheus-server-conf-cm.yaml -keptn configure monitoring prometheus --project=litmus --service=carts +kubectl delete pod -l app=prometheus-server -n monitoring -# Litmus PreReq Begins!! +### LITMUS Begins!! ## install litmus operator & chaos CRDs @@ -47,9 +56,11 @@ kubectl apply -f litmus/pod-delete-rbac.yaml # Litmus PreReq End!! ## now we also have to add the chaos tests - ATTENTION right now this file is empty! -keptn add-resource --project=litmus --stage=chaos --service=carts --resource=litmus/experiment.yaml --resourceUri=litmus/experiment.yaml +keptn add-resource --project=litmus --stage=chaos --service=carts --resource=helloservice/litmus/experiment.yaml --resourceUri=litmus/experiment.yaml -# now test with a a new-artifact event -keptn send event new-artifact --project=litmus --service=carts --image=docker.io/keptnexamples/carts --tag=0.11.3 +## first deployment event +keptn send event new-artifact --project=litmus --service=helloservice --image=jetzlstorfer/hello-server:v0.1.1 +## second deployment event (able to scale by editing the deploy-event.json) +keptn send event -f test-data/helloservice/deploy-event.json diff --git a/test-data/slo.yaml b/test-data/slo.yaml deleted file mode 100644 index 6d5c14c..0000000 --- a/test-data/slo.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -spec_version: "1.0" -comparison: - aggregate_function: "avg" - compare_with: "single_result" - include_result_with_score: "pass" - number_of_comparison_results: 1 -filter: -objectives: - - sli: "response_time_p95" - key_sli: false - pass: # pass if (relative change <= 10% AND absolute value is < 600ms) - - criteria: - - "<=+10%" # relative values require a prefixed sign (plus or minus) - - "<600" # absolute values only require a logical operator - warning: # if the response time is below 800ms, the result should be a warning - - criteria: - - "<=800" - weight: 1 -total_score: - pass: "90%" - warning: "75%" \ No newline at end of file