Skip to content
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

Workload for flagger addon pattern #16

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions teams/team-data/dev/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
name: team-flask
description: Demo team
version: 0.1.0
54 changes: 54 additions & 0 deletions teams/team-data/dev/templates/canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: flask
namespace: team-data
spec:
# service mesh provider can be: kubernetes, istio, appmesh, nginx, gloo
provider: nginx
# deployment reference
targetRef:
apiVersion: apps/v1
kind: Deployment
name: flask
# ingress reference
ingressRef:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: flask
# the maximum time in seconds for the canary deployment
# to make progress before rollback (default 600s)
progressDeadlineSeconds: 60
service:
port: 5000
portDiscovery: true
analysis:
# schedule interval (default 60s)
interval: 30s
# max number of failed checks before rollback
threshold: 2
# number of checks to run before rollback
iterations: 10
# Prometheus checks based on
# http_request_duration_seconds histogram
metrics:
- name: nginx_http_requests_total
thresholdRange:
min: 50
max: 500
interval: 1m
# acceptance/load testing hooks
webhooks:
- name: smoke-test
type: pre-rollout
url: http://flagger-loadtester.team-data/
timeout: 15s
metadata:
type: bash
cmd: "curl -v http://flask-canary.team-data:5000/"
- name: load-test
url: http://flagger-loadtester.team-data/
timeout: 5s
metadata:
type: cmd
cmd: "hey -c 10 -q 3 -z 1m -m GET http://af01d39d9c6fc48e3af813137371a563-990038456.us-east-2.elb.amazonaws.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whet this url is for ? don't seems you want to publish that on a public repo

13 changes: 13 additions & 0 deletions teams/team-data/dev/templates/deployment-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: flask-svc
namespace: team-data
spec:
selector:
app: flask
ports:
- name: web
port: 80
targetPort: 5000
type: LoadBalancer
27 changes: 27 additions & 0 deletions teams/team-data/dev/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: flask
name: flask
namespace: team-data
spec:
selector:
matchLabels:
app: flask
replicas: 1
template:
metadata:
labels:
app: flask
spec:
containers:
- name: flask
image: nikunjv/flask-image:green
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5000
resources:
limits:
memory: "700Mi"
cpu: "0.6"
21 changes: 21 additions & 0 deletions teams/team-data/dev/templates/flask-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: flask
namespace: team-data
labels:
app: flask
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: "http://af01d39d9c6fc48e3af813137371a563-990038456.us-east-2.elb.amazonaws.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark, here, should be var

http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: flask
port:
number: 80
16 changes: 16 additions & 0 deletions teams/team-data/dev/templates/load-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: flagger-loadtester
labels:
app: flagger-loadtester
namespace: team-data
spec:
type: ClusterIP
selector:
app: flagger-loadtester
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
62 changes: 62 additions & 0 deletions teams/team-data/dev/templates/load-tester.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: flagger-loadtester
labels:
app: flagger-loadtester
namespace: team-data
spec:
selector:
matchLabels:
app: flagger-loadtester
template:
metadata:
labels:
app: flagger-loadtester
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
openservicemesh.io/inbound-port-exclusion-list: "80, 8080"
spec:
containers:
- name: loadtester
image: ghcr.io/fluxcd/flagger-loadtester:0.23.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
command:
- ./loadtester
- -port=8080
- -log-level=info
- -timeout=1h
livenessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=4
- --spider
- http://localhost:8080/healthz
timeoutSeconds: 5
readinessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=4
- --spider
- http://localhost:8080/healthz
timeoutSeconds: 5
resources:
limits:
memory: "700Mi"
cpu: "2000m"
requests:
memory: "40Mi"
cpu: "100m"
securityContext:
readOnlyRootFilesystem: true
runAsUser: 10001
Empty file added teams/team-data/dev/values.yaml
Empty file.