resmap

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 11 Imported by: 484

Documentation

Overview

Package resmap implements a map from ResId to Resource that tracks all resources in a kustomization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory added in v1.0.9

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

Factory makes instances of ResMap.

func NewFactory added in v1.0.9

func NewFactory(rf *resource.Factory) *Factory

NewFactory returns a new resmap.Factory.

func (*Factory) FromFiles added in v1.0.9

func (rmF *Factory) FromFiles(
	loader ifc.Loader, paths []string) (ResMap, error)

FromFiles returns a ResMap given a resource path slice.

func (*Factory) NewResMapFromBytes

func (rmF *Factory) NewResMapFromBytes(b []byte) (ResMap, error)

newResMapFromBytes decodes a list of objects in byte array format.

func (*Factory) NewResMapFromConfigMapArgs added in v1.0.9

func (rmF *Factory) NewResMapFromConfigMapArgs(argList []types.ConfigMapArgs, options *types.GeneratorOptions) (ResMap, error)

NewResMapFromConfigMapArgs returns a Resource slice given a configmap metadata slice from kustomization file.

func (*Factory) NewResMapFromSecretArgs added in v1.0.9

func (rmF *Factory) NewResMapFromSecretArgs(argsList []types.SecretArgs, options *types.GeneratorOptions) (ResMap, error)

NewResMapFromSecretArgs takes a SecretArgs slice, generates secrets from each entry, and accumulates them in a ResMap.

func (*Factory) RF added in v1.0.9

func (rmF *Factory) RF() *resource.Factory

RF returns a resource.Factory.

func (*Factory) Set added in v1.0.9

func (rmF *Factory) Set(ldr ifc.Loader)

Set sets the loader for the underlying factory

type IdMatcher

type IdMatcher func(resid.ResId) bool

type IdSlice

type IdSlice []resid.ResId

IdSlice implements the sort interface.

func (IdSlice) Len

func (a IdSlice) Len() int

func (IdSlice) Less

func (a IdSlice) Less(i, j int) bool

func (IdSlice) Swap

func (a IdSlice) Swap(i, j int)

type ResMap

type ResMap map[resid.ResId]*resource.Resource

ResMap is a map from ResId to Resource.

func MergeWithErrorOnIdCollision

func MergeWithErrorOnIdCollision(maps ...ResMap) (ResMap, error)

MergeWithErrorOnIdCollision combines multiple ResMap instances, failing on key collision and skipping nil maps. If all of the maps are nil, an empty ResMap is returned.

func MergeWithOverride

func MergeWithOverride(maps ...ResMap) (ResMap, error)

MergeWithOverride combines multiple ResMap instances, allowing and sometimes demanding certain collisions and skipping nil maps. A collision would be demanded, say, when a generated ConfigMap has the "replace" option in its generation instructions, meaning it is supposed to replace something from the raw resources list. If all of the maps are nil, an empty ResMap is returned. When looping over the instances to combine them, if a resource id for resource X is found to be already in the combined map, then the behavior field for X must be BehaviorMerge or BehaviorReplace. If X is not in the map, then it's behavior cannot be merge or replace.

func (ResMap) DeepCopy added in v1.0.8

func (m ResMap) DeepCopy(rf *resource.Factory) ResMap

DeepCopy clone the resmap into a new one

func (ResMap) EncodeAsYaml

func (m ResMap) EncodeAsYaml() ([]byte, error)

EncodeAsYaml encodes a ResMap to YAML; encoded objects separated by `---`.

func (ResMap) ErrorIfNotEqual

func (m ResMap) ErrorIfNotEqual(m2 ResMap) error

ErrorIfNotEqual returns error if maps are not equal.

func (ResMap) FilterBy added in v1.0.8

func (m ResMap) FilterBy(inputId resid.ResId) ResMap

FilterBy returns a subset ResMap containing ResIds with the same namespace and leftmost name prefix and rightmost name as the inputId. If inputId is a cluster level resource, this returns the original ResMap.

func (ResMap) GetMatchingIds

func (m ResMap) GetMatchingIds(matches IdMatcher) []resid.ResId

GetMatchingIds returns a slice of ResId keys from the map that all satisfy the given matcher function.

Jump to

Keyboard shortcuts

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