configmap-primitive

command
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

ConfigMap Primitive Example

This example demonstrates the usage of the configmap primitive within the operator component framework. It shows how to manage a Kubernetes ConfigMap as a component of a larger application, utilising features like:

  • Base Construction: Initializing a ConfigMap with basic metadata.
  • Feature Mutations: Composing YAML configuration from independent, feature-gated mutations using MergeYAML.
  • Metadata Mutations: Setting version labels on the ConfigMap via EditObjectMetadata.
  • Data Extraction: Harvesting ConfigMap entries after each reconcile cycle.

Directory Structure

  • app/: Defines the controller that uses the component framework. The ExampleApp CRD is shared from examples/shared/app.
  • features/: Contains modular feature definitions:
    • mutations.go: base config, version labelling, and feature-gated tracing and metrics sections.
  • resources/: Contains the central NewConfigMapResource factory that assembles all features using configmap.Builder.
  • main.go: A standalone entry point that demonstrates multiple reconciliation cycles with a fake client.

Running the Example

go run examples/configmap-primitive/main.go

This will:

  1. Initialize a fake Kubernetes client.
  2. Create an ExampleApp owner object.
  3. Reconcile through four spec variations, printing the composed app.yaml after each cycle.
  4. Print the resulting status conditions.

Documentation

Overview

Package main is the entry point for the configmap primitive example.

Directories

Path Synopsis
Package app provides a sample controller using the configmap primitive.
Package app provides a sample controller using the configmap primitive.
Package features provides sample mutations for the configmap primitive example.
Package features provides sample mutations for the configmap primitive example.
Package resources provides resource implementations for the configmap primitive example.
Package resources provides resource implementations for the configmap primitive example.

Jump to

Keyboard shortcuts

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