Skip to content

Commit ff550b2

Browse files
committed
extend paragraphs, motivation, conclustion, git interaction
1 parent 7cba7fa commit ff550b2

1 file changed

Lines changed: 106 additions & 44 deletions

File tree

docs/modules/demos/pages/argo-cd-git-ops.adoc

Lines changed: 106 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,46 @@
1212
:airflow-git-sync: https://docs.stackable.tech/home/stable/airflow/usage-guide/mounting-dags/#_via_git_sync
1313
:github-fork: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo
1414

15-
This demo shows how to utilize GitOps and Infrastructure as Code (IaC) with Stackable and {argo-cd}[ArgoCD].
16-
Basic knowledge about ArgoCD and its {argo-cd-core-concepts}[core concepts] are assumed and not explained further.
15+
== Motivation
16+
17+
Modern Kubernetes environments thrive on automation, reproducibility, and strong version control.
18+
GitOps provides a reliable way to manage infrastructure and applications declaratively: your desired cluster state is stored in Git,
19+
and changes are automatically synchronized. This tutorial demonstrates how to deploy Stackable operators and products using {argo-cd}[ArgoCD],
20+
following Infrastructure-as-Code (IaC) and GitOps principles.
21+
22+
By the end, you will learn how to:
23+
* Deploy Stackable operators and products via Git-managed manifests.
24+
* Use Sealed Secrets to securely manage sensitive credentials.
25+
* Update Airflow DAGs or modify deployments simply by committing to Git.
26+
27+
This hands-on approach illustrates how GitOps can simplify application lifecycle management and enforce a clear,
28+
auditable workflow across environments (development, staging, production).
1729

1830
All products and manifests are synced and deployed via ArgoCD (except ArgoCD itself, which is bootstrapped via `stackablectl`).
1931

20-
The key points to show are:
32+
[#system-requirements]
33+
== System requirements
34+
35+
To run this demo, ensure you have the following prerequisites:
36+
* Kubernetes Cluster (e.g., Kind, Minikube, or managed services like EKS, GKE, AKS)
37+
* `kubectl`: Installed and configured to access your cluster.
38+
* Optional: GitHub Account - Required for forking and interacting with the demo repository.
39+
40+
Resource requirements for this demo:
41+
* 15 {k8s-cpu}[cpu units] (core/hyperthread)
42+
* 15 GiB memory
43+
* 5 GiB disk storage
44+
45+
Basic knowledge about ArgoCD and its {argo-cd-core-concepts}[core concepts] are assumed and not explained further.
2146

22-
* Infrastructure - GitOps
23-
** How to synchronize changes from a Git repository?
24-
** How to apply the Git version and branch control to different Kubernetes clusters (development, staging, production)?
25-
** How to safely store and deploy sensitive data from a Git repository?
26-
* Interaction with Stackable products and Git
27-
** Use Airflow and {airflow-git-sync}[git-sync] to fetch DAGs from a Git repository
28-
** Add or update existing DAGs by commiting to the Git repository
47+
## Architecture
2948

3049
ArgoCD and other deployed products and dependencies are illustrated in the following diagram:
3150

3251
image::argo-cd-git-ops/architecture-overview.drawio.svg[]
3352

53+
## Installation
54+
3455
Install this demo on an existing Kubernetes cluster:
3556

3657
NOTE: In order to interact with the Git repository, this repository must be forked and additional parameters must be provided to `stackablectl`.
@@ -46,30 +67,6 @@ WARNING: This demo should not be run alongside other demos.
4667
NOTE: ArgoCD will be deployed in the `argo-cd` namespace by `stackablectl`.
4768
ArgoCD itself will create other namespaces for the deployed products.
4869

49-
[#system-requirements]
50-
== System requirements
51-
52-
To run this demo, your system needs at least:
53-
54-
* 15 {k8s-cpu}[cpu units] (core/hyperthread)
55-
* 15 GiB memory
56-
* 5 GiB disk storage
57-
58-
== Overview
59-
60-
This demo consists of multiple parts:
61-
62-
* Bootstrapping {argo-cd}[Argo CD] via `stackablectl`:
63-
* Deploy components via ArgoCD:
64-
** Install a {sealed-secrets}[Sealed Secrets] controller to decrypt secrets stored in a Git repository
65-
** Install all Stackable operators using an ArgoCD `ApplicationSet`
66-
** Install the Airflow dependencies Minio and Postgres as ArgoCD `Application`
67-
** Deploy Stackable Airflow manifests into their respective ArgoCD `Projects`
68-
* Inspect Airflow web UI
69-
** DAGs are synced from a Git repository
70-
** Start a DAG and check the results
71-
** Check Kubernetes Executor logs persisted in Minio
72-
7370
== Sealed Secrets
7471

7572
When managing all resources and configuration via Git, deploying sensitive data like certificates or credentials via Git becomes a problem.
@@ -123,7 +120,7 @@ using different versions and Git sources (repository & branch) as well as the po
123120

124121
NOTE: This demo does not use a multi cluster environment for the sake of simplicity.
125122

126-
The following part is dives deeper into the definition of theStackable operator `ApplicationSet` and can be skipped.
123+
The following part dives deeper into the definition of the Stackable operator `ApplicationSet` and can be skipped.
127124

128125
.Stackable operators `ApplicationSet` details
129126
[%collapsible]
@@ -294,44 +291,109 @@ The log files contained in the single folders are the same as the logs shown abo
294291

295292
== Conclusion
296293

297-
This demo illustrates the combination of ArgoCD and Stackable, using the full potential of GitOps and demonstrating key features for a successful IaC deployment using Stackable.
294+
This demo illustrates a repeatable blueprint for managing complex data platform components with ArgoCD and GitOps.
295+
Once familiar with this pattern, you can extend it to multi-cluster environments, add CI/CD pipelines for automated manifest testing,
296+
or integrate external secret stores like HashiCorp Vault for production use. This setup lays the foundation for a fully automated, scalable, and secure Kubernetes-based data platform.
297+
298+
This tutorial demonstrates how ArgoCD and Stackable integrate to deliver a streamlined GitOps experience:
299+
* All cluster resources and workloads are managed declaratively via Git.
300+
* ArgoCD continuously ensures the cluster state matches Git.
301+
* Sealed Secrets provide secure and auditable secret management.
302+
* Airflow DAG updates occur automatically by committing code to the repository.
298303

299-
// TODO: extend...
304+
This approach scales naturally across environments—development, staging, and production—while reducing manual operations, improving visibility,
305+
and enforcing consistency. By adopting GitOps with ArgoCD and Stackable, teams gain a clear, auditable, and automated path from code to production.
300306

301-
The last step is to demonstrate synchronizing changes made to manifests or secrets from the Git repository (to do this the demo is run on a forked GitHub repository).
307+
Next steps:
308+
* Explore multi-cluster ApplicationSet deployments to target multiple Kubernetes clusters.
309+
* Integrate CI workflows to automatically validate and merge manifest updates.
310+
* Expand beyond Airflow to manage additional Stackable components (e.g., Kafka, Trino, Superset).
311+
* Experiment with DataOps (e.g., Airflow and Trino)
302312

303313
[#interact-with-git-repository]
304314
== How to interact with ArgoCD, Airflow and the Git repository
305315

306316
Since this Demo is hosted in the {stackable-demo-repository}[Stackable Demo repository], where merging etc. requires approval, the recommendation is to fork the {stackable-demo-repository}[Stackable Demo repository].
317+
318+
=== Forking the demo repository
319+
307320
This {github-fork}[GitHub tutorial] shows how to fork a repository.
308321

322+
=== Cloning the demo repository
323+
324+
Clone the demo repository:
325+
326+
[source,console]
327+
----
328+
git clone https://github.com/<your-username>/demos.git
329+
cd demos
330+
----
331+
309332
After forking the demo repository, a local copy can be cloned and the `stackablectl` install command must be parameterized with the fork URL and branch.
310333

311334
[source,console]
312335
----
313336
stackablectl demo install argo-cd-git-ops --namespace argo-cd --parameters customGitUrl=<my-demo-fork-url> --parameters customGitBranch=<my-custom-branch-with-changes>
314337
----
315338

316-
In this forked and cloned repository, changes can be made the code and synced into the cluster via ArgoCD.
339+
=== Making changes to the repository
340+
341+
Edit manifests or add new DAG files within your cloned repository:
317342

318-
This way, ArgoCD is instructed to pull the Stackable manifests from the forked repository, where the changes are synced via ArgoCD into the cluster.
343+
* Manifests are in: `demos/argo-cd-git-ops/manifests/`
344+
* Airflow DAGs are in: `demos/argo-cd-git-ops/dags/`
319345

320-
=== Increase Airflow webserver replicas
346+
==== Increase Airflow webserver replicas
321347

322348
Assuming your working directory is the root of the forked demo repository, try to increase the `spec.webservers.roleGroups.<role-group>.replicas` in the folder `demos/argo-cd-git-ops/manifests/airflow/airflow.yaml`.
323349
Once this is pushed / merged, ArgoCD should sync the changes and you should see more webserver pods.
324350

325-
=== Add new Airflow DAGs
351+
==== Add new Airflow DAGs
326352

327353
In the `demos/argo-cd-git-ops/manifests/airflow/airflow.yaml` manifest you have to adapt the git-sync configuration for DAGs to the forked repository:
328354

329355
[source,yaml]
330356
----
331357
dagsGitSync:
332-
- repo: <my-demo-fork-url>
358+
- repo: https://github.com/<your-username>/demos/
333359
branch: <my-custom-branch-with-changes>
334360
[...]
335361
----
336362

337-
Similar to ArgoCD, after adding a new DAG to the folder `demos/argo-cd-git-ops/dags`, Airflow should pick up the new DAG via git-sync and display it in the UI.
363+
After adding a new DAG to the folder `demos/argo-cd-git-ops/dags/`, Airflow should pick up the new DAG via git-sync and display it in the UI.
364+
This may take a while for the syncing process. Refreshing the Airflow UI might help if no DAGs show up.
365+
366+
The synchronisation status of the DAGs can be monitored in via the Airflow scheduler:
367+
368+
[source,console]
369+
----
370+
kubectl logs -n stackable-airflow -c airflow -f svc/airflow-scheduler-default-headless
371+
----
372+
373+
which should show output the DAG processing stats:
374+
375+
[source,console]
376+
----
377+
================================================================================
378+
DAG File Processing Stats
379+
380+
File Path PID Runtime # DAGs # Errors Last Runtime Last Run Last # of DB Queries
381+
-------------------------------------------------------------------- ----- --------- -------- ---------- -------------- ---------- ----------------------
382+
/stackable/app/git-0/current/demos/argo-cd-git-ops/dags/date_demo.py 51 0.03s 0 0 0
383+
================================================================================
384+
[2025-08-06T15:32:23.182+0000] {kubernetes_executor_utils.py:95} INFO - Kubernetes watch timed out waiting for events. Restarting watch.
385+
[2025-08-06T15:32:23.345+0000] {manager.py:997} INFO -
386+
================================================================================
387+
----
388+
389+
==== Commit and push changes
390+
391+
[source,console]
392+
----
393+
git checkout -b <my-custom-branch-with-changes>
394+
git add .
395+
git commit -m "Update Airflow configuration and add new DAG"
396+
git push origin <my-custom-branch-with-changes>
397+
----
398+
399+
Now ArgoCD and Airflow should sync the respective changes into the cluster.

0 commit comments

Comments
 (0)