Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Progressive delivery reduces the risk of a release by exposing the new version o

With Argo Rollouts, you can use automation and metric analysis to support progressive deployment delivery and drive the automated rollout or rollback of a new version of an application.
Argo Rollouts provide advanced deployment capabilities and enable integration with ingress controllers and service meshes.
You can use Argo Rollouts to manage multiple replica sets that represent different versions of the deployed application. Depending on your deployment strategy, you can handle traffic to these versions during an update by optimizing their existing traffic shaping abilities and gradually shifting traffic to the new version. You can combine Argo Rollouts with a metric provider like Prometheus to do metric-based and policy-driven rollouts and rollbacks based on the parameters set.
You can use Argo Rollouts to manage multiple replica sets that represent different versions of the deployed application. Depending on your deployment strategy, you can handle traffic to these versions during an update by optimizing their existing traffic shaping abilities and gradually shifting traffic to the new version. You can combine Argo Rollouts with a metric provider like Prometheus to do metric-based and policy-driven rollouts and rollbacks based on the parameters set.

[id="prerequisites_using-argo-rollouts-for-progressive-deployment-delivery"]
== Prerequisites
Expand All @@ -39,6 +39,12 @@ include::modules/gitops-creating-rolloutmanager-custom-resource.adoc[leveloffset
// Deleting a RolloutManager custom resource
include::modules/gitops-deleting-rolloutmanager-custom-resource.adoc[leveloffset=+1]

// Routing traffic by using Argo Rollouts
include::modules/con_routing-traffic-by-using-argo-rollouts.adoc[leveloffset=+1]

// Configuring Argo Rollouts to route traffic by using OpenShift Routes
include::modules/gitops-configure-rollout-route-traffic-using-openshift-routes.adoc[leveloffset=+2]

[role="_additional-resources"]
[id="additional-resources_argo-rollouts-in-gitops"]
== Additional resources
Expand All @@ -48,4 +54,7 @@ include::modules/gitops-deleting-rolloutmanager-custom-resource.adoc[leveloffset
* link:https://docs.openshift.com/container-platform/latest/applications/deployments/route-based-deployment-strategies.html#deployments-blue-green_route-based-deployment-strategies[Blue-green deployments]
* link:https://argo-rollouts-manager.readthedocs.io/en/latest/crd_reference/[`RolloutManager` Custom Resource specification]
* link:https://www.redhat.com/architect/blue-green-canary-argo-rollouts[Blue-green and canary deployments with Argo Rollouts]
* xref:../installing_gitops/installing-argocd-gitops-cli.adoc#installing-argocd-gitops-cli[Installing the GitOps CLI]
* xref:../gitops_cli_argocd/configuring-argocd-gitops-cli.adoc#configuring-argocd-gitops-cli[Configuring the GitOps CLI]
* xref:../argo_rollouts/using-argo-rollouts-for-progressive-deployment-delivery.adoc#gitops-creating-rolloutmanager-custom-resource_using-argo-rollouts-for-progressive-deployment-delivery[Creating a RolloutManager custom resource]
* link:https://cloud.redhat.com/blog/trying-out-argo-rollouts-in-openshift-gitops-1.9/[Argo Rollouts tech preview limitations]
15 changes: 15 additions & 0 deletions modules/con_routing-traffic-by-using-argo-rollouts.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Module included in the following assemblies:
//
// * argo_rollouts/using-argo-rollouts-for-progressive-deployment-delivery.adoc
:_mod-docs-content-type: CONCEPT
[id="routing-traffic-by-using-argo-rollouts_{context}"]
= Routing traffic by using Argo Rollouts

You can progressively route a subset of user traffic to a new application version by using Argo Rollouts and its traffic-splitting mechanisms. This allows you to test if the application is deployed and working.

With Openshift Routes, you can configure Argo Rollouts to reduce or increase the amount of traffic by directing it to various applications in a cluster environment based on your requirements.

You can use OpenShift Routes to split traffic between two application versions:

* *Canary version*: A new version of an application where you gradually route the traffic.
* *Stable version*: The current version of an application. After the canary version is stable and has all the user traffic directed to it, it becomes the new stable version. The previous stable version is discarded.
2 changes: 1 addition & 1 deletion modules/gitops-argo-rollouts-architecture-overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Argo Rollouts support is enabled on a cluster by installing the {gitops-title} Operator and configuring a `RolloutManager` custom resource (CR) instance.

After a RolloutManager CR is created, the {gitops-title} Operator installs Argo Rollouts into that same namespace. This step includes the installation of the Argo Rollouts controller and the resources required for handling Argo Rollouts, such as CRs, roles, role bindings, and configuration data.
After a `RolloutManager` CR is created, the {gitops-title} Operator installs Argo Rollouts into that same namespace. This step includes the installation of the Argo Rollouts controller and the resources required for handling Argo Rollouts, such as CRs, roles, role bindings, and configuration data.

The Argo Rollouts controller can be installed in two different modes:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
// Module included in the following assemblies:
//
// * argo_rollouts/using-argo-rollouts-for-progressive-deployment-delivery.adoc

:_mod-docs-content-type: PROCEDURE
[id="gitops-configure-rollout-route-traffic-using-openshift-routes_{context}"]
= Configuring Argo Rollouts to route traffic by using OpenShift Routes

You can use OpenShift Routes to configure Argo Rollouts to create routes, rollouts, and services.

The following example procedure creates a route, a rollout, and two services. It then gradually routes an increasing percentage of traffic to a canary version of the application before that canary state is marked as successful and becomes the new stable version.

.Prerequisites

* You have logged in to the {OCP} cluster as an administrator.
* You have installed the {gitops-title} on your {OCP} cluster.
* You have installed Argo Rollouts on your {OCP} cluster. For more information, see "Creating a RolloutManager custom resource".
* You have installed the {gitops-title} CLI on your system. For more information, see "Installing the {gitops-shortname} CLI".
* You have installed the Argo Rollouts CLI on your system. For more information, see "Argo Rollouts CLI overview".

.Procedure

. Create a `Route` object.
.. In the *Administrator* perspective of the web console, click *Networking* -> *Routes*.
.. Click *Create Route*.
.. On the *Create Route* page, click *YAML view* and add the following snippet:
The following example creates a route called `rollouts-demo-route`:
+
[source,yaml]
----
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: rollouts-demo-route
spec:
port:
targetPort: http #<1>
tls: #<2>
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: argo-rollouts-stable-service #<3>
weight: 100 # <4>

alternateBackends:
- kind: Service
name: argo-rollouts-canary-service #<5>
weight: 0 #<6>
----
<1> Specifies the name of the port used by the application for running inside the container.
<2> Specifies the TLS configuration used to secure the route.
<3> The name of the targeted stable service.
<4> This field is automatically modified to stable weight by Route Rollout plugin.
<5> The name of the targeted canary service.
<6> This field is automatically modified to canary weight by Route Rollout plugin.
+
.. Click *Create* to create the route. It is then displayed on the *Routes* page.
. Create the services, canary and stable, to be referenced in the route.
.. In the *Administrator* perspective of the web console, click *Networking* -> *Services*.
.. Click *Create Service*.
.. On the *Create Service* page, click *YAML view* and add the following snippet:
The following example creates a canary service called `argo-rollouts-canary-service`. Canary traffic is directed to this service.
+
[source,yaml]
----
apiVersion: v1
kind: Service
metadata:
name: argo-rollouts-canary-service
spec:
ports: #<1>
- port: 80
targetPort: http
protocol: TCP
name: http

selector: #<2>
app: rollouts-demo
----
<1> Specifies the name of the port used by the application for running inside the container.
<2> Ensure that the contents of the `selector` field are the same as in stable service and `Rollout` custom resource (CR).
+
[IMPORTANT]
====
Ensure that the name of the canary service specified in the `Route` object matches with the name of the canary service specified in the `Service` object.
====
.. Click *Create* to create the canary service.
+
Rollouts automatically update the created service with pod template hash of the canary `ReplicaSet`. For example, `rollouts-pod-template-hash: 7bf84f9696`.
.. Repeat these steps to create the stable service:
The following example creates a stable service called `argo-rollouts-stable-service`. Stable traffic is directed to this service.
+
[source,yaml]
----
apiVersion: v1
kind: Service
metadata:
name: argo-rollouts-stable-service
spec:
ports: #<1>
- port: 80
targetPort: http
protocol: TCP
name: http

selector: #<2>
app: rollouts-demo
----
<1> Specifies the name of the port used by the application for running inside the container.
<2> Ensure that the contents of the `selector` field are the same as in canary service and `Rollout` CR .
+
[IMPORTANT]
====
Ensure that the name of the stable service specified in the `Route` object matches with the name of the stable service specified in the `Service` object.
====
.. Click *Create* to create the stable service.
+
Rollouts automatically update the created service with pod template hash of the stable `ReplicaSet`. For example, `rollouts-pod-template-hash: 1b6a7733`.
. Create the `Rollout` CR to reference the `Route` and `Service` objects.
.. In the *Administrator* perspective of the web console, go to *Operators* -> *Installed Operators* -> *Red Hat OpenShift GitOps* -> *Rollout*.
.. On the *Create Rollout* page, click *YAML view* and add the following snippet:
The following example creates a `Rollout` CR called `rollouts-demo`:
+
[source,yaml]
----
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
template: #<1>
metadata:
labels:
app: rollouts-demo
spec:
containers:
- name: rollouts-demo
image: argoproj/rollouts-demo:blue
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
memory: 32Mi
cpu: 5m

revisionHistoryLimit: 2
replicas: 5
strategy:
canary:
canaryService: argo-rollouts-canary-service #<2>
stableService: argo-rollouts-stable-service #<3>
trafficRouting:
plugins:
argoproj-labs/openshift:
routes:
- rollouts-demo-route #<4>
steps: #<5>
- setWeight: 30
- pause: {}
- setWeight: 60
- pause: {}
selector: #<6>
matchLabels:
app: rollouts-demo
----
<1> Specifies the pods that are to be created.
<2> This value must match the name of the created canary `Service`.
<3> This value must match the name of the created stable `Service`.
<4> This value must match the name of the created `Route` CR.
<5> Specify the steps for the rollout. This example gradually routes 30%, 60%, and 100% of traffic to the canary version.
<6> Ensure that the contents of the `selector` field are the same as in canary and stable service.
.. Click *Create*.
+
After the Rollout has been created, you can verify that the *Status* field of the Rollout shows *Phase: Healthy*.
.. In the *RolloutManager* tab, under the *RolloutManagers* section, verify that the *Status* field of the *RolloutManager* instance shows as *Phase: Available*.

. Verify that the route is directing 100% of the traffic towards the stable version of the application.
+
[NOTE]
====
When the first instance of the `Rollout` resource is created, the rollout regulates the amount of traffic to be directed towards the stable and canary application versions. In the initial instance, the creation of the `Rollout` resource routes all of the traffic towards the stable version of the application and skips the part where the traffic is sent to the canary version.
====
.. Go to *Networking* -> *Routes* and look for the `Route` resource you want to verify.
.. Select the *YAML* tab and view the following snippet:
+
.Example: `Route`
[source,yaml]
----
kind: Route
metadata:
name: rollouts-demo-route
spec:
alternateBackends:
- kind: Service
name: argo-rollouts-canary-service
weight: 0 #<1>
# (...)
to:
kind: Service
name: argo-rollouts-stable-service
weight: 100 #<2>
----
<1> A value of `0` means that 0% of traffic is directed to the canary version.
<2> A value of `100` means that 100% of traffic is directed to the stable version.
. Simulate the new canary version of the application by modifying the container image deployed in the rollout.
.. In the *Administrator* perspective of the web console, go to *Operators* -> *Installed Operators* -> *Red Hat OpenShift GitOps* -> *Rollout*.

.. Select the existing *Rollout* and modify the `.spec.template.spec.containers.image` value from `argoproj/rollouts-demo:blue` to `argoproj/rollouts-demo:yellow`.
+
As a result, the container image deployed in the rollout is modified and the rollout initiates a new canary deployment.
+
[NOTE]
====
As per the `setWeight` property defined in the `.spec.strategy.canary.steps` field of the `Rollout` resource, initially 30% of traffic to the route reaches the canary version and 70% of traffic is directed towards the stable version. The rollout is paused after 30% of traffic is directed to the canary version.
====
+
.Example route with 30% of traffic directed to the canary version and 70% directed to the stable version.
[source,yaml]
----
spec:
alternateBackends:
- kind: Service
name: argo-rollouts-canary-service
weight: 30
# (...)
to:
kind: Service
name: argo-rollouts-stable-service
weight: 70
----

. Simulate another new canary version of the application by running the following command in the Argo Rollouts CLI:
+
[source,terminal]
----
$ oc argo rollouts promote rollouts-demo -n <namespace> <1>
----
<1> Specify the namespace where the `Rollout` resource is defined.
+
This increases the traffic weight to 60% in the canary version and 40% in the stable version.
+
.Example route with 60% of traffic directed to the canary version and 40% directed to the stable version.
[source,yaml]
----
spec:
alternateBackends:
- kind: Service
name: argo-rollouts-canary-service
weight: 60
# (...)
to:
kind: Service
name: argo-rollouts-stable-service
weight: 40
----
. Increase the traffic weight in the canary version to 100% and discard the traffic in the old stable version of the application by running the following command:
+
[source,terminal]
----
$ oc argo rollouts promote rollouts-demo -n <namespace> <1>
----
<1> Specify the namespace where the `Rollout` resource is defined.
+
.Example route with 0% of traffic directed to the canary version and 100% directed to the stable version.
[source,yaml]
----
spec:
# (...)
to:
kind: Service
name: argo-rollouts-stable-service
weight: 100
----