Skip to content

Creates GitOps tutorial Lesson 2: Promoting from Stage to Production - #20

Open
alexcreasy wants to merge 2 commits into
streamshub:lesson-1from
alexcreasy:lesson-2
Open

Creates GitOps tutorial Lesson 2: Promoting from Stage to Production#20
alexcreasy wants to merge 2 commits into
streamshub:lesson-1from
alexcreasy:lesson-2

Conversation

@alexcreasy

@alexcreasy alexcreasy commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

NOTE: This PR is SECOND in a stack of 3 PRs and must be merged in order:

This adds the interactive content for the second lesson for the GitOps tutorial series.

To run:
Checkout the README.md in the lessons/ directory which will point you to instructions to setup the infrastructure and then to the first lesson.

Note: the documentation is to give an idea of how the lesson will go. In a later PR the prose will be re-written to improve the flow, make them more engaging and better elaborate on the lessons as required.

…tion

Signed-off-by: Alex Creasy <alex@creasy.dev>
Signed-off-by: Alex Creasy <alex@creasy.dev>
@alexcreasy
alexcreasy requested a review from tomncooper July 29, 2026 16:53
info "Creating ArgoCD applications for staging and production..."

kubectl apply -f - <<EOF
apiVersion: argoproj.io/v1alpha1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why both apps are defined inside shell script?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll move them out into separate yaml files.

thanks!

@tomncooper tomncooper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I tested the README instructions on KIND (podman) running on my Fedora 44 box.

I had a few comments, as well as some carried over from my lesson 1 review.


---

## Prerequisites

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said before, this should only show the delta compared to the requirements in the 00-setup list.


## Background: Why environments matter

In Lesson 1 you made a single change and watched it reach the cluster automatically. In practice, organisations don't push changes directly to production — they promote changes through a chain of environments: developers push to **staging** first, validate the change, then promote to **production**.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In Lesson 1 you made a single change and watched it reach the cluster automatically. In practice, organisations don't push changes directly to production — they promote changes through a chain of environments: developers push to **staging** first, validate the change, then promote to **production**.
In Lesson 1 you made a single change in the configuration hosted in the git repository and watched it be applied to the the cluster automatically. In practice, organisations don't push changes directly to production — they promote changes through a chain of environments: developers push to **staging** first, validate the change, then promote to **production**.


In Lesson 1 you made a single change and watched it reach the cluster automatically. In practice, organisations don't push changes directly to production — they promote changes through a chain of environments: developers push to **staging** first, validate the change, then promote to **production**.

The key insight: promotion in a GitOps world is not a deploy command. It is a Git change. You describe what each environment should look like in Git, and ArgoCD continuously reconciles each environment to match its description. Promoting a change means updating the description for the target environment and pushing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The key insight: promotion in a GitOps world is not a deploy command. It is a Git change. You describe what each environment should look like in Git, and ArgoCD continuously reconciles each environment to match its description. Promoting a change means updating the description for the target environment and pushing.
The key insight: promotion from one environment to another, in a GitOps world, is not a deploy command. It is a change in a git repository. You describe what each environment should look like in the configuration in the repo and ArgoCD continuously reconciles each environment to match its description. Promoting a change means updating the description for the target environment and pushing.


The key insight: promotion in a GitOps world is not a deploy command. It is a Git change. You describe what each environment should look like in Git, and ArgoCD continuously reconciles each environment to match its description. Promoting a change means updating the description for the target environment and pushing.

**Kustomize overlays** are the standard mechanism for this. You keep a shared base configuration and then have one overlay per environment that references the base and adds or patches environment-specific resources. ArgoCD points a separate Application at each overlay.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Kustomize overlays** are the standard mechanism for this. You keep a shared base configuration and then have one overlay per environment that references the base and adds or patches environment-specific resources. ArgoCD points a separate Application at each overlay.
**Kustomize overlays** are the kubernetes-native mechanism for managing configurations. You keep a shared base configuration and then have one overlay per environment that references the base and adds or patches environment-specific resources. ArgoCD points a separate Application at each overlay.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you described what an ArgoCD Application is? I wonder if we need more description of the generic CD process and then a brief description of how ArgoCD specific things like Applications map onto that?

- Adds its own `namespace.yaml` (to create the `kafka-staging` namespace)
- Adds `topic.yaml` (the Kafka topic)

The ArgoCD `kafka-staging` Application points to this directory. When kustomize renders it, ArgoCD gets the full set of resources: namespace, Kafka cluster, KafkaNodePool, and topic — all in the `kafka-staging` namespace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be useful to tell the reader they can render the full overlay themselves if they want to see kustomize in action:

kubectl kustomize manifests/overlay/staging

git push
└─▶ Gitea receives the commit

ArgoCD polls Gitea every 3 minutes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reduce this, I had to wait for (what seemed like) a very long time for something to happen once I pushed the change. For such a small demo, could it be 1 min or event 30 seconds?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thoughts are we just give the user the command to force a reconciliation immediately - it's listed down the end as an "optional" step right now, but you won't see it unless you are actively looking for it.

I'll see if I can reduce the interval as well, but having text along the lines of "Normally your changes would be applied after $INTERVAL, but to save waiting, run this command to apply the change instantly" ?

#!/usr/bin/env bash
set -euo pipefail

CLUSTER_NAME="gitops-tutorial"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said before lets put all these constants in a common script


# ─── Step 1: Validate infrastructure ──────────────────────────────────────────

info "Validating tutorial infrastructure..."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be function in a common module

info "Cleaning up previous lesson state..."

# Remove the lesson-1 ArgoCD Application (no cascade finalizer, so this is instant).
kubectl delete application kafka-tutorial -n argocd --ignore-not-found 2>/dev/null || true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The application name and namespaces in these commands should be variables, again probably in a common script file

done

kubectl set env deployment/strimzi-cluster-operator -n strimzi-operator \
STRIMZI_NAMESPACE='kafka-staging,kafka-production'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just have strimzi watch all namespaces cluster-wide?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have strimzi watch all namespaces cluster wide when these are the only namespaces the tutorial will use?

Not being facetious, genuinely curious what that achieves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants