configpatcher

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MPL-2.0 Imports: 12 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 config.Provider, patch StrategicMergePatch) (config.Provider, error)

StrategicMerge performs strategic merge config patching.

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 {
	config.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