Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Argo Rollouts Traffic Manager for OpenShift Routes

October 2, 2024
Gerald Nunn
Related topics:
DevOpsGitOps
Related products:
Red Hat OpenShift

Share:

    Introduction

    Argo Rollouts is a drop-in replacement for Deployments that supports advanced deployment strategies like blue-green and canaries versus the simpler strategies of replace and rolling that Deployment supports.

    In a blue-green rollout, we deploy a new version of the application in a separate stack from the current version, with the two versions running in parallel for some time. This enables testing on the new version while users continue to access the current version of the application until a traffic cutover occurs.

    Argo Rollouts Blue Green

    Canary can be thought of as an advanced version of blue-green. Instead of an abrupt cut-over of live traffic between a current and new revision, traffic is instead gradually increased to the new version in increments, or steps, while simultaneously decreasing the current revision.

    Argo Rollouts Canary

    Both of these strategies require that Argo Rollouts manage the traffic between the blue/green or stable/canary versions of the application. The blue/green strategy does not require active traffic management since it is simply a cut-over between services, however the canary strategy does require more active involvement to match the service weighting specified in each step.

    To manage this, Argo Rollouts includes a number of traffic managers out-of-the-box as per the documentation. While the Istio Traffic Manager works wonderfully with OpenShift Service Mesh, unfortunately there is not an included traffic manager for OpenShift Routes.

    The good news though is Rollouts includes the ability to create traffic managers as plugins and OpenShift GitOps 1.13 and later provide a fully supported plugin to manage OpenShift Routes. This blog will provide a quick introduction to using this traffic manager however complete documentation is also available.

    Using the OpenShift Routes Traffic Manager

    An OpenShift Route supports multiple services, a primary and one or more alternates, with a weighting for each of the provided services. With Argo Rollouts, the OpenShift Routes Traffic Manager will automatically manage this weighting by adjusting it as needed to match the weighting of the current step in the canary Rollout. 

    So for example if the desired weighting for a canary step is 80/20, the traffic manager will automatically adjust the weighting in the Route to 80/20 between services to match. 

    To use the OpenShift Routes Traffic Manager all that is required is to specify it in the trafficRouting stanza under strategy and include the name of the Route that is to be managed. Here is an example:

    apiVersion: argoproj.io/v1alpha1
    kind: Rollout
    metadata:
      name: canary
    spec:
      ...
      strategy:
        canary:
          canaryService: canary-canary
          stableService: canary-stable
          trafficRouting:
            plugins:
              argoproj-labs/openshift:
                routes:
                  - canary
          steps:
          - setWeight: 20
          - pause: {}
          - setWeight: 40
          - pause: {duration: 10}
          - setWeight: 60
          - pause: {duration: 10}
          - setWeight: 80
          - pause: {duration: 10}
      ...

    The canary route, canary, that is being managed is specified as follows:

    apiVersion: route.openshift.io/v1
    kind: Route
    metadata:
      name: canary
      annotations:
        haproxy.router.openshift.io/disable_cookies: 'true'
        haproxy.router.openshift.io/balance: roundrobin
    spec:
      port:
        targetPort: http
      tls:
        insecureEdgeTerminationPolicy: Redirect
        termination: edge
      to:
        kind: Service
        name: canary-stable
        weight: 100
      alternateBackends:
        - kind: Service
          name: canary-canary
          weight: 0

    Note the stable service (canary-stable) is the primary and the canary service (canary-canary, yes my naming could be better 🙂) is the alternate service. The default weighting is set to 100 for the primary and 0 for the stable. Note also that sticky sessions are disabled to test the weighting independently of persistent sessions 

    The demo application shows colored squares based on an image tag (:blue, :green, etc). Once you promote a new image with a new color tag in the Rollout it will progress through the specified steps. When the first step is executed it sets the weighting at 20% and then pauses indefinitely in the second step. Checking the stable route at this point shows the application splitting the canary between the blue (stable) and green (canary) colors in a 80/20 split:

    Argo Rollouts Stable-Canary Split

    Examining the route at this moment shows the weighting set to 80/20:

    apiVersion: route.openshift.io/v1
    kind: Route
    metadata:
      name: canary
      ...
    spec:
      ...
      to:
        kind: Service
        name: canary-stable
        weight: 80
      alternateBackends:
        - kind: Service
          name: canary-canary
          weight: 20

    Rollouts Traffic Manager and Argo CD

    When deploying the Route keep in mind that the traffic manager will be updating the Route dynamically. If the Route is being managed by Argo CD this will cause Argo CD to complain that it is out-of-sync, and worse if self heal is enabled, revert the changes.

    This can be addressed by using the ignoreDifferences feature in Argo CD, also to prevent the traffic manager changes from being reverted on a manual sync the sync option RespectIgnoreDifferences should be used.

    Here is an example Argo CD Application with these features enabled:
     

    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      labels:
        app.kubernetes.io/name: rollouts-demo
      name: rollouts-demo-prod
      namespace: rollouts-demo-gitops
    spec:
      destination:
        namespace: rollouts-demo-prod
        server: https://kubernetes.default.svc
      ignoreDifferences:
      - group: route.openshift.io
        jsonPointers:
        - /status
        - /spec/to/weight
        - /spec/alternateBackends
        kind: Route
      project: default
      source:
        path: environments/overlays/prod
        repoURL: https://github.com/gitops-examples/rollouts-demo.git
        targetRevision: main
      syncPolicy:
        automated:
          selfHeal: true
        syncOptions:
        - RespectIgnoreDifferences=true

    Note if you are deploying multiple routes out of the same Application the ignoreDifferences capability can select resources based on a specific name enabling it to be applied only to the canary route managed by the traffic manager.

    Conclusion

    In this brief blog we reviewed how to use the OpenShift Routes Traffic Manager in OpenShift GitOps. A complete example of this feature is available in the gitops-example/rollouts-demo repository and again the documentation is available here.

    Last updated: October 3, 2024
    Disclaimer: Please note the content in this blog post has not been thoroughly reviewed by the Red Hat Developer editorial team. Any opinions expressed in this post are the author's own and do not necessarily reflect the policies or positions of Red Hat.

    Recent Posts

    • Profiling vLLM Inference Server with GPU acceleration on RHEL

    • Network performance in distributed training: Maximizing GPU utilization on OpenShift

    • Clang bytecode interpreter update

    • How Red Hat has redefined continuous performance testing

    • Simplify OpenShift installation in air-gapped environments

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue