Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      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
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java 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

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • 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

About Argo CD ApplicationSet and SCM Provider generator

October 4, 2023
Ishita Sequeira
Related topics:
CI/CDGitOpsKubernetes
Related products:
Red Hat OpenShift Container Platform

Share:

    The ApplicationSet controller is a part of Argo CD that adds support for an ApplicationSet CustomResourceDefinition (CRD). The ApplicationSet controller helps to add Application automation and improve multicluster support and cluster multitenant support within Argo CD.

    ApplicationSet provides the following benefits:

    • The ability to use a single Kubernetes manifest to target multiple Kubernetes clusters and deploy multiple applications from one or multiple Git repositories with Argo CD.
    • Improved support for monorepos. In the context of Argo CD, a monorepo is multiple Argo CD Application resources defined within a single Git repository.
    • Within multitenant clusters, improves the ability of individual cluster tenants to deploy applications using Argo CD (without needing to involve privileged cluster administrators in enabling the destination clusters/namespaces).

    You can view all the supported fields for ApplicationSet in the Argo CD documentation.

    ApplicationSet generators

    Generators generate parameters and are rendered into the template field of the ApplicationSet resource. ApplicationSet supports a variety of generators, as described below:

    • List generator: Generates parameters based on an arbitrary list of key/value pairs.
    • Cluster generator: Allows you to target Argo CD applications to clusters based on the list of clusters defined within (and managed by) Argo CD.
    • Git generator: Allows you to create applications based on files within a Git repository or based on the directory structure of a Git repository.
    • Matrix generator: Can be used to combine the generated parameters of two separate generators.
    • Merge generator: Can be used to merge the generated parameters of two or more generators.
    • SCM Provider generator: Uses the API of a source code management (SCM) provider (e.g., GitHub) to discover repositories within an organization automatically.
    • Pull Request generator: Uses the API of a Source-Code-Management-as-a-Service (SCMaaS) provider (e.g., GitHub) to discover open pull requests within a repository automatically.
    • Cluster Decision Resource generator: Used to interface with Kubernetes custom resources that use custom resource-specific logic to decide which set of Argo CD clusters to deploy to.
    • Plug-in generator: Makes RPC HTTP requests to provide parameters.

    This article focuses exclusively on the SCM Provider generator and its use cases.

    Source code management

    SCM is used to track modifications to a source code repository. SCM tracks a running history of changes to a code base and helps resolve conflicts when merging updates from multiple contributors. SCM is also synonymous with version control.

    As software projects grow in lines of code and contributor headcount, the costs of communication overhead and management complexity also grow. SCM is a critical tool to alleviate the organizational strain of growing development costs.

    SCM Provider generator

    The SCM Provider generator uses the API of a SCMaaS provider such as GitHub to discover repositories within an organization automatically. This fits well with GitOps layout patterns that split microservices across many repositories.

    As of Argo CD version 2.8, the supported SCM providers are:

    • GitHub
    • GitLab 
    • Gitea
    • Bitbucket 
    • Azure DevOps
    • Bitbucket Cloud

    You can configure the ApplicationSet with SCM Provider as follows:

    apiVersion: argoproj.io/v1alpha1
    kind: ApplicationSet
    metadata:
      name: myapps
    spec:
      generators:
      - scmProvider:
          # Which protocol to clone using.
          cloneProtocol: ssh
          # See below for provider specific options.
          github:
            # ...

    cloneProtocol: defines the protocol to use for the SCM URL. The default is provider-specific, but ssh if possible.

    The provider's parameters are described in the Argo CD documentation. We will use GitHub for the example in this article.

    GitHub

    The GitHub mode uses the GitHub API to scan an organization in either github.com or GitHub Enterprise:

    apiVersion: argoproj.io/v1alpha1
    kind: ApplicationSet
    metadata:
      name: guestbook
    spec:
      generators:
      - scmProvider:
          github:
            organization: argoproj
          cloneProtocol: https
          filters:
          - repositoryMatch: example-apps
      template:
        metadata:
          name: '{{ repository }}-guestbook'
        spec:
          project: "default"
          source:
            repoURL: '{{ url }}'
            targetRevision: '{{ branch }}'
            path: guestbook
          destination:
            server: https://kubernetes.default.svc
            namespace: guestbook

    The parameters are explained below:

    • Organization: In the example above, we used argoproj. If you have multiple organizations, use multiple generators.
    • api: This field is optional; however, if you are using GitHub Enterprise, you will need to specify the URL to access the API. In our example, we are not using GitHub Enterprise.
    • filters: SCM Provider supports multiple filters. We are using a repositoryMatch filter matching the repository with name example-apps. You can find more filters in the documentation.

    Use case

    There is an e-commerce website with multiple services for orders, inventory, payments, etc.; each service is stored in a separate Git repository within the same organization. When we deploy the e-commerce website, we want all the services to be deployed simultaneously for the website to start successfully.

    In this case, we can use the SCM Provider generator to generate all the services belonging to the same organization. You can configure the ApplicationSet in the following format:

    apiVersion: argoproj.io/v1alpha1
    kind: ApplicationSet
    metadata:
      name: ecommerce-website
    spec:
      generators:
      - scmProvider:
          github:
            organization: ecommerceWebsite
          cloneProtocol: https
      template:
        metadata:
          name: '{{ repository }}'
        spec:
          project: "default"
          source:
            repoURL: '{{ url }}'
            targetRevision: '{{ branch }}'
            path: app
          destination:
            server: https://kubernetes.default.svc
            namespace: ecomm

    The ApplicationSet above will read all the repositories in the GitHub organization ecommerceWebsite and deploy all the services in the repositories within the path app in each repository.

    Pros

    Deploying multiple applications and services in the same organization is easy and quick. You can use the SCM Provider generator to allow you to dynamically generate ephemeral environments for testing or prod-like environments easily.

    Cons

    Once the entire organization is added to the SCM Provider generator, it will pick all the repositories matching the added filtering conditions. If you want to create a new repository within the same organization and do not want it to be deployed, you would need to ensure that the repository does not match any of the filtering conditions added to the SCM Provider generator. This becomes an additional effort if the SCM generator is not configured properly.

    Conclusion

    The ApplicationSet custom resource helps you easily and quickly manage multitenant or cluster application deployment. The SCM Provider generator is helpful when you want to manage all repositories of a known pattern within an organization and deploy resources to Argo CD by automatically identifying changes to any of the repositories in the organization.

    Last updated: October 26, 2023

    Related Posts

    • 3 patterns for deploying Helm charts with Argo CD

    • Automate CI/CD on pull requests with Argo CD ApplicationSets

    • Multiple sources for Argo CD applications

    • Manage namespaces in multitenant clusters with Argo CD, Kustomize, and Helm

    • Prevent auto-reboot during Argo CD sync with machine configs

    • How to set up your GitOps directory structure

    Recent Posts

    • Expand Model-as-a-Service for secure enterprise AI

    • OpenShift LACP bonding performance expectations

    • Build container images in CI/CD with Tekton and Buildpacks

    • How to deploy OpenShift AI & Service Mesh 3 on one cluster

    • JVM tuning for Red Hat Data Grid on Red Hat OpenShift 4

    What’s up next?

    Path to GitOps cover card

    Read The Path to GitOps for a comprehensive look at the tools, workflows, and structures teams need to have in place in order to enable a complete GitOps workflow.

    Get the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    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