kustomize

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKustomization

func GenerateKustomization(resources []string, patches []Patch) ([]byte, error)

GenerateKustomization creates a kustomization.yaml file content with deterministic ordering for stable Git diffs

func GeneratePatchFilename

func GeneratePatchFilename(group, version, kind, name, namespace string) string

GeneratePatchFilename creates a deterministic filename for a patch file Format: <namespace>--<group>-<version>--<kind>--<name>.patch.yaml For cluster-scoped resources, namespace is omitted: <group>-<version>--<kind>--<name>.patch.yaml

func GetResourceTypeFilename

func GetResourceTypeFilename(kind, group string) string

GetResourceTypeFilename generates a deterministic filename for a resource type Format:

  • Core types: <kind>.yaml (e.g., "deployment.yaml", "service.yaml")
  • Non-core types: <kind>.<group>.yaml (e.g., "route.route.openshift.io.yaml")

Note: Version is NOT included in the filename - it's in the resource YAML itself

func ParseResourceTypeFilename

func ParseResourceTypeFilename(filename string) (kind, group string)

ParseResourceTypeFilename parses a resource type filename back into kind and group This is the inverse of GetResourceTypeFilename

func SanitizeFilename

func SanitizeFilename(filename string) string

SanitizeFilename sanitizes a filename for filesystem safety This is primarily for edge cases with unusual characters

func SerializePatchToYAML

func SerializePatchToYAML(ops jsonpatch.Patch) ([]byte, error)

SerializePatchToYAML converts a JSONPatch patch to Kustomize-compatible YAML format The output is a YAML array of RFC 6902 JSON Patch operations

Types

type KustomizationFile

type KustomizationFile struct {
	APIVersion string   `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
	Kind       string   `json:"kind,omitempty" yaml:"kind,omitempty"`
	Resources  []string `json:"resources,omitempty" yaml:"resources,omitempty"`
	Patches    []Patch  `json:"patches,omitempty" yaml:"patches,omitempty"`
}

KustomizationFile represents the structure of a kustomization.yaml file

type Patch

type Patch struct {
	Path   string      `json:"path" yaml:"path"`
	Target PatchTarget `json:"target" yaml:"target"`
}

Patch represents a Kustomize patch with target selector

func NewPatch

func NewPatch(path, group, version, kind, name, namespace string) Patch

NewPatch creates a new Patch with target selector

type PatchTarget

type PatchTarget struct {
	Group     string `json:"group,omitempty" yaml:"group,omitempty"`
	Version   string `json:"version,omitempty" yaml:"version,omitempty"`
	Kind      string `json:"kind,omitempty" yaml:"kind,omitempty"`
	Name      string `json:"name,omitempty" yaml:"name,omitempty"`
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

PatchTarget represents the Kustomize patch target selector

Jump to

Keyboard shortcuts

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