Sync an IaCStack from Git

Use Argo CD to deliver a stack manifest and see how the controller reconciles a Git change.

This optional exercise takes the Kind quickstart one step further. Instead of applying a stack with kubectl, you’ll commit its declaration and let Argo CD deliver it. It creates a separate ConfigMap and keeps hello-stack untouched.

Argo CD syncs the manifest. IaC Stack Controller sees the change in Kubernetes and starts an attempt. Argo Workflows runs the registered pipeline. They are separate systems: a synced manifest does not mean the infrastructure change has completed.

1. Put a stack declaration in your repository

Use a disposable Kind cluster where the quickstart works and Argo CD is already installed. You need an authorized sandbox repository and an Argo CD project permitted to read it and sync an IaCStack into platform-system. If you don’t have Argo CD, see its getting started guide. Argo CD is not needed to run the other labs.

Save this as stacks/gitops-hello.yaml in your sandbox Git repository. Commit it to the branch you will sync. Don’t apply this file with kubectl.

apiVersion: iacstack.io/v1alpha1
kind: IaCStack
metadata:
  name: gitops-hello
  namespace: platform-system
spec:
  sourceRef:
    repository: https://github.com/iacstack/iac-stack-controller.git
    path: website/static/examples/quickstart/module
    version: main
  workflowRef:
    name: direct
  inputs:
    message: Hello from Git
  lifecycle:
    deletionPolicy: Retain

The application repository contains the declaration above. sourceRef points to the module the existing lab runner will execute. They can be different repositories, as they are here.

2. Sync from Git and observe the run

In Argo CD, create an Application from the settings below. Replace the repository URL and branch with yours. Select your authorized project and the same Kind cluster. Use manual sync, with pruning off; this example syncs just one stack.

Application settingLab value
Nameiacstack-gitops-lab
ProjectYour authorized sandbox project
Repository URL and revisionYour declaration repository and the branch you committed to
Pathstacks
DestinationThe quickstart Kind cluster, namespace platform-system

See the Argo CD Application reference for the equivalent fields in YAML.

In the Argo CD UI, review the diff and sync. In the same Kubernetes context, watch the stack until its attempt is ready and record the Workflow name:

kubectl -n platform-system get iacstack gitops-hello -w
# Stop the watch with Ctrl+C when the attempt is ready.
kubectl -n platform-system get iacstack gitops-hello \
  -o jsonpath='{.status.execution.workflow}{"\n"}'
kubectl -n iacstack-quickstart get configmap gitops-hello \
  -o jsonpath='{.data.message}{"\n"}'

Expect a Workflow name and Hello from Git. If Argo CD is synced but the resource is missing, check the stack and follow its Workflow.

3. Reconcile a second commit

Change only spec.inputs.message to Updated from Git, commit it to the same branch, refresh the Application and sync again. Repeat the checks above. Expect a different Workflow name and the ConfigMap message Updated from Git. Git changed the declaration; the controller coordinated a new execution of the same pipeline.

This exercise uses the direct alias in a disposable cluster. A Git merge or an Argo CD sync does not replace approval of a Terraform plan in a workflow that requires it. See where GitOps fits.

For cleanup, remove only this lab Application without cascading deletion. Delete the disposable cluster when done with the Kind labs. In a shared setup, removing an Application or pruning a stack is not a general-purpose Terraform teardown; review the stack’s lifecycle policy first.