diff

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package diff compares two rendered manifests the way an operator needs to see them before an upgrade or a rollback: what is added, removed or changed, and which changes Kubernetes cannot apply in place. Secret values are compared but never shown.

The blocking rules match the chart's own render-diff gate, so a change the chart's CI calls breaking is one ntctl refuses to apply silently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	Op   Op     `json:"op"`
	// Blocking says why Kubernetes cannot apply the change in place, or why
	// it loses data. Empty when the change is safe.
	Blocking []string `json:"blocking,omitempty"`
	// Kept says a removed resource carries helm.sh/resource-policy: keep, so
	// Helm leaves it in the cluster, no longer managed by the release.
	Kept bool `json:"kept,omitempty"`
	// Unread says a removed Secret is named by nothing: no other object of
	// either release, nor any object outside it the check could see.
	Unread bool `json:"unread,omitempty"`
	// Secret keys added, removed or with a new value. Values are never kept.
	SecretKeys *SecretKeys `json:"secretKeys,omitempty"`
	// Images are the containers whose image changes.
	Images []ImageChange `json:"images,omitempty"`
	// Unified is the diff of the resource, with Secret values hidden.
	Unified string `json:"-"`
}

Change is one resource that differs.

type ImageChange added in v0.10.0

type ImageChange struct {
	Container string `json:"container"`
	From      string `json:"from"`
	To        string `json:"to"`
}

ImageChange is one container's image before and after.

func (ImageChange) String added in v0.10.0

func (i ImageChange) String() string

String names the image once and shows the tag change, or both references when the repository changes too.

type Op

type Op string

Op is what happens to a resource.

const (
	Added   Op = "added"
	Removed Op = "removed"
	Changed Op = "changed"
)

Operations.

type Referrer added in v0.17.0

type Referrer func(name string) string

Referrer names an object outside the release that still uses the Secret called name, such as an operator's own Gateway serving the release's certificate, or returns "" when none does.

type Result

type Result struct {
	Changes []Change `json:"changes"`
}

Result is every change between two manifests.

func Compare

func Compare(from, to []manifest.Object) Result

Compare returns what changes when a release goes from one manifest to the other.

func CompareUsing added in v0.17.0

func CompareUsing(from, to []manifest.Object, outside Referrer) Result

CompareUsing is Compare, with outside naming what in the cluster still uses a Secret the release stops rendering. A removed Secret named by nothing in either release, nor by outside, is safe to drop: it holds nothing anything reads. Without outside, every removed Secret the releases do not name still blocks, since nothing beyond the manifests was checked.

func (Result) Blocking

func (r Result) Blocking() []Change

Blocking returns the changes that cannot be applied safely.

func (Result) Components added in v0.10.0

func (r Result) Components() []ImageChange

Components returns each image whose version changes, once however many workloads run it: what an upgrade moves, independent of how many releases it spans. Images of added or removed workloads are not counted.

func (Result) Empty

func (r Result) Empty() bool

Empty reports whether nothing changes.

func (Result) Print

func (r Result) Print(w io.Writer, full bool)

Print writes a summary grouped by kind, the blocking changes, and with full set, each changed resource's diff.

type SecretKeys

type SecretKeys struct {
	Added   []string `json:"added,omitempty"`
	Removed []string `json:"removed,omitempty"`
	Changed []string `json:"changed,omitempty"`
	// Unread are the removed keys no workload of the target release reads,
	// and Empty those that held an empty value: dropping either is safe.
	Unread []string `json:"unread,omitempty"`
	Empty  []string `json:"empty,omitempty"`
}

SecretKeys summarises a Secret's change by key.

func (*SecretKeys) String

func (k *SecretKeys) String() string

Jump to

Keyboard shortcuts

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