manifest

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package manifest provides structured YAML manifest mutation utilities. This package replaces regex-based YAML manipulation with proper structured editing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimpleManifestRenderer

func SimpleManifestRenderer(content string, images map[string]string) string

SimpleManifestRenderer performs simple string-based replacements in a manifest. This is a convenience function for basic use cases where structured mutation is not needed. For complex Kubernetes manifest manipulation, use Mutator instead. Note: This uses string replacement and may not handle all YAML edge cases correctly. Deprecated: Use Mutator for structured, safer manifest manipulation.

Types

type Mutator

type Mutator struct {
	// contains filtered or unexported fields
}

Mutator provides structured mutation capabilities for Kubernetes manifests.

func NewMutator

func NewMutator(yamlContent []byte) (*Mutator, error)

NewMutator creates a new manifest mutator from YAML content.

func (*Mutator) FindDeployment

func (m *Mutator) FindDeployment(name, namespace string) map[string]any

FindDeployment finds a Deployment document by name and optionally namespace. If namespace is empty, it matches any namespace. Returns nil if no matching deployment is found.

func (*Mutator) MergeDeploymentArgs

func (m *Mutator) MergeDeploymentArgs(deploymentName, containerName string, newArgs []string) error

MergeDeploymentArgs merges command-line arguments with existing ones. If containerName is empty, it merges for the first container. Args with the same key (extracted from the flag name) will be replaced; new args will be appended.

func (*Mutator) MergeDeploymentEnv

func (m *Mutator) MergeDeploymentEnv(deploymentName, containerName string, envVars map[string]string) error

MergeDeploymentEnv merges environment variables with existing ones. If containerName is empty, it merges for the first container.

func (*Mutator) MergeDeploymentTemplateAnnotations

func (m *Mutator) MergeDeploymentTemplateAnnotations(deploymentName string, annotations map[string]string) error

MergeDeploymentTemplateAnnotations merges annotations into a deployment pod template.

func (*Mutator) MergeDeploymentVolumeMounts

func (m *Mutator) MergeDeploymentVolumeMounts(deploymentName, containerName string, volumeMounts []map[string]any) error

MergeDeploymentVolumeMounts merges volume mounts by name into a deployment container.

func (*Mutator) MergeDeploymentVolumes

func (m *Mutator) MergeDeploymentVolumes(deploymentName string, volumes []map[string]any) error

MergeDeploymentVolumes merges volumes by name into a deployment pod spec.

func (*Mutator) SetDeploymentArgs

func (m *Mutator) SetDeploymentArgs(deploymentName, containerName string, args []string) error

SetDeploymentArgs sets the command-line arguments for a specific container. If containerName is empty, it sets for the first container.

func (*Mutator) SetDeploymentEnv

func (m *Mutator) SetDeploymentEnv(deploymentName, containerName string, envVars map[string]string) error

SetDeploymentEnv sets environment variables for a specific container. If containerName is empty, it sets for the first container.

func (*Mutator) SetDeploymentImage

func (m *Mutator) SetDeploymentImage(deploymentName, containerName, image string) error

SetDeploymentImage sets the container image for a specific container in a deployment. If containerName is empty, it sets the image for the first container.

func (*Mutator) SetDeploymentImagePullPolicy

func (m *Mutator) SetDeploymentImagePullPolicy(deploymentName, containerName, pullPolicy string) error

SetDeploymentImagePullPolicy sets the image pull policy for a specific container. If containerName is empty, it sets for the first container.

func (*Mutator) ToYAML

func (m *Mutator) ToYAML() ([]byte, error)

ToYAML renders the mutated manifests back to YAML.

Jump to

Keyboard shortcuts

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