Module 2: GitOps — Deploy and Auto-Sync the National Parks Full Stack

Start here: Log in to OpenShift

Open the Showroom Terminal tab and authenticate using your assigned workshop credentials before running any other oc commands:

oc login --server=https://api.cluster-%GUID%.example.com:6443 --username=user-guid --password='password' --insecure-skip-tls-verify

Verify that oc whoami returns user-guid. This is a disposable lab environment: the + -p + option can expose your password in shell history and process listings. Do not reuse this password on a personal or production cluster.

In Module 1 you deployed National Parks through the OpenShift 5 console and used Lightspeed to troubleshoot MongoDB. Now deploy an independent, complete copy through Gitea + the GA OpenShift GitOps console plug-in, using Git as the source of truth.

The original application stays in user-guid-demo. The new ParksMap frontend, Python API and MongoDB 8 stack deploys into user-guid-gitops. You will watch OpenShift build the Python image, initialize MongoDB, load park data and automatically reconcile a Gitea commit.

Duration: approximately 45 minutes, after instructor preflight of storage, builds, GitOps permissions, images and student Gitea repositories.

Time Mission

5 min

Check your student identity and the two projects

7 min

Explore the full-stack source in your Gitea repository

10 min

Create the Auto-Sync Application in the OpenShift GitOps console

15 min

Watch GitOps build and deploy all three application tiers

8 min

Commit a change, verify Auto-Sync and inspect tenant boundaries

Before you begin
  • This module deploys the full National Parks stack. The old one-ConfigMap exercise is no longer the main lab.

  • The Argo CD instance, Application/national-parks-settings and the three GitOps workload tiers all live in user-guid-gitops. The original application and Gitea remain in user-guid-demo.

  • The privileged tenant bootstrap automatically creates user-guid-gitops in sync wave -1, before Argo CD (wave 0). Students only verify the project exists; no namespace creation or YAML import is required.

  • The root GitOps Kustomization in your student Gitea repository must include the fullstack directory. If it does not, stop and tell the instructor: an imported Gitea copy does not automatically follow upstream GitHub.

  • Auto-Sync and Self-Heal are enabled. Auto-prune is disabled. Don’t manually synchronize, delete resources, or edit GitOps-owned Deployments in the cluster.

  • MongoDB credentials are generated inside the namespace by a Job. Never place passwords in Gitea, screenshots or Lightspeed prompts. MongoDB uses a 1Gi PVC and correct port 27017, unlike the deliberate Module 1 fault.

What’s new in the OpenShift 5 experience?

Feature What you will do

OpenShift 5 console

Inspect Projects, Builds, Topology, Routes and workload status.

OpenShift GitOps 1.22 console plug-in (GA)

Use GitOps → Applications to create and monitor the entire deployment without the standalone Argo CD interface.

Automated Argo CD reconciliation

Observe Git changes updating Kubernetes with no manual sync. Auto-Sync is an existing GitOps capability, not a feature introduced by OpenShift 5.

Lightspeed / MCP

Ask read-only questions about actual resources and inspect tool evidence before trusting an explanation.

The S01–S12 images below are labelled screenshot placeholders, not evidence from a live cluster. The instructor will replace them with screenshots of this full-stack Auto-Sync workflow. Students do not need to capture or upload images.

Mission 1: Verify your GitOps environment (5 minutes)

  1. In the Showroom OCP Console tab, sign in as user-guid. Open Projects and confirm you can find user-guid-demo and user-guid-gitops. Both projects are automatically provisioned. The first hosts your original National Parks workloads and Gitea; the second hosts Argo CD, its Application and the complete GitOps stack. If either project is absent, stop and ask the instructor to check the privileged tenant bootstrap rather than creating a project manually.

  2. In Showroom’s Terminal tab, verify the student login completed at the start of the module:

    oc whoami
    oc version
    export LAB_NAMESPACE=user-guid-demo
    export GITOPS_NAMESPACE=user-guid-gitops
    export ARGOCD_APP=national-parks-settings
    oc get namespace "$GITOPS_NAMESPACE"
    oc get applications.argoproj.io -n "$GITOPS_NAMESPACE"

    The login at the beginning of this module uses a disposable lab password. Expected identity: user-guid. The Application may not exist yet, or may already exist from a prior exercise.

S01: student identity and separate -demo/-gitops namespaces - screenshot placeholder
  1. Open OpenShift Lightspeed → Troubleshooting and ask:

    Use live read-only Kubernetes tools to inspect namespaces
    user-guid-demo and user-guid-gitops. Report the existing Argo CD
    instance, national-parks-settings Application if present, and
    National Parks Deployments currently in the GitOps destination.
    
    Report actual tool evidence. Do not read Secrets or change anything.

    Expand the MCP tool calls and compare names and namespaces with the Terminal. If Lightspeed cannot read Argo CD custom resources, use oc get applications.argoproj.io instead of relying on an invented result.

S02: Lightspeed read-only MCP evidence from both student namespaces - screenshot placeholder

Checkpoint 1: You have verified your identity and confirmed that Argo CD, its Application and the GitOps workloads can all live in the pre-provisioned {user}-gitops project.

Mission 2: Explore the complete GitOps source in Gitea (7 minutes)

Each student has an editable Gitea copy of the workshop source. It is not a live GitHub mirror, so the instructor must have synchronized the up-to-date full-stack files before this class.

  1. Open Showroom’s Gitea tab. Log in with your assigned Gitea account and open its pre-provisioned openshift-5-container repository on branch main. Gitea credentials may differ from OpenShift credentials.

  2. Open content/modules/ROOT/examples/module02-gitops/kustomization.yaml. It must contain:

    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    resources:
      - fullstack

    This root directory is the main GitOps source. If you see only national-parks-gitops-info.yaml in the resources list, the repository is stale. Stop and notify the instructor; do not deploy the outdated exercise.

  3. Open fullstack/kustomization.yaml and confirm it lists all seven resources:

    fullstack/
      kustomization.yaml
      national-parks-gitops-info.yaml
      00-mongodb-credentials.yaml
      01-mongodb.yaml
      02-nationalparks-backend.yaml
      03-parksmap-discovery.yaml
      04-parksmap-frontend.yaml
      05-park-data-bootstrap.yaml
    S03: root Kustomization and fullstack manifests in student Gitea - screenshot placeholder
  4. Explore the files to identify what each one deploys:

    File Responsibility

    00-mongodb-credentials.yaml

    Namespace-scoped bootstrap ServiceAccount/RBAC and Job creating a MongoDB Secret without storing passwords in Git

    01-mongodb.yaml

    MongoDB 8 Deployment, Service, bootstrap ConfigMap and persistent volume claim

    02-nationalparks-backend.yaml

    Python Dockerfile BuildConfig, ImageStream, Deployment, Service and HTTPS Route

    03-parksmap-discovery.yaml

    Dedicated read-only ServiceAccount and RBAC for backend discovery

    04-parksmap-frontend.yaml

    ParksMap Deployment, Service and HTTPS Route

    05-park-data-bootstrap.yaml

    PostSync Job that loads park records only if the database is empty

    national-parks-gitops-info.yaml

    A Git-managed ConfigMap used to observe Auto-Sync later

  5. Copy the repository’s HTTPS Clone URL. Do not use the public GitHub URL as your student’s GitOps source.

Checkpoint 2: You can identify the files for every tier and show that the root Kustomization deploys the full stack.

Mission 3: Create the Auto-Sync Application through the console (10 minutes)

  1. Open OCP Console → GitOps → Applications and set the Project selector to user-guid-gitops, where the Argo CD instance now runs. Confirm the controller is ready before continuing.

  2. Select Create Application. If national-parks-settings already exists in user-guid-gitops, inspect it instead of creating a duplicate. If it exists in user-guid-demo, stop and ask your instructor to migrate the legacy setup; two Applications must not manage the same workloads. For a fresh lab, paste the entire YAML below:

    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: national-parks-settings
      namespace: "user-guid-gitops"
    spec:
      project: default
      source:
        repoURL: "https://gitea-user-guid-demo.apps.cluster-%GUID%.example.com/user-guid/openshift-5-container.git"
        targetRevision: main
        path: content/modules/ROOT/examples/module02-gitops
      destination:
        server: https://kubernetes.default.svc
        namespace: "user-guid-gitops"
      ignoreDifferences:
        - group: apps
          kind: Deployment
          name: nationalparks
          jsonPointers:
            - /spec/template/spec/containers/0/image
      syncPolicy:
        automated:
          enabled: true
          prune: false
          selfHeal: true
        syncOptions:
          - RespectIgnoreDifferences=true
        retry:
          limit: 5
          backoff:
            duration: 10s
            factor: 2
            maxDuration: 2m

    The Gitea URL must match your own student repository. The root Kustomization already includes the full stack, so do not change the source path to a one-ConfigMap file. The narrow ignoreDifferences exception allows the OpenShift ImageStream trigger to replace the Python backend image without Argo CD undoing that update.

S04: native console Create Application YAML including full-stack Auto-Sync - screenshot placeholder
  1. Save or Create. Open GitOps → Applications → national-parks-settings. Explore Details, Sources and Resources (including the graphical view if available). You should see the MongoDB, backend, frontend and support objects. During startup, OutOfSync, Missing or Progressing can appear temporarily. Do not click manual Sync; automatic reconciliation is enabled.

S05: initial GitOps full-stack resource tree during automated reconciliation - screenshot placeholder
A healthy, synced ConfigMap-only Application is NOT the full-stack lab

If national-parks-settings shows Healthy and Synced, but the resource tree contains only national-parks-gitops-info (one ConfigMap), you are still running the legacy exercise. Do not accept the green status as success, and do not click Sync.

Go back to Gitea and verify that main has content/modules/ROOT/examples/module02-gitops/kustomization.yaml pointing to fullstack, plus all seven manifests in fullstack/. If the student repository is stale, stop and ask the instructor to synchronize it. Changing upstream GitHub alone does not update your imported Gitea copy.

Predict: Where does the Application CR live, and where do its Deployments go?

Details

Answer: Both metadata.namespace and spec.destination.namespace are user-guid-gitops. The Argo CD instance, Application and Deployments all live there; Module 1 and Gitea remain in user-guid-demo.

  1. Verify policy and destination using the Terminal:

    oc get applications.argoproj.io "$ARGOCD_APP" -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.spec.source.path}{"\n"}{.spec.destination.namespace}{"\n"}{.spec.syncPolicy.automated}{"\n"}'

    Expected: root module02-gitops source path, user-guid-gitops target, and enabled=true, prune=false, selfHeal=true.

Checkpoint 3: Your GitOps Application references the full-stack root Kustomization with Auto-Sync enabled. A Healthy/Synced ConfigMap-only tree does not pass this checkpoint. After reconciliation, the resource tree must include MongoDB, nationalparks and ParksMap Deployments. If those objects never appear, return to Mission 2 and check the Gitea source instead of treating the green status as evidence of a complete deployment.

Mission 4: Watch GitOps deploy all three tiers (15 minutes)

GitOps uses sync-wave ordering: create credentials and namespace-scoped permissions, prepare database storage, deploy MongoDB and the Python image build, then deploy the running Python API and ParksMap. A PostSync Job loads sample data when the application is healthy.

  1. Watch the resource tree in GitOps → Applications. In the Terminal, list the new resources:

    oc get jobs,pvc,buildconfigs,imagestreams -n "$GITOPS_NAMESPACE"
    oc get deployments,services,routes -n "$GITOPS_NAMESPACE"
    oc get secret nationalparks-mongodb-parameters -n "$GITOPS_NAMESPACE" -o name
    Kind Expected names

    Deployments

    parksmap, nationalparks, mongodb-nationalparks

    Services

    parksmap, nationalparks, mongodb-nationalparks

    HTTPS Routes

    parksmap, national-parks-app

    BuildConfig / ImageStream

    nationalparks

    PVC

    mongodb-nationalparks-data (Bound)

    Secret

    nationalparks-mongodb-parameters (name only)

    Jobs

    credentials bootstrap and guarded park-data loader

S06: GitOps full-stack resources and three application tiers - screenshot placeholder
  1. Open Builds → Builds for project user-guid-gitops. Inspect nationalparks-1 (or the latest nationalparks build). It builds the Python source from Git using its Dockerfile and pushes to the nationalparks:latest ImageStreamTag. Verify:

    oc get builds -n "$GITOPS_NAMESPACE"
    oc get imagestreamtag nationalparks:latest -n "$GITOPS_NAMESPACE"
    oc get deployment nationalparks -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'

    A short ImagePullBackOff can occur before the first image build completes. The OpenShift image trigger updates the Deployment after a successful build; the Application’s RespectIgnoreDifferences setting avoids a self-heal conflict.

S07: OpenShift Python Build Complete and ImageStreamTag - screenshot placeholder
  1. Confirm the MongoDB Service uses 27017, not the deliberately broken 27018 from Module 1. The new database uses a PVC and generated credentials. Check the Deployments:

    oc get pvc mongodb-nationalparks-data -n "$GITOPS_NAMESPACE"
    oc get svc mongodb-nationalparks -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.spec.ports[0].port}{" -> "}{.spec.ports[0].targetPort}{"\n"}'
    
    for workload in mongodb-nationalparks nationalparks parksmap; do
      oc rollout status "deployment/$workload" -n "$GITOPS_NAMESPACE" --timeout=180s
    done

    Don’t inspect Secret contents or commit passwords. The backend and MongoDB both reference the namespace-local Secret.

S08: PVC Bound
  1. The PostSync Job checks the collection before loading records. Find the two Route hosts and check real park data:

    API_HOST=$(oc get route national-parks-app -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.spec.host}')
    MAP_HOST=$(oc get route parksmap -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.spec.host}')
    
    printf 'ParksMap: https://%s\n' "$MAP_HOST"
    printf 'Park data: https://%s/ws/data/all\n' "$API_HOST"
    
    curl -fsS "https://$API_HOST/ws/data/all" | head -c 300
    printf '\n'

    The dataset should be nonempty and ParksMap should display park markers. The API’s /ws/healthz/ check alone does not verify MongoDB. The /ws/data/load endpoint deletes and reloads the collection; do not call it manually as a routine health check.

S09: full-stack GitOps status

Predict: Why is automatically calling /ws/data/load on every health check a bad idea?

Details

Answer: That endpoint deletes and reloads all park records. The PostSync loader checks whether the collection is empty first. This dataset is disposable workshop data, not a production database.

Checkpoint 4: The build completed, the database PVC is bound, all three Deployments are ready, and your separate ParksMap Route shows parks.

Small two-namespace footprint: The three always-running Module 2 containers together request only 200m CPU and 512Mi memory, with combined limits of 1150m CPU and 1920Mi memory. The temporary build and two helper Jobs have separate, small limits. These settings help the shared tenant quota cover the original Module 1 application in {user}-demo and the independent GitOps stack in {user}-gitops. The Java frontend’s memory cap is deliberately 768Mi (rather than 512Mi) and its JVM heap is explicitly limited to avoid an out-of-memory restart. Keep resource changes in Gitea; do not patch GitOps-managed Deployments directly.

Mission 5: Commit to Gitea and prove Auto-Sync (8 minutes)

  1. In your Gitea repository edit content/modules/ROOT/examples/module02-gitops/fullstack/national-parks-gitops-info.yaml. Change just the message:

    data:
      message: "Updated through GitOps Auto-Sync"

    Commit the change to the same main branch tracked by Argo CD. Don’t edit the older single-ConfigMap file in the parent module02-gitops directory; the root Kustomization deploys fullstack/.

S10: Gitea committed change to the full-stack ConfigMap source - screenshot placeholder
  1. Return to OCP Console → GitOps → Applications → national-parks-settings in project user-guid-gitops. Wait for automatic reconciliation. It may briefly become OutOfSync, or quickly return to Synced. Do not click Sync or modify the ConfigMap in Kubernetes.

  2. Verify the value in your deployment namespace:

    oc get configmap national-parks-gitops-info \
      -n "$GITOPS_NAMESPACE" \
      -o jsonpath='{.data.message}{"\n"}'

    Expected: Updated through GitOps Auto-Sync.

  3. Ask Lightspeed in Troubleshooting:

    Use live read-only Kubernetes tools to inspect the three
    National Parks Deployments and ConfigMap national-parks-gitops-info
    in user-guid-gitops, and the Application national-parks-settings
    in user-guid-gitops if the CRD is available.
    
    Verify the live ConfigMap message, explain Auto-Sync and
    Self-Heal, and identify any unavailable tools. Do not read
    Secrets or change anything.

    Compare the tool results with the Git commit, Application status and Terminal. Lightspeed might not have permission to read Application CRs or Git commits.

S11: GitOps Synced status and updated live ConfigMap message - screenshot placeholder

Predict: Do you have to click Sync after committing a change?

Details

Answer: No. Auto-Sync detects changes in Git and reconciles them automatically. Self-Heal can correct Kubernetes drift in GitOps-owned resources, and prune=false prevents automatic removal of resources deleted from Git.

  1. Check your tenant boundary and verify Module 1 still runs:

    oc auth can-i get configmaps -n "$GITOPS_NAMESPACE"
    oc auth can-i patch deployments.apps -n openshift-config
    oc get deployments parksmap nationalparks mongodb-nationalparks -n "$GITOPS_NAMESPACE"
    oc get deployments parksmap nationalparks mongodb-nationalparks -n "$LAB_NAMESPACE"

    Kubernetes RBAC, not the AI prompt, controls your actual permissions. The two stacks are independent; open your original Module 1 map to confirm it still works.

S12: student RBAC and separate healthy application deployments - screenshot placeholder

Checkpoint 5: You changed Git, not Kubernetes. Auto-Sync applied that change while the complete app and the Module 1 environment stayed intact.

Mission complete

You created an entire ParksMap + Python API + MongoDB 8 stack with a single GitOps Application and proved that a Gitea commit automatically updates the cluster.

Check Expected

Argo CD Application

national-parks-settings in user-guid-gitops

Source

Student Gitea main, content/modules/ROOT/examples/module02-gitops

Destination

user-guid-gitops

Sync policy

Auto-Sync ON, Self-Heal ON, auto-prune OFF

Build

Python BuildConfig successful and ImageStreamTag published

Workloads

MongoDB, Python API, ParksMap ready

Database

MongoDB PVC Bound, Service port 27017, dataset loaded

Routes

ParksMap and Python API HTTPS Routes are available

Git change

ConfigMap message updated automatically

Isolation

Original Module 1 deployment still works in user-guid-demo

Troubleshooting

Symptom Check

GitOps menu missing

Instructor validates GA GitOps console plug-in before class

Gitea fullstack/ missing or root Kustomization is stale

Instructor reconciles each student’s imported Gitea copy; upstream GitHub merges do not update student copies automatically

Application missing

Select project user-guid-gitops; verify the instance and student Application-editor RoleBinding; the destination is also user-guid-gitops

Repository connection failed

Check exact student HTTPS clone URL, access and TLS trust

Sync Forbidden

Instructor checks same-namespace Argo CD controller readiness and the Application-editor RoleBinding, not a cross-namespace management label

Credentials bootstrap failed

If events report must specify limits.cpu, the student Gitea copy is stale: the credentials Job must declare an explicit CPU limit. Ask the instructor to update the source and recover the timed-out Job; never print Secret values

CPU/Memory quota rejected Pods

All three Deployments, both Jobs and the Python BuildConfig require explicit CPU and memory requests/limits. Instructor checks the shared tenant-user-guid ClusterResourceQuota for both -demo and -gitops projects.

PVC Pending with WaitForFirstConsumer

The PVC waits for a MongoDB Pod before binding. The MongoDB Deployment and PVC must be in the same GitOps sync wave 0; if the Deployment has not been created, ask the instructor to update the student Gitea manifests and check Application sync history. Do not delete the PVC.

PVC Pending for other reasons

Instructor checks StorageClass provisioning, quota and Pod scheduling events

ParksMap CrashLoopBackOff with EndpointWatcher.getEndpointsAddressSize NullPointerException

The national-parks-app Route must not have type: parksmap-backend, because it has no same-named Endpoints object. The nationalparks Service must carry that label, and ParksMap must start in GitOps sync wave 2 after the backend Deployment in wave 1. Check oc logs deployment/parksmap --previous and ask the instructor to update the student Gitea source. If a previous sync is still running, terminate that stale operation before letting Auto-Sync resume.

ParksMap OOMKilled or repeatedly restarts

The older Java frontend needs a 768Mi container limit and a capped Java heap (JAVA_TOOL_OPTIONS -Xmx256m). An old 512Mi image configuration can be OOMKilled. Check the student Gitea main manifests, oc describe pod and previous container logs, then ask the instructor to verify available shared quota.

Backend ImagePullBackOff

Check Python BuildConfig, Build logs, ImageStreamTag and image-trigger annotation

Database unavailable

Verify MongoDB readiness, Secret presence and Service port 27017

Empty park list

Check PostSync data-loader Job and MongoDB; avoid repeatedly calling /ws/data/load

ConfigMap didn’t change after commit

Verify Gitea main, Application source path, Auto-Sync settings and controller events

Lightspeed can’t read Application

Use oc get applications.argoproj.io and the GitOps console as evidence