package resmap
import "sigs.k8s.io/kustomize/pkg/resmap"
Package resmap implements a map from ResId to Resource that tracks all resources in a kustomization.
Index ¶
- type Factory
- func NewFactory(rf *resource.Factory) *Factory
- func (rmF *Factory) FromFiles( loader ifc.Loader, paths []string) (ResMap, error)
- func (rmF *Factory) NewResMapFromConfigMapArgs(argList []types.ConfigMapArgs, options *types.GeneratorOptions) (ResMap, error)
- func (rmF *Factory) NewResMapFromSecretArgs(argsList []types.SecretArgs, options *types.GeneratorOptions) (ResMap, error)
- func (rmF *Factory) RF() *resource.Factory
- func (rmF *Factory) Set(fs fs.FileSystem, ldr ifc.Loader)
- type IdSlice
- type ResMap
- func MergeWithOverride(maps ...ResMap) (ResMap, error)
- func MergeWithoutOverride(maps ...ResMap) (ResMap, error)
- func (m ResMap) DeepCopy(rf *resource.Factory) ResMap
- func (m ResMap) DemandOneMatchForId(inputId resid.ResId) (*resource.Resource, bool)
- func (m ResMap) EncodeAsYaml() ([]byte, error)
- func (m ResMap) ErrorIfNotEqual(m2 ResMap) error
- func (m ResMap) FilterBy(inputId resid.ResId) ResMap
- func (m ResMap) FindByGVKN(inputId resid.ResId) []resid.ResId
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory makes instances of ResMap.
func NewFactory ¶
NewFactory returns a new resmap.Factory.
func (*Factory) FromFiles ¶
FromFiles returns a ResMap given a resource path slice.
func (*Factory) NewResMapFromConfigMapArgs ¶
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 ¶
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 ¶
RF returns a resource.Factory.
func (*Factory) Set ¶
func (rmF *Factory) Set(fs fs.FileSystem, ldr ifc.Loader)
Set sets the filesystem and loader for the underlying factory
type IdSlice ¶
IdSlice implements the sort interface.
func (IdSlice) Len ¶
func (IdSlice) Less ¶
func (IdSlice) Swap ¶
type ResMap ¶
ResMap is a map from ResId to Resource.
func MergeWithOverride ¶
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 MergeWithoutOverride ¶
MergeWithoutOverride combines multiple ResMap instances, failing on key collision and skipping nil maps. In case if all of the maps are nil, an empty ResMap is returned.
func (ResMap) DeepCopy ¶
DeepCopy clone the resmap into a new one
func (ResMap) DemandOneMatchForId ¶
DemandOneMatchForId find the matched resource by Group/Version/Kind and Name
func (ResMap) EncodeAsYaml ¶
EncodeAsYaml encodes a ResMap to YAML; encoded objects separated by `---`.
func (ResMap) ErrorIfNotEqual ¶
ErrorIfNotEqual returns error if maps are not equal.
func (ResMap) FilterBy ¶
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) FindByGVKN ¶
FindByGVKN find the matched ResIds by Group/Version/Kind and Name
Source Files ¶
factory.go idslice.go resmap.go
- Version
- v1.0.11 (latest)
- Published
- Nov 29, 2018
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 11 hours ago –
Tools for package owners.