-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from stefanprodan/ab-testing
A/B testing - canary with session affinity
- Loading branch information
Showing
21 changed files
with
924 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
apiVersion: flagger.app/v1alpha3 | ||
kind: Canary | ||
metadata: | ||
name: abtest | ||
namespace: test | ||
spec: | ||
# deployment reference | ||
targetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: abtest | ||
# the maximum time in seconds for the canary deployment | ||
# to make progress before it is rollback (default 600s) | ||
progressDeadlineSeconds: 60 | ||
# HPA reference (optional) | ||
autoscalerRef: | ||
apiVersion: autoscaling/v2beta1 | ||
kind: HorizontalPodAutoscaler | ||
name: abtest | ||
service: | ||
# container port | ||
port: 9898 | ||
# Istio gateways (optional) | ||
gateways: | ||
- public-gateway.istio-system.svc.cluster.local | ||
# Istio virtual service host names (optional) | ||
hosts: | ||
- abtest.istio.weavedx.com | ||
canaryAnalysis: | ||
# schedule interval (default 60s) | ||
interval: 10s | ||
# max number of failed metric checks before rollback | ||
threshold: 10 | ||
# total number of iterations | ||
iterations: 10 | ||
# canary match condition | ||
match: | ||
- headers: | ||
user-agent: | ||
regex: "^(?!.*Chrome)(?=.*\bSafari\b).*$" | ||
- headers: | ||
cookie: | ||
regex: "^(.*?;)?(user=test)(;.*)?$" | ||
metrics: | ||
- name: istio_requests_total | ||
# minimum req success rate (non 5xx responses) | ||
# percentage (0-100) | ||
threshold: 99 | ||
interval: 1m | ||
- name: istio_request_duration_seconds_bucket | ||
# maximum req duration P99 | ||
# milliseconds | ||
threshold: 500 | ||
interval: 30s | ||
# external checks (optional) | ||
webhooks: | ||
- name: load-test | ||
url: http://flagger-loadtester.test/ | ||
timeout: 5s | ||
metadata: | ||
cmd: "hey -z 1m -q 10 -c 2 http://podinfo.test:9898/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: abtest | ||
namespace: test | ||
labels: | ||
app: abtest | ||
spec: | ||
minReadySeconds: 5 | ||
revisionHistoryLimit: 5 | ||
progressDeadlineSeconds: 60 | ||
strategy: | ||
rollingUpdate: | ||
maxUnavailable: 0 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: abtest | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
labels: | ||
app: abtest | ||
spec: | ||
containers: | ||
- name: podinfod | ||
image: quay.io/stefanprodan/podinfo:1.4.0 | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 9898 | ||
name: http | ||
protocol: TCP | ||
command: | ||
- ./podinfo | ||
- --port=9898 | ||
- --level=info | ||
- --random-delay=false | ||
- --random-error=false | ||
env: | ||
- name: PODINFO_UI_COLOR | ||
value: blue | ||
livenessProbe: | ||
exec: | ||
command: | ||
- podcli | ||
- check | ||
- http | ||
- localhost:9898/healthz | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
exec: | ||
command: | ||
- podcli | ||
- check | ||
- http | ||
- localhost:9898/readyz | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
resources: | ||
limits: | ||
cpu: 2000m | ||
memory: 512Mi | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: autoscaling/v2beta1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: abtest | ||
namespace: test | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: abtest | ||
minReplicas: 2 | ||
maxReplicas: 4 | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
# scale up if usage is above | ||
# 99% of the requested CPU (100m) | ||
targetAverageUtilization: 99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.