Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seizadi/877fefbca5a58cfb2ab625436374c845 to your computer and use it in GitHub Desktop.
Save seizadi/877fefbca5a58cfb2ab625436374c845 to your computer and use it in GitHub Desktop.
❯ kustomize build workloads
apiVersion: v1
kind: Namespace
metadata:
annotations:
fluxcd.io/ignore: "false"
linkerd.io/inject: enabled
name: test
---
apiVersion: v1
kind: Service
metadata:
labels:
app: flagger-loadtester
name: flagger-loadtester
namespace: test
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
selector:
app: flagger-loadtester
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flagger-loadtester
name: flagger-loadtester
namespace: test
spec:
selector:
matchLabels:
app: flagger-loadtester
template:
metadata:
annotations:
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
labels:
app: flagger-loadtester
spec:
containers:
- command:
- ./loadtester
- -port=8080
- -log-level=info
- -timeout=1h
image: weaveworks/flagger-loadtester:0.17.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=4
- --spider
- http://localhost:8080/healthz
timeoutSeconds: 5
name: loadtester
ports:
- containerPort: 8080
name: http
readinessProbe:
exec:
command:
- wget
- --quiet
- --tries=1
- --timeout=4
- --spider
- http://localhost:8080/healthz
timeoutSeconds: 5
resources:
limits:
cpu: 1000m
memory: 512Mi
requests:
cpu: 10m
memory: 32Mi
securityContext:
readOnlyRootFilesystem: true
runAsUser: 10001
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: podinfo
name: podinfo
namespace: test
spec:
minReadySeconds: 5
progressDeadlineSeconds: 60
revisionHistoryLimit: 5
selector:
matchLabels:
app: podinfo
strategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
annotations:
config.linkerd.io/proxy-cpu-limit: "1.5"
config.linkerd.io/proxy-cpu-request: "0.2"
config.linkerd.io/proxy-memory-limit: 2Gi
config.linkerd.io/proxy-memory-request: 128Mi
prometheus.io/port: "9797"
prometheus.io/scrape: "true"
labels:
app: podinfo
spec:
containers:
- command:
- ./podinfo
- --port=9898
- --port-metrics=9797
- --grpc-port=9999
- --grpc-service-name=podinfo
- --level=info
- --random-delay=false
- --random-error=false
env:
- name: PODINFO_UI_LOGO
value: https://eks.handson.flagger.dev/cuddle_bunny.gif
- name: PODINFO_UI_COLOR
value: '#34577c'
image: stefanprodan/podinfo:3.1.1
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/healthz
initialDelaySeconds: 5
timeoutSeconds: 5
name: podinfod
ports:
- containerPort: 9898
name: http
protocol: TCP
- containerPort: 9797
name: http-metrics
protocol: TCP
- containerPort: 9999
name: grpc
protocol: TCP
readinessProbe:
exec:
command:
- podcli
- check
- http
- localhost:9898/readyz
initialDelaySeconds: 5
timeoutSeconds: 5
resources:
limits:
cpu: 2000m
memory: 512Mi
requests:
cpu: 100m
memory: 64Mi
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: podinfo
namespace: test
spec:
maxReplicas: 4
metrics:
- resource:
name: cpu
targetAverageUtilization: 99
type: Resource
minReplicas: 2
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: podinfo
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header l5d-dst-override $service_name.$namespace.svc.cluster.local:$service_port;
grpc_set_header l5d-dst-override $service_name.$namespace.svc.cluster.local:$service_port;
nginx.ingress.kubernetes.io/ssl-redirect: "false"
labels:
app: podinfo
name: podinfo
namespace: test
spec:
rules:
- host: minikube
http:
paths:
- backend:
serviceName: podinfo
servicePort: 9898
path: /
---
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: podinfo
namespace: test
spec:
analysis:
interval: 30s
maxWeight: 50
metrics:
- interval: 1m
name: request-success-rate
thresholdRange:
min: 99
- interval: 30s
name: request-duration
thresholdRange:
max: 500
stepWeight: 5
threshold: 5
webhooks:
- metadata:
cmd: curl -sd 'test' http://podinfo-canary.test:9898/token | grep token
type: bash
name: acceptance-test
timeout: 30s
type: pre-rollout
url: http://flagger-loadtester.test/
- metadata:
cmd: hey -z 2m -q 10 -c 2 http://podinfo-canary.test:9898/
name: load-test
type: rollout
url: http://flagger-loadtester.test/
autoscalerRef:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
name: podinfo
progressDeadlineSeconds: 60
service:
port: 9898
targetPort: 9898
targetRef:
apiVersion: apps/v1
kind: Deployment
name: podinfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment