-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A/B testing - canary with session affinity #88
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
62b906d
Add canary HTTP match conditions and iterations
stefanprodan bf1ca29
Implement fix routing for canary analysis
stefanprodan 49c942b
Add A/B testing examples
stefanprodan 3c7a561
Add Istio routes A/B testing unit tests
stefanprodan 6ba69dc
Add iterations field to CRD validation
stefanprodan 780ba82
Log namespace restriction if one exists
stefanprodan e80a3d3
Add A/B testing scheduling unit tests
stefanprodan d8b847a
Mention session affinity in docs
stefanprodan d87bbbb
Add A/B testing tutorial
stefanprodan 86ea172
Fix weight metric report
stefanprodan 12ac96d
Document how to enable A/B testing
stefanprodan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have to include match field in the crd as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have validation for any of the Istio types (
HTTPMatchRequest
,HTTPRewrite
,HTTPRetry
,Headers
andCorsPolicy
) used in the Canary CRD. This could be addressed in a separate PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good