sanitize

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sanitize removes server-generated fields from Kubernetes objects. It preserves only the desired state for Git commit operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalToOrderedYAML

func MarshalToOrderedYAML(obj *unstructured.Unstructured) ([]byte, error)

MarshalToOrderedYAML converts an unstructured object to YAML with guaranteed field order. Field order: apiVersion, kind, metadata, then payload (spec, data, rules, etc.)

func Sanitize

Sanitize removes server-side fields from a Kubernetes object, leaving only the desired state.

Types

type PartialObjectMeta

type PartialObjectMeta struct {
	Name        string            `json:"name,omitempty"        yaml:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"   yaml:"namespace,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"      yaml:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

PartialObjectMeta defines the subset of ObjectMeta fields we preserve in GitOps storage. This explicitly documents our sanitization policy.

func (*PartialObjectMeta) FromUnstructured

func (p *PartialObjectMeta) FromUnstructured(obj *unstructured.Unstructured)

FromUnstructured extracts PartialObjectMeta from an unstructured object.

Jump to

Keyboard shortcuts

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