Help us shape the future of Go! Take the 2026 Go Developer Survey

cluster

package
v2.12.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffWrapper

func DiffWrapper(w io.Writer, mutator configmaps.Mutator) configmaps.Mutator

DiffWrapper wraps a mutator and prints out the diff between the original object and the one it returns if there's no error.

Example (Changes)
obj := &v1.ConfigMap{}
obj.Data = map[string]string{"some-key": "some-value"}

contents := &bytes.Buffer{}
wrapper := DiffWrapper(contents, func(obj *v1.ConfigMap) error {
	obj.Data = map[string]string{"some-key": "new-value"}
	return nil
})

fmt.Println("Error:", wrapper(obj))
firstLine := strings.Split(contents.String(), "\n")[0]
fmt.Println("First line:", firstLine)
Output:
Error: <nil>
First line: ConfigMap Diff (-old +new):
Example (Err)
obj := &v1.ConfigMap{}
wrapper := DiffWrapper(os.Stdout, func(_ *v1.ConfigMap) error {
	return errors.New("some-error")
})

fmt.Println(wrapper(obj))
Output:
some-error
Example (NoDiff)
obj := &v1.ConfigMap{}

wrapper := DiffWrapper(os.Stdout, func(cm *v1.ConfigMap) error {
	// don't mutate the object
	return nil
})

wrapper(obj)
Output:
No changes

func FormatDiff

func FormatDiff(w io.Writer, leftName, rightName string, left, right *v1.ConfigMap)

FormatDiff creates a diff between two ConfigMaps and writes it to the given writer.

func NewConfigClusterCommand

func NewConfigClusterCommand(p *config.KfParams, client configmaps.Client) *cobra.Command

NewConfigClusterCommand creates a command that can set facets of a Kf cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

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