Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Argo Rollouts Traffic Manager for OpenShift Routes

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

    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

    • Running AI inference on Rebellions ATOM NPU with Red Hat AI

    • How we built integration testing for fast-moving AI backend

    • Testing infrastructure red teaming with abliterated models

    • Build an enterprise RAG system with OGX

    • Solutions for SELinux MCS challenges with GitLab runners

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.