kustomize: sigs.k8s.io/kustomize/pkg/resource Index | Files

package resource

import "sigs.k8s.io/kustomize/pkg/resource"

Package resource implements representations of k8s API resources as "unstructured" objects.


Package Files

factory.go resource.go

type Factory Uses

type Factory struct {
    // contains filtered or unexported fields

Factory makes instances of Resource.

func NewFactory Uses

func NewFactory(kf ifc.KunstructuredFactory) *Factory

NewFactory makes an instance of Factory.

func (*Factory) FromBytes Uses

func (rf *Factory) FromBytes(in []byte) (*Resource, error)

FromBytes unmarshals bytes into one Resource.

func (*Factory) FromKunstructured Uses

func (rf *Factory) FromKunstructured(u ifc.Kunstructured) *Resource

FromKunstructured returns a new instance of Resource.

func (*Factory) FromMap Uses

func (rf *Factory) FromMap(m map[string]interface{}) *Resource

FromMap returns a new instance of Resource.

func (*Factory) FromMapAndOption Uses

func (rf *Factory) FromMapAndOption(
    m map[string]interface{}, args *types.GeneratorArgs, option *types.GeneratorOptions) *Resource

FromMapAndOption returns a new instance of Resource with given options.

func (*Factory) FromMapWithName Uses

func (rf *Factory) FromMapWithName(n string, m map[string]interface{}) *Resource

FromMapWithName returns a new instance with the given "original" name.

func (*Factory) FromMapWithNamespace Uses

func (rf *Factory) FromMapWithNamespace(n string, m map[string]interface{}) *Resource

FromMapWithNamespace returns a new instance with the given "original" namespace.

func (*Factory) FromMapWithNamespaceAndName Uses

func (rf *Factory) FromMapWithNamespaceAndName(ns string, n string, m map[string]interface{}) *Resource

FromMapWithNamespaceAndName returns a new instance with the given "original" namespace.

func (*Factory) Hasher Uses

func (rf *Factory) Hasher() ifc.KunstructuredHasher

func (*Factory) MakeConfigMap Uses

func (rf *Factory) MakeConfigMap(
    ldr ifc.Loader,
    options *types.GeneratorOptions,
    args *types.ConfigMapArgs) (*Resource, error)

MakeConfigMap makes an instance of Resource for ConfigMap

func (*Factory) MakeSecret Uses

func (rf *Factory) MakeSecret(
    ldr ifc.Loader,
    options *types.GeneratorOptions,
    args *types.SecretArgs) (*Resource, error)

MakeSecret makes an instance of Resource for Secret

func (*Factory) SliceFromBytes Uses

func (rf *Factory) SliceFromBytes(in []byte) ([]*Resource, error)

SliceFromBytes unmarshals bytes into a Resource slice.

func (*Factory) SliceFromPatches Uses

func (rf *Factory) SliceFromPatches(
    ldr ifc.Loader, paths []types.PatchStrategicMerge) ([]*Resource, error)

SliceFromPatches returns a slice of resources given a patch path slice from a kustomization file.

type ResCtx Uses

type ResCtx interface {
    AddNamePrefix(p string)
    AddNameSuffix(s string)
    GetOutermostNamePrefix() string
    GetOutermostNameSuffix() string
    GetNamePrefixes() []string
    GetNameSuffixes() []string

ResCtx is an interface describing the contextual added kept kustomize in the context of each Resource object. Currently mainly the name prefix and name suffix are added.

type ResCtxMatcher Uses

type ResCtxMatcher func(ResCtx) bool

ResCtxMatcher returns true if two Resources are being modified in the same kustomize context.

type Resource Uses

type Resource struct {
    // contains filtered or unexported fields

Resource is map representation of a Kubernetes API resource object paired with a GenerationBehavior.

func (*Resource) AddNamePrefix Uses

func (r *Resource) AddNamePrefix(p string)

Implements ResCtx AddNamePrefix

func (*Resource) AddNameSuffix Uses

func (r *Resource) AddNameSuffix(s string)

Implements ResCtx AddNameSuffix

func (*Resource) AppendRefBy Uses

func (r *Resource) AppendRefBy(id resid.ResId)

AppendRefBy appends a ResId into the refBy list

func (*Resource) AppendRefVarName Uses

func (r *Resource) AppendRefVarName(variable types.Var)

AppendRefVarName appends a name of a var into the refVar list

func (*Resource) AsYAML Uses

func (r *Resource) AsYAML() ([]byte, error)

AsYAML returns the resource in Yaml form. Easier to read than JSON.

func (*Resource) Behavior Uses

func (r *Resource) Behavior() types.GenerationBehavior

Behavior returns the behavior for the resource.

func (*Resource) CurId Uses

func (r *Resource) CurId() resid.ResId

CurId returns a ResId for the resource using the mutable parts of the resource. This should be unique in any ResMap.

func (*Resource) DeepCopy Uses

func (r *Resource) DeepCopy() *Resource

DeepCopy returns a new copy of resource

func (*Resource) Equals Uses

func (r *Resource) Equals(o *Resource) bool

func (*Resource) GetNamePrefixes Uses

func (r *Resource) GetNamePrefixes() []string

Implements ResCtx GetNamePrefixes

func (*Resource) GetNameSuffixes Uses

func (r *Resource) GetNameSuffixes() []string

Implements ResCtx GetNameSuffixes

func (*Resource) GetNamespace Uses

func (r *Resource) GetNamespace() string

GetNamespace returns the namespace the resource thinks it's in.

func (*Resource) GetOriginalName Uses

func (r *Resource) GetOriginalName() string

func (*Resource) GetOriginalNs Uses

func (r *Resource) GetOriginalNs() string

func (*Resource) GetOutermostNamePrefix Uses

func (r *Resource) GetOutermostNamePrefix() string

Implements ResCtx GetOutermostNamePrefix

func (*Resource) GetOutermostNameSuffix Uses

func (r *Resource) GetOutermostNameSuffix() string

Implements ResCtx GetOutermostNameSuffix

func (*Resource) GetRefBy Uses

func (r *Resource) GetRefBy() []resid.ResId

GetRefBy returns the ResIds that referred to current resource

func (*Resource) GetRefVarNames Uses

func (r *Resource) GetRefVarNames() []string

GetRefVarNames returns vars that refer to current resource

func (*Resource) InSameKustomizeCtx Uses

func (r *Resource) InSameKustomizeCtx(rctxm ResCtxMatcher) bool

This is used to compute if a referrer could potentially be impacted by the change of name of a referral.

func (*Resource) KunstructEqual Uses

func (r *Resource) KunstructEqual(o *Resource) bool

func (*Resource) Merge Uses

func (r *Resource) Merge(other *Resource)

Merge performs merge with other resource.

func (*Resource) NeedHashSuffix Uses

func (r *Resource) NeedHashSuffix() bool

NeedHashSuffix checks if the resource need a hash suffix

func (*Resource) OrgId Uses

func (r *Resource) OrgId() resid.ResId

OrgId returns the original, immutable ResId for the resource. This doesn't have to be unique in a ResMap. TODO: compute this once and save it in the resource.

func (*Resource) OutermostPrefixSuffixEquals Uses

func (r *Resource) OutermostPrefixSuffixEquals(o ResCtx) bool

OutermostPrefixSuffixEquals returns true if both resources outer suffix and prefix matches.

func (*Resource) PrefixesSuffixesEquals Uses

func (r *Resource) PrefixesSuffixesEquals(o ResCtx) bool

PrefixesSuffixesEquals is conceptually doing the same task as OutermostPrefixSuffix but performs a deeper comparison of the suffix and prefix slices.

Important note: The PrefixSuffixTransformer is stacking the prefix values in the reverse order of appearance in the transformed name. For this reason the sameEndingSubarray method is used (as opposed to the sameBeginningSubarray) to compare the prefix slice. In the same spirit, the GetOutermostNamePrefix is using the last element of the nameprefix slice and not the first.

func (*Resource) ReferencesEqual Uses

func (r *Resource) ReferencesEqual(o *Resource) bool

func (*Resource) Replace Uses

func (r *Resource) Replace(other *Resource)

Replace performs replace with other resource.

func (*Resource) String Uses

func (r *Resource) String() string

String returns resource as JSON.

Package resource imports 10 packages (graph) and is imported by 8 packages. Updated 2019-09-05. Refresh now. Tools for package owners.