pv-primitive

command
v0.2.0 Latest Latest
Warning

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

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

README

PersistentVolume Primitive Example

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

  • Base Construction: Initializing a cluster-scoped PersistentVolume with storage configuration.
  • Feature Mutations: Applying feature-gated changes to reclaim policy, mount options, and metadata.
  • Field Flavors: Preserving annotations managed by external controllers using PreserveCurrentAnnotations.
  • Result Inspection: Printing PV configuration 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: version labelling, boolean-gated retain policy, and mount options mutations.
  • resources/: Contains the central NewPVResource factory that assembles all features using pv.Builder.
  • main.go: A standalone entry point that demonstrates in-memory mutation across multiple spec variations.

Running the Example

go run examples/pv-primitive/main.go

This will:

  1. Create an ExampleApp owner object.
  2. Apply mutations across four spec variations, printing the resulting PV YAML after each cycle.
  3. Print operational status examples for each PV phase.

Documentation

Overview

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

Directories

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

Jump to

Keyboard shortcuts

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