From da43a152ba4766e484056ffa2fa68f5b8dc72336 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Fri, 17 May 2019 13:15:53 +0300 Subject: [PATCH] Add Gloo canary deployment example --- artifacts/gloo/canary.yaml | 36 ++++++++++++++++ artifacts/gloo/deployment.yaml | 67 +++++++++++++++++++++++++++++ artifacts/gloo/hpa.yaml | 19 ++++++++ artifacts/gloo/virtual-service.yaml | 17 ++++++++ 4 files changed, 139 insertions(+) create mode 100644 artifacts/gloo/canary.yaml create mode 100644 artifacts/gloo/deployment.yaml create mode 100644 artifacts/gloo/hpa.yaml create mode 100644 artifacts/gloo/virtual-service.yaml diff --git a/artifacts/gloo/canary.yaml b/artifacts/gloo/canary.yaml new file mode 100644 index 00000000..7c0218ac --- /dev/null +++ b/artifacts/gloo/canary.yaml @@ -0,0 +1,36 @@ +apiVersion: flagger.app/v1alpha3 +kind: Canary +metadata: + name: podinfo + namespace: test +spec: + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: podinfo + progressDeadlineSeconds: 60 + autoscalerRef: + apiVersion: autoscaling/v2beta1 + kind: HorizontalPodAutoscaler + name: podinfo + service: + port: 9898 + canaryAnalysis: + interval: 10s + threshold: 10 + maxWeight: 50 + stepWeight: 5 + metrics: + - name: request-success-rate + threshold: 99 + interval: 1m + - name: request-duration + threshold: 500 + interval: 30s + webhooks: + - name: load-test + url: http://flagger-loadtester.test/ + timeout: 5s + metadata: + type: cmd + cmd: "hey -z 1m -q 10 -c 2 http://gloo.exmaple.com/" diff --git a/artifacts/gloo/deployment.yaml b/artifacts/gloo/deployment.yaml new file mode 100644 index 00000000..57ed8a41 --- /dev/null +++ b/artifacts/gloo/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podinfo + namespace: test + labels: + app: podinfo +spec: + minReadySeconds: 5 + revisionHistoryLimit: 5 + progressDeadlineSeconds: 60 + strategy: + rollingUpdate: + maxUnavailable: 0 + type: RollingUpdate + selector: + matchLabels: + app: podinfo + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: podinfo + 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 diff --git a/artifacts/gloo/hpa.yaml b/artifacts/gloo/hpa.yaml new file mode 100644 index 00000000..48ec76e8 --- /dev/null +++ b/artifacts/gloo/hpa.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: podinfo + namespace: test +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: podinfo + minReplicas: 1 + maxReplicas: 4 + metrics: + - type: Resource + resource: + name: cpu + # scale up if usage is above + # 99% of the requested CPU (100m) + targetAverageUtilization: 99 diff --git a/artifacts/gloo/virtual-service.yaml b/artifacts/gloo/virtual-service.yaml new file mode 100644 index 00000000..53d010dd --- /dev/null +++ b/artifacts/gloo/virtual-service.yaml @@ -0,0 +1,17 @@ +apiVersion: gateway.solo.io/v1 +kind: VirtualService +metadata: + name: podinfo + namespace: test +spec: + virtualHost: + domains: + - '*' + name: podinfo.default + routes: + - matcher: + prefix: / + routeAction: + upstreamGroup: + name: podinfo + namespace: gloo