custom-resource

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

Custom Resource

This example demonstrates how to manage a custom resource (CRD) that has no typed primitive in the framework, using the unstructured static builder.

What it shows

  • Unstructured builder: unstructured/static.NewBuilder wraps an *unstructured.Unstructured object, giving it the same mutation and extraction capabilities as any typed primitive.
  • Content mutations: EditContent with UnstructuredContentEditor sets nested spec fields (issuerRef, dnsNames) using structured helpers rather than raw map manipulation.
  • Metadata mutations: EditObjectMetadata works the same way as on typed primitives.
  • Data extraction: WithDataExtractor reads fields from the reconciled unstructured object.

Use case

When your operator needs to manage a third-party CRD (cert-manager Certificate, Istio VirtualService, etc.) that has no typed primitive wrapper in the framework, the unstructured builder is the escape hatch. You get the same reconciliation, mutation, and extraction patterns without writing a full typed primitive.

Reconciliation steps

  1. Create the CertificateRequest with DNS names and issuer reference.
  2. Steady-state reconciliation.

Running

go run ./examples/custom-resource/.

Documentation

Overview

Package main demonstrates managing a custom resource using the unstructured static builder.

When a CRD has no typed primitive in the framework (e.g., a third-party CertificateRequest), the unstructured builder lets you manage it with the same mutation and extraction patterns as any built-in primitive.

Directories

Path Synopsis
Package app provides a sample controller demonstrating custom resource management via the unstructured static builder.
Package app provides a sample controller demonstrating custom resource management via the unstructured static builder.
Package resources provides resource factories for the custom-resource example.
Package resources provides resource factories for the custom-resource example.

Jump to

Keyboard shortcuts

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