From 691c3c4f36d8cf2692757b5cbd66a921d6e6b46d Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Wed, 7 Aug 2019 10:22:07 +0300 Subject: [PATCH 1/2] Add missing fields to CRD validation spec --- artifacts/flagger/crd.yaml | 61 +++++++++++++++++++++++++++++++ charts/flagger/templates/crd.yaml | 61 +++++++++++++++++++++++++++++++ kustomize/base/flagger/crd.yaml | 61 +++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 548ef6d20..842076d1a 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -46,10 +46,13 @@ spec: - canaryAnalysis properties: provider: + description: Traffic managent provider type: string progressDeadlineSeconds: + description: Deployment progress deadline type: number targetRef: + description: Deployment selector type: object required: ['apiVersion', 'kind', 'name'] properties: @@ -60,6 +63,7 @@ spec: name: type: string autoscalerRef: + description: HPA selector anyOf: - type: string - type: object @@ -72,6 +76,7 @@ spec: name: type: string ingressRef: + description: NGINX ingress selector anyOf: - type: string - type: object @@ -88,15 +93,60 @@ spec: required: ['port'] properties: port: + description: Container port number type: number portName: + description: Container port name type: string portDiscovery: + description: Enable port dicovery type: boolean meshName: + description: AppMesh mesh name type: string + backends: + description: AppMesh backend array + anyOf: + - type: string + - type: object timeout: + description: Istio HTTP or gRPC request timeout type: string + trafficPolicy: + description: Istio traffic policy + anyOf: + - type: string + - type: object + match: + description: Istio URL match conditions + anyOf: + - type: string + - type: array + rewrite: + description: Istio URL rewrite + anyOf: + - type: string + - type: object + headers: + description: Istio headers operations + anyOf: + - type: string + - type: object + corsPolicy: + description: Istio CORS policy + anyOf: + - type: string + - type: object + gateways: + description: Istio gateways list + anyOf: + - type: string + - type: array + hosts: + description: Istio hosts list + anyOf: + - type: string + - type: array skipAnalysis: type: boolean canaryAnalysis: @@ -117,6 +167,11 @@ spec: stepWeight: description: Canary incremental traffic percentage step type: number + match: + description: A/B testing match conditions + anyOf: + - type: string + - type: array metrics: description: Prometheus query list for this canary type: array @@ -154,6 +209,7 @@ spec: type: string enum: - "" + - confirm-rollout - pre-rollout - rollout - post-rollout @@ -165,6 +221,11 @@ spec: description: Request timeout for this webhook type: string pattern: "^[0-9]+(m|s)" + metadata: + description: Metadata (key-value pairs) for this webhook + anyOf: + - type: string + - type: object status: properties: phase: diff --git a/charts/flagger/templates/crd.yaml b/charts/flagger/templates/crd.yaml index a60bf529e..76d56ae8d 100644 --- a/charts/flagger/templates/crd.yaml +++ b/charts/flagger/templates/crd.yaml @@ -47,10 +47,13 @@ spec: - canaryAnalysis properties: provider: + description: Traffic managent provider type: string progressDeadlineSeconds: + description: Deployment progress deadline type: number targetRef: + description: Deployment selector type: object required: ['apiVersion', 'kind', 'name'] properties: @@ -61,6 +64,7 @@ spec: name: type: string autoscalerRef: + description: HPA selector anyOf: - type: string - type: object @@ -73,6 +77,7 @@ spec: name: type: string ingressRef: + description: NGINX ingress selector anyOf: - type: string - type: object @@ -89,15 +94,60 @@ spec: required: ['port'] properties: port: + description: Container port number type: number portName: + description: Container port name type: string portDiscovery: + description: Enable port dicovery type: boolean meshName: + description: AppMesh mesh name type: string + backends: + description: AppMesh backend array + anyOf: + - type: string + - type: object timeout: + description: Istio HTTP or gRPC request timeout type: string + trafficPolicy: + description: Istio traffic policy + anyOf: + - type: string + - type: object + match: + description: Istio URL match conditions + anyOf: + - type: string + - type: array + rewrite: + description: Istio URL rewrite + anyOf: + - type: string + - type: object + headers: + description: Istio headers operations + anyOf: + - type: string + - type: object + corsPolicy: + description: Istio CORS policy + anyOf: + - type: string + - type: object + gateways: + description: Istio gateways list + anyOf: + - type: string + - type: array + hosts: + description: Istio hosts list + anyOf: + - type: string + - type: array skipAnalysis: type: boolean canaryAnalysis: @@ -118,6 +168,11 @@ spec: stepWeight: description: Canary incremental traffic percentage step type: number + match: + description: A/B testing match conditions + anyOf: + - type: string + - type: array metrics: description: Prometheus query list for this canary type: array @@ -155,6 +210,7 @@ spec: type: string enum: - "" + - confirm-rollout - pre-rollout - rollout - post-rollout @@ -166,6 +222,11 @@ spec: description: Request timeout for this webhook type: string pattern: "^[0-9]+(m|s)" + metadata: + description: Metadata (key-value pairs) for this webhook + anyOf: + - type: string + - type: object status: properties: phase: diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 548ef6d20..842076d1a 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -46,10 +46,13 @@ spec: - canaryAnalysis properties: provider: + description: Traffic managent provider type: string progressDeadlineSeconds: + description: Deployment progress deadline type: number targetRef: + description: Deployment selector type: object required: ['apiVersion', 'kind', 'name'] properties: @@ -60,6 +63,7 @@ spec: name: type: string autoscalerRef: + description: HPA selector anyOf: - type: string - type: object @@ -72,6 +76,7 @@ spec: name: type: string ingressRef: + description: NGINX ingress selector anyOf: - type: string - type: object @@ -88,15 +93,60 @@ spec: required: ['port'] properties: port: + description: Container port number type: number portName: + description: Container port name type: string portDiscovery: + description: Enable port dicovery type: boolean meshName: + description: AppMesh mesh name type: string + backends: + description: AppMesh backend array + anyOf: + - type: string + - type: object timeout: + description: Istio HTTP or gRPC request timeout type: string + trafficPolicy: + description: Istio traffic policy + anyOf: + - type: string + - type: object + match: + description: Istio URL match conditions + anyOf: + - type: string + - type: array + rewrite: + description: Istio URL rewrite + anyOf: + - type: string + - type: object + headers: + description: Istio headers operations + anyOf: + - type: string + - type: object + corsPolicy: + description: Istio CORS policy + anyOf: + - type: string + - type: object + gateways: + description: Istio gateways list + anyOf: + - type: string + - type: array + hosts: + description: Istio hosts list + anyOf: + - type: string + - type: array skipAnalysis: type: boolean canaryAnalysis: @@ -117,6 +167,11 @@ spec: stepWeight: description: Canary incremental traffic percentage step type: number + match: + description: A/B testing match conditions + anyOf: + - type: string + - type: array metrics: description: Prometheus query list for this canary type: array @@ -154,6 +209,7 @@ spec: type: string enum: - "" + - confirm-rollout - pre-rollout - rollout - post-rollout @@ -165,6 +221,11 @@ spec: description: Request timeout for this webhook type: string pattern: "^[0-9]+(m|s)" + metadata: + description: Metadata (key-value pairs) for this webhook + anyOf: + - type: string + - type: object status: properties: phase: From a39652724dbc3c5313bcd5641ee1b6e35342e12b Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Wed, 7 Aug 2019 10:55:15 +0300 Subject: [PATCH 2/2] Add confirm and pre rollout hooks to e2e tests --- test/e2e-gloo-tests.sh | 15 ++++++++++++++- test/e2e-kubernetes-tests.sh | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/test/e2e-gloo-tests.sh b/test/e2e-gloo-tests.sh index 891d9c53a..45c5718e6 100755 --- a/test/e2e-gloo-tests.sh +++ b/test/e2e-gloo-tests.sh @@ -45,6 +45,7 @@ metadata: name: podinfo namespace: test spec: + provider: gloo targetRef: apiVersion: apps/v1 kind: Deployment @@ -62,12 +63,22 @@ spec: threshold: 99 interval: 1m webhooks: + - name: "gate" + type: confirm-rollout + url: http://flagger-loadtester.test/gate/approve + - name: acceptance-test + type: pre-rollout + url: http://flagger-loadtester.test/ + timeout: 10s + metadata: + type: bash + cmd: "curl -sd 'test' http://podinfo-canary:9898/token | grep token" - name: load-test url: http://flagger-loadtester.test/ timeout: 5s metadata: type: cmd - cmd: "hey -z 10m -q 10 -c 2 -host app.example.com http://gateway-proxy.gloo-system" + cmd: "hey -z 2m -q 5 -c 2 -host app.example.com http://gateway-proxy-v2.gloo-system" logCmdOutput: "true" EOF @@ -103,7 +114,9 @@ until ${ok}; do if [[ ${count} -eq ${retries} ]]; then kubectl -n test describe deployment/podinfo kubectl -n test describe deployment/podinfo-primary + kubectl -n test logs deployment/flagger-loadtester kubectl -n gloo-system logs deployment/flagger + kubectl -n gloo-system get all kubectl -n gloo-system get virtualservice podinfo -oyaml echo "No more retries left" exit 1 diff --git a/test/e2e-kubernetes-tests.sh b/test/e2e-kubernetes-tests.sh index d8669f5c3..1af7f2af6 100755 --- a/test/e2e-kubernetes-tests.sh +++ b/test/e2e-kubernetes-tests.sh @@ -46,6 +46,16 @@ spec: threshold: 500 interval: 30s webhooks: + - name: "gate" + type: confirm-rollout + url: http://flagger-loadtester.test/gate/approve + - name: acceptance-test + type: pre-rollout + url: http://flagger-loadtester.test/ + timeout: 10s + metadata: + type: bash + cmd: "curl -sd 'test' http://podinfo-canary:9898/token | grep token" - name: load-test url: http://flagger-loadtester.test/ timeout: 5s