applysetters

package
v0.0.0-...-829e7b5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package applysetters is an adaptation for Skaffold's applysetters package to apply kpt-style param transformations for a yaml config file with the parameters provided as key value pairs.

Index

Constants

View Source
const SetterCommentIdentifier = "# from-param: "

Variables

This section is empty.

Functions

func ApplyParams

func ApplyParams(filePath string, params map[string]string) error

ApplyParams sets the value of a kpt-style param in the input file with the values from the 'params' map.

func VisitElements

func VisitElements(rn *yaml.RNode, fn func(node *yaml.RNode, i int) error) error

VisitElements calls fn for each element in a SequenceNode. Returns an error for non-SequenceNodes

Types

type ApplySetters

type ApplySetters struct {
	// Setters holds the user provided values for all the setters
	Setters []Setter

	// Results are the results of applying setter values
	Results []*Result
	// contains filtered or unexported fields
}

ApplySetters applies the setter values to the resource fields which are tagged by the setter reference comments

func (*ApplySetters) Filter

func (as *ApplySetters) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

Filter implements Set as a yaml.Filter

type Result

type Result struct {
	// FilePath is the file path of the matching field
	FilePath string

	// FieldPath is field path of the matching field
	FieldPath string

	// Value of the matching field
	Value string
}

Result holds result of search and replace operation

type Setter

type Setter struct {
	// Name is the name of the setter
	Name string

	// Value is the input value for setter
	Value string
}

Jump to

Keyboard shortcuts

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