Argo CD and GitOps
Our Rocket Pad Platform follows the GitOps principles and therefore uses Git repositories as its central configuration point. With this concept in mind the most important service in the Rocket Pad Platform is Argo CD. Argo CD is a declarative, GitOps continuous delivery (CD) tool specifically designed for Kubernetes environments. It automates the deployment and management of applications within our Rocket Pad Platform. Argo CD takes the configuration you provide in Git manifests and ensures your Kubernetes cluster reflects that desired state for your applications. This approach streamlines deployments, simplifies rollbacks, and promotes a GitOps workflow for managing your Kubernetes applications. We build on top of this with Jsonnet to dynamically create the kubernetes manifests for our platform that will be picked up by Argo CD and rolled out in the cluster. Don't worry you will not need to learn Jsonnet, its only what we use under the hood to allow for more complex deployments such as a whole platform and simplify the configuration for you.
The App of Apps Pattern
For our Rocket Pad Platform we use the App of Apps Pattern for Argo CD. The app of apps pattern allows you to define an application in Argo CD that manages the deployment of other applications. This nested structure enables centralized configuration and deployment of complex platforms with multiple interdependent services. There are two types of applications, when using the app of apps pattern:
- Meta-Application: You define a central "application" object within Argo CD. This application, however, doesn't deploy any resources itself.
- Child Applications: Instead, the meta-application references other applications (child applications) stored within your Git repository
Bootstrapping with Argo CD
With this concept in mind our first Meta-Application is the bootstrap application build out of the /bootstrap/main.jsonnet
folder and file, when bootstrapping our Rocket Pad Platform. When opening Argo CD after deploying the Rocket Pad Platform you will find a app called bootstrap and most likely this will be the only app and broken as well, due to missing access to your git repository. When providing the needed access credentials as described in the Installation tutorial a lot more apps will spawn.
This happens due to the bootstrap Meta-Application syncing with what is defined in your /deps/main.jsonnet
folder, which contains all the Child Applications that are needed to bootstrap our Rocket Pad Platform.
For your own apps we also recommend using Argo CD and the App of Apps Pattern. To set this up you can create another Meta-Application in a /bootstrap/apps/app-of-apps.yaml
for example. Don't forget to add this application path to the /bootstrap/main.jsonnet
file
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: app-of-apps
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
sources:
- repoURL: YOUR-GITOPS-REPO-URL # The url of the repository where all your custom apps will be saved
targetRevision: HEAD # The branch of the repository to use
path: apps/ # The path to a folder where all the argocd application yaml files will be used from
destination:
server: 'https://kubernetes.default.svc'
namespace: argocd
syncPolicy:
syncOptions:
- CreateNamespace=true
automated:
prune: true
selfHeal: true
local platformApps = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/base/apps.libsonnet';
local rootApp = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/base/root.libsonnet';
local providerApps = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/provider/talos/apps.libsonnet';
local providerApp = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/provider/talos/root.libsonnet';
local config = import './config.libsonnet';
local argocd = import '../deps/vendor/github.com/jsonnet-libs/argo-cd-libsonnet/2.7/main.libsonnet';
local path = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/base/deps/vendor/gitlab.com/rocketpadplatforms/platform/util-libsonnet/util-libsonnet/path.libsonnet';
local util = import '../deps/vendor/gitlab.com/rocketpadplatforms/platform/base/deps/vendor/gitlab.com/rocketpadplatforms/platform/util-libsonnet/util-libsonnet/util.libsonnet';
local app = argocd.argoproj.v1alpha1.application;
function(root=false, repoURL='YOUR-BOOTSTRAP-GIT-REPO', revision='HEAD', pathPrefix='./bootstrap', dynamicConfig={})
local apps = {
platform: platformApps(repoURL, revision, (path.new(pathPrefix) + path.join('../deps/vendor/gitlab.com/rocketpadplatforms/platform/base/')).path, dynamicConfig=dynamicConfig) {
config+: config + dynamicConfig,
},
provider: providerApps(repoURL, revision, (path.new(pathPrefix) + path.join('../deps/vendor/gitlab.com/rocketpadplatforms/platform/provider/talos/')).path, dynamicConfig=dynamicConfig) {
config+: config + dynamicConfig,
},
};
if !root then
apps.platform.flattened
+ apps.provider.flattened
+ [
std.parseYaml(importstr 'apps/app-of-apps.yaml'), # Add the path to your app of apps yaml here
]
else
apps.platform.bootstrap
+ [rootApp(repoURL=repoURL, revision=revision, path=pathPrefix, dynamicConfig=dynamicConfig)]
This setup will create a new app of apps and load all the Argo CD applications defined tin the YOUR-GITOPS-REPO-URL GitOps repository you defined.