cmharden / cue-flux-controller

A Kubernetes controller for CUE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cue-controller

report license release

The cue-controller is an experimental Kubernetes controller for the CUE language. It integrates with Flux using the GitOps Toolkit and enables building GitOps pipelines directly in CUE.

The cue-controller is heavily based on the codebase for kustomize-controller and will aim for feature parity insofar as it makes sense to do so.

Development Roadmap: Phase 1

  • Build CUE instances from a source repository
  • Specify the CUE working directory and module root
  • Specify the CUE expression(s) from which the instance will build
  • Set CUE tags and tag variables for the instance
  • Specify module root, package and directory variables for CUE instance
  • Apply manifests from a CUE instance
  • Impersonation via ServiceAccount
  • Remote cluster access via kubeconfig
  • Prune Kubernetes resources removed from the CUE source
  • Support for non-CUE files
  • Policy-mode (use CUE only for schema validation, with configurable failure modes)
  • Validation failure notifications (via notification controller)
  • Health checks for deployed workloads
  • Dependency ordering using dependsOn
  • Support for decrypting secrets with Mozilla SOPS
  • (TBD: Support for CUE tooling or workflows...)

Usage

The cue-controller requires that you already have the GitOps toolkit controllers installed in your cluster. Visit https://fluxcd.io/docs/get-started/ for information on getting started if you are new to flux.

Installation

Install the CRDs:

make install

Deploy the controller:

make deploy

Define a Git repository source

Create a source object that points to a Git repository containing Kubernetes and Kustomize manifests:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: cuedemo
  namespace: default
spec:
  interval: 5m
  url: https://github.com/phoban01/cuedemo
  ref:
    branch: main

Define a CueInstance

Create a CueInstance resource that references the GitRepository source previously defined.

apiVersion: cue.contrib.flux.io/v1alpha1
kind: CueInstance
metadata:
  name: podinfo-dev
  namespace: default
spec:
  interval: 5m
  root: "./examples/podinfo"
  expressions:
  - out
  prune: true
  sourceRef:
    kind: GitRepository
    name: cuedemo

About

A Kubernetes controller for CUE


Languages

Language:Go 88.7%Language:Makefile 5.5%Language:Smarty 5.0%Language:Dockerfile 0.8%