From 438cdb0e35ab3f31e2557809ba60f8a62f30c8cd Mon Sep 17 00:00:00 2001 From: Gerald Nunn Date: Thu, 19 Oct 2023 10:28:40 -0700 Subject: [PATCH] Add separate bluegreen-analysis folder so we can include files in workshop --- .../base}/analysistemplate.yaml | 0 .../base/kustomization.yaml | 8 +++++ .../bluegreen-analysis/base/rollout.yaml | 34 +++++++++++++++++++ .../bluegreen-analysis/base/routes.yaml | 27 +++++++++++++++ .../bluegreen-analysis/base/services.yaml | 29 ++++++++++++++++ .../analysistemplate/kustomization.yaml | 24 ------------- 6 files changed, 98 insertions(+), 24 deletions(-) rename documentation/modules/ROOT/examples/{bluegreen/overlays/analysistemplate => bluegreen-analysis/base}/analysistemplate.yaml (100%) create mode 100644 documentation/modules/ROOT/examples/bluegreen-analysis/base/kustomization.yaml create mode 100644 documentation/modules/ROOT/examples/bluegreen-analysis/base/rollout.yaml create mode 100644 documentation/modules/ROOT/examples/bluegreen-analysis/base/routes.yaml create mode 100644 documentation/modules/ROOT/examples/bluegreen-analysis/base/services.yaml delete mode 100644 documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/kustomization.yaml diff --git a/documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/analysistemplate.yaml b/documentation/modules/ROOT/examples/bluegreen-analysis/base/analysistemplate.yaml similarity index 100% rename from documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/analysistemplate.yaml rename to documentation/modules/ROOT/examples/bluegreen-analysis/base/analysistemplate.yaml diff --git a/documentation/modules/ROOT/examples/bluegreen-analysis/base/kustomization.yaml b/documentation/modules/ROOT/examples/bluegreen-analysis/base/kustomization.yaml new file mode 100644 index 0000000..fb026c2 --- /dev/null +++ b/documentation/modules/ROOT/examples/bluegreen-analysis/base/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- analysistemplate.yaml +- rollout.yaml +- services.yaml +- routes.yaml diff --git a/documentation/modules/ROOT/examples/bluegreen-analysis/base/rollout.yaml b/documentation/modules/ROOT/examples/bluegreen-analysis/base/rollout.yaml new file mode 100644 index 0000000..b3fce61 --- /dev/null +++ b/documentation/modules/ROOT/examples/bluegreen-analysis/base/rollout.yaml @@ -0,0 +1,34 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + name: rollouts-demo +spec: + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: rollouts-demo + strategy: + blueGreen: + activeService: active + previewService: preview + autoPromotionEnabled: false + prePromotionAnalysis: + args: + - name: query + value: irate%28haproxy_backend_http_responses_total%7Bexported_namespace%3D%27rollouts-demo-prod%27%2C%20route%3D~%22bluegreen-preview%22%2C%20code%3D%225xx%22%7D%5B1m%5D%29%20%3E%205%20or%20on%28%29%20vector%280%29 + - name: route-url + value: bluegreen-preview-rollouts-demo-prod.${SUB_DOMAIN} + templates: + - templateName: smoke-tests + template: + metadata: + labels: + app: rollouts-demo + spec: + containers: + - image: quay.io/openshiftdemos/rollouts-demo:blue + imagePullPolicy: IfNotPresent + name: rollouts-demo + ports: + - containerPort: 8080 diff --git a/documentation/modules/ROOT/examples/bluegreen-analysis/base/routes.yaml b/documentation/modules/ROOT/examples/bluegreen-analysis/base/routes.yaml new file mode 100644 index 0000000..e70f205 --- /dev/null +++ b/documentation/modules/ROOT/examples/bluegreen-analysis/base/routes.yaml @@ -0,0 +1,27 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: active +spec: + port: + targetPort: http + tls: + insecureEdgeTerminationPolicy: Redirect + termination: edge + to: + kind: Service + name: active +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: preview +spec: + port: + targetPort: http + tls: + insecureEdgeTerminationPolicy: Redirect + termination: edge + to: + kind: Service + name: preview diff --git a/documentation/modules/ROOT/examples/bluegreen-analysis/base/services.yaml b/documentation/modules/ROOT/examples/bluegreen-analysis/base/services.yaml new file mode 100644 index 0000000..3bb4a16 --- /dev/null +++ b/documentation/modules/ROOT/examples/bluegreen-analysis/base/services.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: rollouts-demo + name: active +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + name: http + selector: + app: rollouts-demo +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: rollouts-demo + name: preview +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + name: http + selector: + app: rollouts-demo diff --git a/documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/kustomization.yaml b/documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/kustomization.yaml deleted file mode 100644 index 20302c9..0000000 --- a/documentation/modules/ROOT/examples/bluegreen/overlays/analysistemplate/kustomization.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 - kind: Kustomization - -resources: -- ../../base -- analysistemplate.yaml - -patches: - - target: - kind: Rollout - name: rollouts-demo - - patch: |- - - op: add - path: /spec/strategy/blueGreen/prePromotionAnalysis - value: - templates: - - templateName: smoke-tests - args: - - name: query - # irate(haproxy_backend_http_responses_total{exported_namespace='rollouts-demo-prod', route=~"rollout-bluegreen-preview", code="5xx"}[1m]) > 5 or on() vector(0) - value: irate%28haproxy_backend_http_responses_total%7Bexported_namespace%3D%27rollouts-demo-prod%27%2C%20route%3D~%22bluegreen-preview%22%2C%20code%3D%225xx%22%7D%5B1m%5D%29%20%3E%205%20or%20on%28%29%20vector%280%29 - - name: route-url - value: bluegreen-preview-rollouts-demo-prod.${SUB_DOMAIN}