conversion

package
v0.1.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSpec

func ConvertSpec(spec *v1alpha1.HAProxyTemplateConfigSpec) (*config.Config, error)

ConvertSpec converts a HAProxyTemplateConfig CRD Spec to internal config.Config format.

This is a comprehensive converter that handles ALL fields from the CRD spec including:

  • Production fields: PodSelector, Controller, Logging, Dataplane
  • Template fields: HAProxyConfig, TemplateSnippets, Maps, Files, SSLCertificates
  • Resource fields: WatchedResources, WatchedResourcesIgnoreFields
  • Configuration fields: TemplatingSettings
  • Test fields: ValidationTests (includes fixtures and assertions)

The CRD spec field CredentialsSecretRef is intentionally excluded as it's handled separately by the credentials loader component.

IMPORTANT: When adding or modifying fields in the CRD types (pkg/apis/haproxytemplate/v1alpha1/types.go), you MUST update this function to copy those fields. The CRD types have documentation comments pointing to this file as a reminder.

Common mistake: Adding a field to the CRD but forgetting to copy it here, resulting in the field being silently ignored by the controller.

func ParseCRD

ParseCRD converts an unstructured HAProxyTemplateConfig CRD to typed structs.

This function validates the resource type, converts the unstructured resource to a typed HAProxyTemplateConfig CRD, and then converts the CRD Spec to a config.Config for validation and rendering.

Returns:

  • *config.Config: Parsed configuration for validation and rendering
  • *v1alpha1.HAProxyTemplateConfig: Original CRD for Kubernetes metadata (name, namespace, UID)
  • error: Validation or conversion failure

Types

This section is empty.

Jump to

Keyboard shortcuts

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