Skip to content

Commit 01b99b3

Browse files
authored
Helm deploy (#834)
* deploy Signed-off-by: Srinivasan Parthasarathy <[email protected]> * helm chart with k8s deployment and experiment Signed-off-by: Srinivasan Parthasarathy <[email protected]> * helm deploy an experiment Signed-off-by: Srinivasan Parthasarathy <[email protected]> * common/readiness test Signed-off-by: Srinivasan Parthasarathy <[email protected]> * helm deploy experiment Signed-off-by: Srinivasan Parthasarathy <[email protected]>
1 parent 8158b95 commit 01b99b3

File tree

10 files changed

+232
-6
lines changed

10 files changed

+232
-6
lines changed

.github/workflows/e2e-tests.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ jobs:
362362
do
363363
# Apply metrics
364364
kubectl apply -f $ITER8/samples/e2e-tests/race-condition/metrics.yaml
365-
366-
# Give a chance for metrics to be created
367-
sleep 10.0
368365
369366
# Apply experiment
370367
kubectl apply -f $ITER8/samples/e2e-tests/race-condition/experiment.yaml

helm/deploy/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm/deploy/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: deploy
3+
description: A Helm chart for Kubernetes deployment with SLO validation
4+
type: application
5+
version: 0.1.0
6+
appVersion: 0.1.0
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Values.stable.name }}
5+
labels:
6+
{{- toYaml .Values.common.regularLabels | nindent 4 }}
7+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
8+
{{- toYaml .Values.stable.selectorLabels | nindent 4 }}
9+
spec:
10+
selector:
11+
matchLabels:
12+
{{- toYaml .Values.common.selectorLabels | nindent 6 }}
13+
{{- toYaml .Values.stable.selectorLabels | nindent 6 }}
14+
template:
15+
metadata:
16+
labels:
17+
{{- toYaml .Values.common.selectorLabels | nindent 8 }}
18+
{{- toYaml .Values.stable.selectorLabels | nindent 8 }}
19+
spec:
20+
containers:
21+
- name: {{ .Values.common.application }}
22+
imagePullPolicy: IfNotPresent
23+
image: nginx:{{ required "A valid .Values.stable.imageTag entry required!" .Values.stable.imageTag }}
24+
ports:
25+
- name: http
26+
containerPort: 80
27+
protocol: TCP
28+
---
29+
{{- if .Values.candidate }}
30+
apiVersion: apps/v1
31+
kind: Deployment
32+
metadata:
33+
name: {{ .Values.candidate.name }}
34+
labels:
35+
{{- toYaml .Values.common.regularLabels | nindent 4 }}
36+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
37+
{{- toYaml .Values.candidate.selectorLabels | nindent 4 }}
38+
spec:
39+
selector:
40+
matchLabels:
41+
{{- toYaml .Values.common.selectorLabels | nindent 6 }}
42+
{{- toYaml .Values.candidate.selectorLabels | nindent 6 }}
43+
template:
44+
metadata:
45+
labels:
46+
{{- toYaml .Values.common.selectorLabels | nindent 8 }}
47+
{{- toYaml .Values.candidate.selectorLabels | nindent 8 }}
48+
spec:
49+
containers:
50+
- name: {{ .Values.common.application }}
51+
imagePullPolicy: IfNotPresent
52+
image: nginx:{{ required "A valid .Values.candidate.imageTag entry required!" .Values.candidate.imageTag }}
53+
ports:
54+
- name: http
55+
containerPort: 80
56+
protocol: TCP
57+
{{- end }}

helm/deploy/templates/experiment.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.candidate }}
2+
apiVersion: iter8.tools/v2alpha2
3+
kind: Experiment
4+
metadata:
5+
# this create an experiment of with name hello-experiment-<random 5 char suffix>
6+
# the random 5 char suffix is useful to ensure a new experiment is generated
7+
# every time the candidate version of the app is updated (for example by a build pipeline)
8+
name: {{ .Values.common.application }}-experiment-{{ .Values.candidate | toString | sha256sum | trunc 5 }}
9+
spec:
10+
# target identifies the knative service under experimentation using its fully qualified name
11+
target: {{ .Values.common.application }}
12+
strategy:
13+
# this experiment will perform a canary test
14+
testingPattern: Conformance
15+
actions:
16+
start:
17+
# ensure all services and deployments are available
18+
- task: common/readiness
19+
with:
20+
objRefs:
21+
- kind: Service
22+
name: {{ .Values.stable.name }}
23+
namespace: {{ .Release.Namespace}}
24+
- kind: Service
25+
name: {{ .Values.candidate.name }}
26+
namespace: {{ .Release.Namespace}}
27+
- kind: Deployment
28+
name: {{ .Values.stable.name }}
29+
namespace: {{ .Release.Namespace}}
30+
waitFor: condition=available
31+
- kind: Deployment
32+
name: {{ .Values.candidate.name }}
33+
namespace: {{ .Release.Namespace}}
34+
waitFor: condition=available
35+
# collect metrics for candidate version
36+
- task: metrics/collect
37+
with:
38+
# safe nesting of experiment values
39+
time: {{ ( .Values.experiment | default dict ).Time | default "5s" }}
40+
versions:
41+
- name: baseline
42+
url: {{ .Values.candidate.name }}.{{ .Release.Namespace}}
43+
qps: {{ ( .Values.experiment | default dict ).QPS | default 8.0 }}
44+
criteria:
45+
requestCount: iter8-system/request-count
46+
indicators:
47+
- iter8-system/error-count
48+
objectives:
49+
- metric: iter8-system/mean-latency
50+
upperLimit: {{ ( .Values.experiment | default dict ).LimitMeanLatency | default 50.0 | quote }}
51+
- metric: iter8-system/error-rate
52+
upperLimit: {{ ( .Values.experiment | default dict ).LimitErrorRate | default 0.0 | quote }}
53+
- metric: iter8-system/latency-95th-percentile
54+
upperLimit: {{ ( .Values.experiment | default dict ).Limit95thPercentileLatency | default 100.0 | quote }}
55+
duration:
56+
intervalSeconds: 1
57+
iterationsPerLoop: 1
58+
versionInfo:
59+
baseline:
60+
name: baseline
61+
{{- end }}

helm/deploy/templates/services.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ .Values.stable.name }}
5+
labels:
6+
{{- toYaml .Values.common.regularLabels | nindent 4 }}
7+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
8+
{{- toYaml .Values.stable.selectorLabels | nindent 4 }}
9+
spec:
10+
type: ClusterIP
11+
ports:
12+
- {{- toYaml .Values.common.servicePortInfo | nindent 4}}
13+
selector:
14+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
15+
{{- toYaml .Values.stable.selectorLabels | nindent 4 }}
16+
---
17+
{{- if .Values.candidate }}
18+
apiVersion: v1
19+
kind: Service
20+
metadata:
21+
name: {{ .Values.candidate.name }}
22+
labels:
23+
{{- toYaml .Values.common.regularLabels | nindent 4 }}
24+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
25+
{{- toYaml .Values.candidate.selectorLabels | nindent 4 }}
26+
spec:
27+
type: ClusterIP
28+
ports:
29+
- {{- toYaml .Values.common.servicePortInfo | nindent 4}}
30+
selector:
31+
{{- toYaml .Values.common.selectorLabels | nindent 4 }}
32+
{{- toYaml .Values.candidate.selectorLabels | nindent 4 }}
33+
{{- end }}

helm/deploy/values.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# values meant for both stable and candidate versions of the application;
2+
common:
3+
application: hello
4+
serviceType: ClusterIP
5+
servicePortInfo:
6+
port: 80
7+
targetPort: http
8+
protocol: TCP
9+
name: http
10+
regularLabels:
11+
app.kubernetes.io/managed-by: Iter8
12+
selectorLabels:
13+
app.kubernetes.io/name: hello
14+
15+
# values meant for stable version of the application only;
16+
stable:
17+
name: hello
18+
selectorLabels:
19+
app.kubernetes.io/versionType: stable
20+
imageTag: ""
21+
22+
# values meant for candidate version of the application only;
23+
candidate:
24+
name: hello-candidate
25+
selectorLabels:
26+
app.kubernetes.io/versionType: candidate
27+
imageTag: ""
28+
29+
# values for the SLO validation experiment;
30+
# experiment.yaml template has these default values set;
31+
# to change the defaults, either modify experiment.yaml, or
32+
# uncomment the following lines and modify the values below
33+
34+
# experiment:
35+
# # The SLO validation experiment will collect Iter8's built-in latency and error metrics.
36+
# # There will be 8.0 * 5 = 40 queries sent during metrics collection.
37+
# # Time is the duration over which queries are sent during metrics collection.
38+
# Time: 5s
39+
# # QPS is number of queries per second sent during metrics collection.
40+
# QPS: 8.0
41+
# # (msec) acceptable limit for mean latency of the application
42+
# LimitMeanLatency: 500.0
43+
# # (msec) acceptable error rate for the application (1%)
44+
# LimitErrorRate: 0.01
45+
# # (msec) acceptable limit for 95th percentile latency of the application
46+
# Limit95thPercentileLatency: 1000.0

install/docker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ docker build -t ind:latest .
2121

2222
> If you want to run using the local image, replace iter8/ind:latest with ind:latest below.
2323
24-
> If you want to run a specific version, replace iter8/ind:latest with iter8/ind:<tag> below. For example, `iter8/ind:0.6.5`.
24+
> If you want to run a specific version, replace iter8/ind:latest with iter8/ind:<tag> below. For example, `iter8/ind:0.7.6`.
2525
2626
1. Start Iter8 container
2727
```shell
2828
docker run --name ind --privileged -d iter8/ind:latest
2929
```
30-
To pin the version of Iter8, replace `latest` above with tag (for example, with `0.6.5`)
30+
To pin the version of Iter8, replace `latest` above with tag (for example, with `0.7.6`)
3131

3232
2. Setup Iter8 within container
3333
```shell

mkdocs/docs/getting-started/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ hide:
1313
Install Iter8 in your Kubernetes cluster as follows.
1414

1515
```shell
16-
export TAG=v0.6.5
16+
export TAG=v0.7.6
1717
kustomize build https://github.com/iter8-tools/iter8/install/core/?ref=${TAG} | kubectl apply -f -
1818
kubectl wait crd -l creator=iter8 --for condition=established --timeout=120s
1919
kustomize build https://github.com/iter8-tools/iter8/install/builtin-metrics/?ref=${TAG} | kubectl apply -f -

samples/e2e-tests/race-condition/experiment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ spec:
66
target: default/sample-app
77
strategy:
88
testingPattern: Conformance
9+
actions:
10+
start:
11+
- task: common/readiness
912
criteria:
1013
requestCount: default/request-count
1114
duration:

0 commit comments

Comments
 (0)