kubernetes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterUnchangedManifests

func FilterUnchangedManifests(oldManifests *ManifestMap, newManifests *ManifestMap) (*ManifestMap, *ManifestMap)

Filters all common manifests with identical content from the given manifest maps. Returns two new maps which contain only the changed (new, altered or removed) manifests.

func GetUniqueManifestHashes

func GetUniqueManifestHashes(old *ManifestMap, new *ManifestMap) *[]string

Returns a list of MD5 hashes for all manifests in the given input maps. If a manifest with identical MD5 hash is present in both maps, the hash is returned only once.

func PrintDiff added in v0.2.0

func PrintDiff(diff *ManifestDiff, formatAsMarkdownCodeBlock bool, output io.Writer)

Creates and prints the diff for two manifests.

Types

type Manifest

type Manifest struct {
	ApiVersion string
	Kind       string
	Name       string
	Namespace  string
	Content    string
}

A manifest describes a Kubernetes object with the most important parameters and its content.

func (Manifest) CalculateHash

func (m Manifest) CalculateHash() string

Calculates the MD5 hash for a manifest header (apiVersion, kind, name and namespace). Can be used to compare manifests.

type ManifestDiff added in v0.2.0

type ManifestDiff struct {
	OldManifest *Manifest
	NewManifest *Manifest
	Diff        string
}

The diff between two manifests.

func CreateDiffForManifestFiles added in v0.2.0

func CreateDiffForManifestFiles(old *string, new *string) ([]ManifestDiff, error)

Creates the diff for two manifest files, each containing multiple manifests separated by the YAML separator '---'.

func CreateDiffForManifests added in v0.2.0

func CreateDiffForManifests(old *Manifest, new *Manifest) *ManifestDiff

Creates the diff for two manifests.

type ManifestMap

type ManifestMap map[string]Manifest

This type contains the manifest hash as key and the manifest itself as value.

func SplitKustomizationIntoManifests

func SplitKustomizationIntoManifests(kustomization *string) (*ManifestMap, error)

Splits the given Kustomization into individual manifests per object.

type YamlObject

type YamlObject map[string]interface{}

This type is a convenience layer on top of a generic map and represents a YAML object.

Jump to

Keyboard shortcuts

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