Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ maintains per-session state for computing diffs between successive versions of Kubernetes objects.
It caches the last-seen version of each object and uses Printer to render git-style diffs between the cached and new versions.
func (*Differ) Diff ¶
func (d *Differ) Diff(obj *unstructured.Unstructured) (string, error)
Diff computes the diff between the last cached version of obj and the current version. The cache is updated to the new version.
It returns an empty string if there is no effective change.
func (*Differ) DiffDelete ¶
func (d *Differ) DiffDelete(obj *unstructured.Unstructured) (string, error)
DiffDelete computes a diff that represents deletion of the object previously seen with the same identity. If the object was not seen before, it returns an empty string.
func (*Differ) SetIgnoreMeta ¶
SetIgnoreMeta controls whether non-essential metadata is excluded from diffs.
func (*Differ) SetIgnoreStatus ¶
SetIgnoreStatus controls whether the status field is excluded from diffs.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer formats diffs between two unstructured Kubernetes objects. It is inspired by kubectl-yadt's DiffPrinter but outputs plain text without terminal color codes so it is suitable for MCP tool responses.
func (*Printer) Diff ¶
func (p *Printer) Diff(oldObj, newObj *unstructured.Unstructured) (string, error)
Diff computes a git-style diff between two objects and returns it as a string. The original objects should already have had any ignoreStatus/ignoreMeta transformations applied.