...

Package walk

import "sigs.k8s.io/kustomize/kyaml/yaml/walk"
Overview
Index

Overview ▾

Constants

const (
    DestIndex = iota
    OriginIndex
    UpdatedIndex
)

Variables

ClearNode is returned if GrepFilter should do nothing after calling Set

var ClearNode *yaml.RNode

type ListKind

type ListKind int32
const (
    AssociativeList ListKind = 1 + iota
    NonAssociateList
)

type Sources

Sources are a list of RNodes. First item is the dest node, followed by multiple source nodes.

type Sources []*yaml.RNode

func (Sources) Dest

func (s Sources) Dest() *yaml.RNode

Dest returns the destination node

func (Sources) Origin

func (s Sources) Origin() *yaml.RNode

Origin returns the origin node

func (Sources) String

func (s Sources) String() string

func (Sources) Updated

func (s Sources) Updated() *yaml.RNode

Updated returns the updated node

type Visitor

Visitor is invoked by walk with source and destination node pairs

type Visitor interface {
    VisitMap(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)

    VisitScalar(Sources, *openapi.ResourceSchema) (*yaml.RNode, error)

    VisitList(Sources, *openapi.ResourceSchema, ListKind) (*yaml.RNode, error)
}

type Walker

Walker walks the Source RNode and modifies the RNode provided to GrepFilter.

type Walker struct {
    // Visitor is invoked by GrepFilter
    Visitor

    Schema *openapi.ResourceSchema

    // Source is the RNode to walk.  All Source fields and associative list elements
    // will be visited.
    Sources Sources

    // Path is the field path to the current Source Node.
    Path []string

    // InferAssociativeLists if set to true will infer merge strategies for
    // fields which it doesn't have the schema based on the fields in the
    // list elements.
    InferAssociativeLists bool

    // VisitKeysAsScalars if true will call VisitScalar on map entry keys,
    // providing nil as the OpenAPI schema.
    VisitKeysAsScalars bool

    // MergeOptions is a struct to store options for merge
    MergeOptions yaml.MergeOptions
}

func (Walker) GetSchema

func (l Walker) GetSchema() *openapi.ResourceSchema

func (Walker) Kind

func (l Walker) Kind() yaml.Kind

Kind returns the kind of the first non-null node in Sources.

func (Walker) Walk

func (l Walker) Walk() (*yaml.RNode, error)

Walk will recursively traverse every item in the Sources and perform corresponding actions on them