transformers

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package transformers has implementations of resmap.ResMap transformers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnnotationsPathConfigs added in v1.0.3

func AddAnnotationsPathConfigs(pathConfigs ...PathConfig)

AddAnnotationsPathConfigs adds extra path configs to the default one

func AddLabelsPathConfigs added in v1.0.3

func AddLabelsPathConfigs(pathConfigs ...PathConfig)

AddLabelsPathConfigs adds extra path configs to the default one

func AddNameReferencePathConfigs added in v1.0.3

func AddNameReferencePathConfigs(r []ReferencePathConfig)

AddNameReferencePathConfigs adds extra reference path configs to the default one

func AddPrefixPathConfigs added in v1.0.3

func AddPrefixPathConfigs(pathConfigs ...PathConfig)

AddPrefixPathConfigs adds extra path configs to the default one

Types

type PathConfig

type PathConfig struct {
	// If true, it will create the path if it is not found.
	CreateIfNotPresent bool
	// The gvk that this path tied to.
	// If unset, it applied to any gvk
	// If some fields are set, it applies to all matching gvk.
	GroupVersionKind *schema.GroupVersionKind
	// Path to the field that will be munged.
	Path []string
}

PathConfig contains the configuration of a field, including the gvk it ties to, path to the field, etc.

type ReferencePathConfig added in v1.0.3

type ReferencePathConfig struct {
	// contains filtered or unexported fields
}

ReferencePathConfig contains the configuration of a field that references the name of another resource whose GroupVersionKind is specified in referencedGVK. e.g. pod.spec.template.volumes.configMap.name references the name of a configmap Its corresponding referencePathConfig will look like:

ReferencePathConfig{
referencedGVK: schema.GroupVersionKind{Version: "v1", Kind: "ConfigMap"},
pathConfigs: []PathConfig{
	{
		GroupVersionKind: &schema.GroupVersionKind{Version: "v1", Kind: "Pod"},
		Path:             []string{"spec", "volumes", "configMap", "name"},
	},
}

func MergeNameReferencePathConfigs added in v1.0.3

func MergeNameReferencePathConfigs(configs []ReferencePathConfig, config ReferencePathConfig) []ReferencePathConfig

MergeNameReferencePathConfigs merges one ReferencePathConfig into a slice of ReferencePathConfig

func NewReferencePathConfig added in v1.0.3

func NewReferencePathConfig(gvk schema.GroupVersionKind, pathconfigs []PathConfig) ReferencePathConfig

NewReferencePathConfig creates a new ReferencePathConfig object

func (ReferencePathConfig) GVK added in v1.0.3

func (r ReferencePathConfig) GVK() string

GVK returns the Group version kind of a Reference PathConfig

type Transformer

type Transformer interface {
	// Transform modifies data in the argument, e.g. adding labels to resources that can be labelled.
	Transform(m resmap.ResMap) error
}

A Transformer modifies an instance of resmap.ResMap.

func NewDefaultingAnnotationsMapTransformer

func NewDefaultingAnnotationsMapTransformer(m map[string]string) (Transformer, error)

NewDefaultingAnnotationsMapTransformer construct a mapTransformer with defaultAnnotationsPathConfigs.

func NewDefaultingLabelsMapTransformer

func NewDefaultingLabelsMapTransformer(m map[string]string) (Transformer, error)

NewDefaultingLabelsMapTransformer construct a mapTransformer with defaultLabelsPathConfigs.

func NewDefaultingNamePrefixTransformer

func NewDefaultingNamePrefixTransformer(nameprefix string) (Transformer, error)

NewDefaultingNamePrefixTransformer construct a namePrefixTransformer with defaultNamePrefixPathConfigs.

func NewDefaultingNameReferenceTransformer

func NewDefaultingNameReferenceTransformer() (Transformer, error)

NewDefaultingNameReferenceTransformer constructs a nameReferenceTransformer with defaultNameReferencepathConfigs.

func NewMapTransformer

func NewMapTransformer(pc []PathConfig, m map[string]string) (Transformer, error)

NewMapTransformer construct a mapTransformer.

func NewMultiTransformer

func NewMultiTransformer(t []Transformer) Transformer

NewMultiTransformer constructs a multiTransformer.

func NewNameHashTransformer

func NewNameHashTransformer() Transformer

NewNameHashTransformer construct a nameHashTransformer.

func NewNamePrefixTransformer

func NewNamePrefixTransformer(pc []PathConfig, np string) (Transformer, error)

NewNamePrefixTransformer construct a namePrefixTransformer.

func NewNameReferenceTransformer

func NewNameReferenceTransformer(pc []ReferencePathConfig) (Transformer, error)

NewNameReferenceTransformer construct a nameReferenceTransformer.

func NewNamespaceTransformer added in v1.0.2

func NewNamespaceTransformer(ns string) Transformer

NewNamespaceTransformer construct a namespaceTransformer.

func NewNoOpTransformer

func NewNoOpTransformer() Transformer

NewNoOpTransformer constructs a noOpTransformer.

func NewPatchTransformer added in v1.0.2

func NewPatchTransformer(slice []*resource.Resource) (Transformer, error)

NewPatchTransformer constructs a patchTransformer.

func NewRefVarTransformer added in v1.0.2

func NewRefVarTransformer(vars map[string]string) (Transformer, error)

NewRefVarTransformer returns a Trasformer that replaces $(VAR) style variables with values.

Jump to

Keyboard shortcuts

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