renderer

package
v1.30.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 34 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package renderer simulates the Datadog Operator's reconciliation loop offline. Given a DatadogAgent (and optional DatadogAgentProfiles), Render returns the complete set of Kubernetes resources the operator would create — without needing a running cluster. Useful for golden-file regression tests and the operator-render CLI.

Index

Constants

View Source
const DefaultKubernetesVersion = "v1.28.0"

DefaultKubernetesVersion is the simulated server version used when Options.KubernetesVersion is empty (>= 1.22, matching a modern cluster).

Variables

This section is empty.

Functions

func BuildScheme

func BuildScheme() *runtime.Scheme

BuildScheme returns a runtime.Scheme registered with all the API groups the operator's reconcilers and resource builders need.

func LoadDAPs

func LoadDAPs(paths []string) ([]*datadoghqv1alpha1.DatadogAgentProfile, error)

LoadDAPs reads DatadogAgentProfile YAML manifests from disk.

func LoadDDA

func LoadDDA(path string) (*datadoghqv2alpha1.DatadogAgent, error)

LoadDDA reads a DatadogAgent YAML manifest from disk.

func Render

func Render(opts Options) ([]client.Object, *runtime.Scheme, error)

Render runs the operator reconcilers against the provided DDA and DAPs using a fake client, and returns all Kubernetes resources the operator would create. The returned scheme can be used to restore GVK on the collected objects (for serialization).

func Serialize

func Serialize(objects []client.Object, scheme *runtime.Scheme, format string, keepStatus bool) ([]byte, error)

Serialize converts resources to YAML or JSON with consistent, sorted key ordering. Key ordering is guaranteed because we round-trip through map[string]interface{} first; encoding/json sorts map keys alphabetically, and sigs.k8s.io/yaml converts via JSON. Supported formats: "yaml" (default), "json". When keepStatus is true, the status field is preserved for datadoghq.com resources (DDA, DDAI, DAP) so reconciler-set conditions are visible in the output.

func SortResources

func SortResources(objects []client.Object, scheme *runtime.Scheme) []client.Object

SortResources orders resources by dependency order (kindOrder) and then alphabetically by namespace/name within each kind.

Types

type Options

type Options struct {
	// DDA is the input DatadogAgent. Required.
	DDA *datadoghqv2alpha1.DatadogAgent
	// DAPs are optional DatadogAgentProfiles. They are passed to the
	// reconciler regardless of ProfileEnabled, but only take effect when
	// ProfileEnabled is true.
	DAPs []*datadoghqv1alpha1.DatadogAgentProfile
	// ProfileEnabled toggles DatadogAgentProfile reconciliation, mirroring
	// the operator's --datadogAgentProfileEnabled flag.
	ProfileEnabled bool
	// SupportCilium emits CiliumNetworkPolicy resources alongside NetworkPolicy.
	SupportCilium bool
	// Logger is used for reconciler and controller-runtime output. Zero value
	// (logr.Logger{}) silences all logging, equivalent to logr.Discard().
	Logger logr.Logger
	// IncludeInputStatuses re-fetches the DDA and DAPs from the fake client
	// after reconciliation and appends them to the resource list so their
	// reconciler-set status fields are visible in the serialized output.
	IncludeInputStatuses bool
	// KubernetesVersion is the simulated server GitVersion (e.g. "v1.28.0").
	// It gates version-dependent resources such as the local agent service
	// (k8s >= 1.22). Empty defaults to DefaultKubernetesVersion.
	KubernetesVersion string
}

Options configures a Render invocation.

Jump to

Keyboard shortcuts

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