fns

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearEntry

func ClearEntry(key string) filtersutil.SetFn

ClearEntry returns a SetFn to clear a map entry

Types

type KeysClearer

type KeysClearer struct {
	Kind string   `yaml:"kind,omitempty"`
	Keys []string `yaml:"keys,omitempty"`

	// FsSlice identifies the location of the maps.
	FsSlice types.FsSlice `yaml:"fieldSpecs,omitempty"`
}

KeysClearer removes the key from the maps located at the entries specified by FsSlice.

N.B. this implements kio.Filter which takes returns []*yaml.RNode not yaml.Filter which takes/returns a single RNode; there's no good reason for this. Its just based on copying https://github.com/kubernetes-sigs/kustomize/blob/5993eae1aa78017c9e5922b41f2dba911e03ce6a/api/filters/labels/labels.go#L28

N.B jeremy@ couldn't get this to work when you have a list of maps and want to modify a field in the map e.g. spec:

items:
-  name: item1
   valuetokeep: v
   labels:
     toremove: a

Specifying a FieldSpec with path spec/items[] doesn't work; we get the wrong type of value Specifying a FieldSpec with path spec/items[]/labels does work but removes values from the nested nictionary.

func (KeysClearer) Filter

func (c KeysClearer) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter applies the filter to the nodes.

Directories

Path Synopsis
ai
The ai package contains code for using LLMs to generate configuration.
The ai package contains code for using LLMs to generate configuration.

Jump to

Keyboard shortcuts

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