configpatcher

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MPL-2.0 Imports: 16 Imported by: 6

Documentation

Overview

Package configpatcher provides methods to patch Talos config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON6902

func JSON6902(talosMachineConfig []byte, patch jsonpatch.Patch) ([]byte, error)

JSON6902 is responsible for applying a JSON 6902 patch to the bootstrap data.

func StrategicMerge

func StrategicMerge(cfg coreconfig.Provider, patch StrategicMergePatch) (coreconfig.Provider, error)

StrategicMerge performs strategic merge config patching.

Strategic merge on two sets of documents - on the left hand side and on the right hand side. Documents with matching tuples (apiVersion, kind, name) are merged together. If the document on the right doesn't exist on the left, it is appended.

Types

type Input

type Input interface {
	Config() (config.Provider, error)
	Bytes() ([]byte, error)
}

Input to the patch application process.

func WithBytes

func WithBytes(bytes []byte) Input

WithBytes returns a new Input that wraps the given bytes.

func WithConfig

func WithConfig(config config.Provider) Input

WithConfig returns a new Input that wraps the given config.

type Output

type Output = Input

Output of patch application process.

func Apply

func Apply(in Input, patches []Patch) (Output, error)

Apply config patches to Talos machine config.

Apply either JSON6902 or StrategicMergePatch.

This method tries to minimize conversion between byte and unmarshalled config representation as much as possible.

type Patch

type Patch any

Patch is either JSON patch or strategic merge patch.

func LoadPatch

func LoadPatch(in []byte) (Patch, error)

LoadPatch loads the strategic merge patch or JSON patch (JSON/YAML for JSON patch).

func LoadPatches

func LoadPatches(in []string) ([]Patch, error)

LoadPatches loads the JSON patch either from value literal or from a file if the patch starts with '@'.

type StrategicMergePatch

type StrategicMergePatch struct {
	coreconfig.Provider
}

StrategicMergePatch is a strategic merge config patch.

Jump to

Keyboard shortcuts

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