Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
maxi1555_2022
Contributor
Hi all,

In my previous blog I shared my experience creating a simple and single app deployed in a single cluster, but what if you need to manage hundreds of apps in a large and dynamic environments deployed in different SAP Kyma clusters, do you need to maintain all of them in every cluster?, let me try to answer it 🙂


SAP Kyma Cluster per environment


First of all Argo CD can deploy applications in multiple SAP Kyma clusters from one unique SAP Kyma cluster:


Argo CD Multi-cluster


The only thing that you need is to install the Argo CD CLI and register the new cluster in the Argo CD server.

Second, Argo CD provides a controller ( that need to be installed apart of the main installation ) that allow the creation of "ApplicationSet", unlike with an Argo CD Application resource, which deploys resources from a single Git repository to a single destination cluster/namespace, "ApplicationSet" uses templated automation to create, modify, and manage multiple Argo CD applications simultaneously, targeting multiple destination clusters/namespaces.

 

 


ApplicationSet


As you can start to imagine, this controller is very useful to generate dynamic environments, with dynamic applications that needs to be deployed in dynamic SAP Kyma clusters, let's try to use the following repository structure to handle the our scenario:


Infrastructure as Code - repository


We can see :

  • Folder called "envs" that contains all environments

  • Folder called "dev":

    • That contains :

      • Folder "argocd" --> Contains the "ApplicationSet" for this environment

      • Folder "test3" --> SAP CAP application

      • Folder "test4" --> SAP CAP application





  • Folder called "qas" & "prd": they are equals from structure point of view

  • File called "envs-generator.yml" representing the "ApplicationSet" for this repository


The main idea of this repository is to create one unique "Argo CD application" ( called "app-generator-envs" ) for the "Argo CD ApplicationSet" that will create automatically & dynamically "Argo CD applications" per environments using the folder "envs" ( called "app-generator-<environment>" ) where those applications will create automatically & dynamically "Argo CD applications" per application to deploy using the folder "envs/<environment>" ( called "app-generated-<environment>-<app>").


An image says more than a thousand words


Let's see it in action:


app-generator-envs( definition )



app-generator-envs( result )



appset-generator-envs( definition )



app-generator-dev( result )



appset-generator-dev( definition )



app-generated-dev-test3( result )


So, after deploying one unique "Argo CD Application" all the SAP CAP applications were deployed as desired in the IaC repository ( for the sake of this blog only one cluster was used, but it could be specified in the "appset-generator-<environment>" file).

We can classify the "Argo CD Applications " as "generator" & "generated":


Generator Argo CD Applications



Generated Argo CD Applications ( SAP CAP apps )


So, the following questions could raise in your mind:

  • How to add a new SAP CAP application in "dev" environment? --> just add the app folder under "envs/dev" and it will automatically sync by the "appset-generator-dev"

  • How to promote a new SAP CAP application from "dev" to "qas"?, just copy & paste your app folder from "dev" folder to "qas" folder and it will automatically sync by the "appset-generator-qas"

  • How to add a new environment ? --> just add the new environment folder under "envs" and the corresponding "appset-generator-<environment>" and it will automatically sync by the "appset-generator-envs"


Conclusion


It's really easy to deploy multiples SAP CAP applications in different SAP Kyma clusters using Argo CD 😉

 

Repository: maxi1555/gitops-environments-public (github.com)
Labels in this area