util

package module
v0.0.0-...-5c159d4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: 0BSD Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	KindPod = "Pod"
)

Variables

This section is empty.

Functions

func ForEach

func ForEach(do func(node *yaml.RNode) error) yaml.Filter

forEach returns a filter that calls visitElements with the "do" function on the input sequence node

func GVK

func GVK(object *yaml.RNode) string

func ItemToResult

func ItemToResult(item *yaml.RNode, sev framework.Severity, msg string) *framework.Result

func LookupPod

func LookupPod(object *yaml.RNode) (*yaml.RNode, error)

get the pod from the input node. If the node is of kind pod, the node itself is returned. Otherwise, the pod template from a list of conventional path is looked up.

func MustGetPath

func MustGetPath(item *yaml.RNode) string

func ResourceID

func ResourceID(object *yaml.RNode) string

func ReverseTee

func ReverseTee(filters ...yaml.Filter) yaml.Filter

ReverseTee is like tee in that it passes the arguments instead the output, but it will only pass the arguments, if the filter pipe returns nil. this can be useful when searching for the right place to perform an operation and then cancel early without running subsequent pipes

func Ternary

func Ternary[T any](cond bool, yes T, no T) T

Types

type CSV

type CSV []string

CSV can be used to use a string slice as data while reading it from the function config data as comma separated string. This is useful when using simple configmaps as function config as those don't support anything other than a string map

func (*CSV) UnmarshalJSON

func (dst *CSV) UnmarshalJSON(data []byte) error

type LogFunc

type LogFunc func(sev framework.Severity, fstr string, args ...any)

func MakeLogFunc

func MakeLogFunc(rl *framework.ResourceList, item *yaml.RNode) LogFunc

type ReverseTeePiper

type ReverseTeePiper struct {
	Kind string `yaml:"kind,omitempty"`

	// Filters are the set of Filters run by ReverseTeePiper.
	Filters []yaml.Filter `yaml:"filters,omitempty"`
}

func (ReverseTeePiper) Filter

func (t ReverseTeePiper) Filter(rn *yaml.RNode) (*yaml.RNode, error)

Jump to

Keyboard shortcuts

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