Skip to content

GitOps Guide

This guide shows you how Timoni can be used together with Flux to create a GitOps delivery pipeline for module instances.

flowchart LR

A((User)) --> Y
Y(Module Values) --> B((Timoni))
B --> D[Container Registry]
D --> E((Flux CD))
E --> F[Kubernetes]

Timoni Controller

Note that currently Timoni can be used with Flux as a templating engine for Kubernetes manifests. Features like app lifecycle management, bundling, runtime values injection and multi-cluster deployments are not available when using Timoni as a templating engine. For Timoni to fully embrace GitOps, a Kubernetes controller will be implemented when Timoni's CUE APIs reach a more stable form.

Build and Push workflow

We'll build a module instance with Timoni, and we'll push the resulting Kubernetes manifests to a container registry with Flux CLI.

timoni -n apps build podinfo oci:// \
  --values ./staging-values.cue | \
flux push artifact oci://registry.internal/podinfo:staging \
  --source="" \
  --revision="6.3.4" \

The above commands could be run in CI for the Git repository that contains the values files. Committing a change to the values, will result in a new artifact pushed to the registry. From there, Flux running in Kubernetes, will pick up the latest changes and deploy them on the cluster.

Continuous Delivery workflow

In the Git repository where Flux was bootstrapped, we'll configure the reconciliation of the Kubernetes resources pushed to the container registry.

kind: OCIRepository
  name: podinfo
  namespace: flux-system
  interval: 1m
  url: oci://registry.internal/podinfo
    tag: staging
kind: Kustomization
  name: podinfo
  namespace: flux-system
  targetNamespace: apps
  interval: 1h
  retryInterval: 30s
  timeout: 5m
  path: ./
  prune: true
  wait: true
    kind: OCIRepository
    name: podinfo

Based on the above configuration, Flux will look for changes in the container registry every minute. When it finds a new digest of the OCI artifact, Flux will automatically reconcile the changes on the cluster.

To find out more about Flux OCI support please see the Flux OCI docs.