argocd-apps-root

by info.eximia.it

Helm chartv0.2.4App 0.2.4Verified publisher

Chart to implement the ArgoCD app-of-apps pattern

About this chart

ArgoCD Apps Root

Purpose

The purpose of this chart is to provide an easy way to implement the app-of-apps pattern with ArgoCD.

The app-of-apps pattern allows you to manage multiple applications and environments in Kubernetes from a single entry point, enabling centralized and simplified configuration management.

Through a single inventory file (values.yaml), the corresponding AppProjects and ApplicationSets for each application and environment can be generated.

Example

# values.yaml
applications:
  - name: app1    
    environments:
      - name: dev
        namespace: app1-dev
        argoApplicationName: app1-test-gitops
        cluster: https://kubernetes.default.svc
        argoProjectName: app1
        appGitopsRepoURL: https://gitlab.com/app1-dev-gitops.git
        jwtTokens:
          - iat: 1712332996
            id: argocd-sync
      - name: prod
        namespace: app1-prod
        cluster: https://api.prod.example.com:6443
        argoApplicationName: app1-prod-gitops
        argoProjectName: app1        
        appGitopsRepoURL: https://gitlab.com/app1-prod-gitops.git
  
  - name: app2  
    environments:
      - name: dev
        namespace: app2-dev
        argoApplicationName: app2-dev-gitops
        cluster: https://kubernetes.default.svc
        argoProjectName: app2
        appGitopsRepoURL: https://gitlab.com/app2-dev-gitops.git
        jwtTokens:
          - iat: 1712332996
            id: argocd-sync
      - name: prod
        namespace: app2-prod
        cluster: https://api.prod.example.com:6443
        argoApplicationName: app2-prod-gitops
        argoProjectName: app2
        appGitopsRepoURL: https://gitlab.com/app2-prod-gitops.git
        jwtTokens:
          - iat: 1712332996
            id: argocd-sync

From this inventory, the corresponding AppProjects and ApplicationSets will be generated automatically.

Installation

It is recommended to install from a Git repo and ArgoCD to version the inventory (values.yaml).

Installation via Git and ArgoCD

Create a git repository with the Chart definition (Chart.yaml) and the inventory (values.yaml). Within Chart.yaml, you must define the argocd-apps-root chart as a dependency.

# Chart.yaml
apiVersion: v2
name: apps
description: Repository to implement the app-of-apps pattern with ArgoCD
type: application
version: 0.1.0
appVersion: "1.0"
dependencies:
  - name: argocd-apps-root
    version: x.y.z
    repository: https://charts.eximiait.com.ar

Then create an Application in ArgoCD pointing to the previously created git repository.

# argocd-app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argocd-apps-root
  namespace: argocd
spec:
  destination:
    namespace: argocd
    server: https://kubernetes.default.svc
  project: default
  source:
    repoURL: https://gitlab.com/eximiait/argocd-apps-root.git
    targetRevision: HEAD
    path: .
    helm:
      valueFiles:
        - values.yaml    
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

The creation of this application should be part of the ArgoCD post-installation, as it is responsible for creating all applications and environments.

Installation with Helm

helm repo add eximiait https://charts.eximiait.com.ar
helm repo update

helm install argocd-apps-root eximiait/argocd-apps-root \
  --namespace argocd \
  --values values.yaml \
  --version x.y.z

Configuration

The chart uses a hierarchical values structure to define projects, applications, and their environments.

Below are all available configuration options:

ParameterDescriptionDefault value
applicationSetGlobalGlobal configuration applied to all ApplicationSets
applicationSetGlobal.baseChart.enabledEnables the use of a base chart to install manifests common to all applications (quota, network-policies, etc)false
applicationSetGlobal.baseChart.urlGit repository URL where the base chart is located""
applicationSetGlobal.baseChart.pathPath within the repository where the base chart is located""
applicationSetGlobal.baseChart.targetRevisionRepository revision to use for the base chart""
argoProjectGlobalGlobal configuration for all AppProjects
argoProjectGlobal.clusterResourceWhitelistList of allowed cluster-level resources[]
argoProjectGlobal.clusterResourceBlacklistList of forbidden cluster-level resources[]
argoProjectGlobal.namespaceResourceWhitelistList of allowed namespace-level resources[]
argoProjectGlobal.namespaceResourceBlacklistList of forbidden namespace-level resources[]
applicationsList of applications to manage[]
applications[].nameApplication name, used for the ApplicationSet name
applications[].environmentsList of environments for the application[]
applications[].environments[].nameEnvironment name (dev, test, prod, etc.)
applications[].environments[].namespaceNamespace where the application will be deployed
applications[].environments[].clusterAPI server URL of the cluster where it will be deployed
applications[].environments[].argoApplicationNameName of the application in ArgoCD
applications[].environments[].argoProjectNameName of the associated ArgoCD project
applications[].environments[].appGitopsRepoURLGit repository URL with the application's GitOps configuration
applications[].environments[].projectSpecific configuration for the AppProject
applications[].environments[].project.groupNameName of the group with access to the AppProject
applications[].environments[].jwtTokensList of JWT tokens for API access[]
applications[].environments[].jwtTokens[].iatJWT token issued-at timestamp
applications[].environments[].jwtTokens[].idJWT token identifier

Full configuration example

applicationSetGlobal:
  baseChart:
    enabled: true
    url: https://github.com/eximiait/chart-base.git
    path: .
    targetRevision: main

# Global configuration to apply to all appProjects
argoProjectGlobal:
  clusterResourceWhitelist:
  - group: '*'
    kind: Namespace
  namespaceResourceBlacklist:
  - group: '*'
    kind: Secret

applications:
  - name: app1
    environments:
      - name: dev
        namespace: app1-dev
        cluster: https://kubernetes.default.svc
        argoApplicationName: app1-dev-gitops
        argoProjectName: app1
        appGitopsRepoURL: https://github.com/eximiait/app1-dev-gitops.git
        jwtTokens:
          - iat: 1712332996
            id: argocd-sync
      - name: test
        namespace: app1-test
        cluster: https://kubernetes.default.svc
        argoApplicationName: app1-test-gitops
        argoProjectName: app1
        appGitopsRepoURL: https://github.com/eximiait/app1-test-gitops.git
        jwtTokens:
          - iat: 7373737737
            id: argocd-sync
      - name: prod
        namespace: app1-prod
        cluster: https://api.prod.example.com:6443
        argoApplicationName: app1-prod-gitops
        argoProjectName: app1
        project:
          groupName: app1-prod-admin
        appGitopsRepoURL: https://github.com/eximiait/app1-prod-gitops.git
        jwtTokens:
          - iat: 9685485868
            id: argocd-sync

Deploy argocd-apps-root with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has argocd-apps-root on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartargocd-apps-root is pinned at v0.2.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply