extraction-and-guards

command
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

Data Extraction and Guards

This example demonstrates how to use data extraction from one resource to feed a guard on a subsequent resource within the same component.

What it shows

  • Data extraction: The ConfigMap resource registers a WithDataExtractor that captures the db-host value into a shared pointer after reconciliation.
  • Guard: The Secret resource registers a WithGuard that checks whether the extracted db-host is non-empty. If it is empty, the guard returns Blocked and the Secret (and any resources registered after it) are skipped.
  • Registration order matters: The ConfigMap is registered before the Secret. Guards can only read data extracted by preceding resources.

Reconciliation steps

  1. Normal reconciliation: the ConfigMap is created, db-host is extracted, the guard unblocks, and the Secret is created.
  2. Steady-state: both resources reconcile normally.

Running

go run ./examples/extraction-and-guards/.

Documentation

Overview

Package main demonstrates data extraction and guard-based resource ordering.

A single component manages a ConfigMap and a Secret. The ConfigMap's data extractor captures a value that the Secret's guard checks before allowing reconciliation to proceed.

Directories

Path Synopsis
Package app provides a sample controller demonstrating data extraction and guards.
Package app provides a sample controller demonstrating data extraction and guards.
Package resources provides resource factories for the extraction-and-guards example.
Package resources provides resource factories for the extraction-and-guards example.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL