mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
add an option to include local configs
This commit is contained in:
@@ -22,6 +22,11 @@ import (
|
||||
// Factory makes instances of Resource.
|
||||
type Factory struct {
|
||||
hasher ifc.KustHasher
|
||||
|
||||
// IncludeLocalConfigs indicates should resource factory ignore
|
||||
// the resources which have annotation 'config.kubernetes.io/local-config'.
|
||||
// By default it's false.
|
||||
IncludeLocalConfigs bool
|
||||
}
|
||||
|
||||
// NewFactory makes an instance of Factory.
|
||||
@@ -221,13 +226,15 @@ func (rf *Factory) shouldIgnore(n *yaml.RNode) (bool, error) {
|
||||
if n.IsNilOrEmpty() {
|
||||
return true, nil
|
||||
}
|
||||
md, err := n.GetValidatedMetadata()
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
_, ignore := md.ObjectMeta.Annotations[konfig.IgnoredByKustomizeAnnotation]
|
||||
if ignore {
|
||||
return true, nil
|
||||
if !rf.IncludeLocalConfigs {
|
||||
md, err := n.GetValidatedMetadata()
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
_, ignore := md.ObjectMeta.Annotations[konfig.IgnoredByKustomizeAnnotation]
|
||||
if ignore {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
if foundNil, path := n.HasNilEntryInList(); foundNil {
|
||||
return true, fmt.Errorf("empty item at %v in object %v", path, n)
|
||||
|
||||
Reference in New Issue
Block a user