Documentation
¶
Index ¶
- func GenerateKustomization(resources []string, patches []Patch) ([]byte, error)
- func GeneratePatchFilename(group, version, kind, name, namespace string) string
- func GetResourceTypeFilename(kind, group string) string
- func ParseResourceTypeFilename(filename string) (kind, group string)
- func SanitizeFilename(filename string) string
- func SerializePatchToYAML(ops jsonpatch.Patch) ([]byte, error)
- type KustomizationFile
- type Patch
- type PatchTarget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKustomization ¶
GenerateKustomization creates a kustomization.yaml file content with deterministic ordering for stable Git diffs
func GeneratePatchFilename ¶
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 ¶
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 ¶
ParseResourceTypeFilename parses a resource type filename back into kind and group This is the inverse of GetResourceTypeFilename
func SanitizeFilename ¶
SanitizeFilename sanitizes a filename for filesystem safety This is primarily for edge cases with unusual characters
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
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