From 1649dea468ddf2579841d0566891693fa6397bcf Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Fri, 25 Jan 2019 11:19:34 +0200 Subject: [PATCH] Add config maps and secrets manifests for testing --- artifacts/configs/canary.yaml | 58 ++++++++++++++++++++ artifacts/configs/configs.yaml | 16 ++++++ artifacts/configs/deployment.yaml | 89 +++++++++++++++++++++++++++++++ artifacts/configs/hpa.yaml | 19 +++++++ artifacts/configs/secrets.yaml | 16 ++++++ 5 files changed, 198 insertions(+) create mode 100644 artifacts/configs/canary.yaml create mode 100644 artifacts/configs/configs.yaml create mode 100644 artifacts/configs/deployment.yaml create mode 100644 artifacts/configs/hpa.yaml create mode 100644 artifacts/configs/secrets.yaml diff --git a/artifacts/configs/canary.yaml b/artifacts/configs/canary.yaml new file mode 100644 index 00000000..f4d88afb --- /dev/null +++ b/artifacts/configs/canary.yaml @@ -0,0 +1,58 @@ +apiVersion: flagger.app/v1alpha3 +kind: Canary +metadata: + name: podinfo + namespace: test +spec: + # deployment reference + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: podinfo + # 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: podinfo + service: + # container port + port: 9898 + # Istio gateways (optional) + gateways: + - public-gateway.istio-system.svc.cluster.local + # Istio virtual service host names (optional) + hosts: + - app.iowa.weavedx.com + canaryAnalysis: + # schedule interval (default 60s) + interval: 10s + # max number of failed metric checks before rollback + threshold: 10 + # max traffic percentage routed to canary + # percentage (0-100) + maxWeight: 50 + # canary increment step + # percentage (0-100) + stepWeight: 5 + # Istio Prometheus checks + 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/" diff --git a/artifacts/configs/configs.yaml b/artifacts/configs/configs.yaml new file mode 100644 index 00000000..8e3cfe50 --- /dev/null +++ b/artifacts/configs/configs.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: podinfo-config-env + namespace: test +data: + color: blue +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: podinfo-config-vol + namespace: test +data: + output: console + textmode: "true" diff --git a/artifacts/configs/deployment.yaml b/artifacts/configs/deployment.yaml new file mode 100644 index 00000000..1d2fbe45 --- /dev/null +++ b/artifacts/configs/deployment.yaml @@ -0,0 +1,89 @@ +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.3.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 + valueFrom: + configMapKeyRef: + name: podinfo-config-env + key: color + - name: SECRET_USER + valueFrom: + secretKeyRef: + name: podinfo-secret-env + key: user + 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 + volumeMounts: + - name: configs + mountPath: /etc/podinfo/configs + readOnly: true + - name: secrets + mountPath: /etc/podinfo/secrets + readOnly: true + volumes: + - name: configs + configMap: + name: podinfo-config-vol + - name: secrets + secret: + secretName: podinfo-secret-vol diff --git a/artifacts/configs/hpa.yaml b/artifacts/configs/hpa.yaml new file mode 100644 index 00000000..48ec76e8 --- /dev/null +++ b/artifacts/configs/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/configs/secrets.yaml b/artifacts/configs/secrets.yaml new file mode 100644 index 00000000..73485871 --- /dev/null +++ b/artifacts/configs/secrets.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Secret +metadata: + name: podinfo-secret-env + namespace: test +data: + password: cGFzc3dvcmQ= + user: YWRtaW4= +--- +apiVersion: v1 +kind: Secret +metadata: + name: podinfo-secret-vol + namespace: test +data: + key: cGFzc3dvcmQ=