mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 09:24:23 +00:00
move origin to be an attribute of KustTarget
This commit is contained in:
@@ -35,6 +35,7 @@ type KustTarget struct {
|
|||||||
validator ifc.Validator
|
validator ifc.Validator
|
||||||
rFactory *resmap.Factory
|
rFactory *resmap.Factory
|
||||||
pLdr *loader.Loader
|
pLdr *loader.Loader
|
||||||
|
origin *resource.Origin
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKustTarget returns a new instance of KustTarget.
|
// NewKustTarget returns a new instance of KustTarget.
|
||||||
@@ -122,7 +123,8 @@ func (kt *KustTarget) makeCustomizedResMap() (resmap.ResMap, error) {
|
|||||||
if len(kt.kustomization.BuildMetadata) != 0 {
|
if len(kt.kustomization.BuildMetadata) != 0 {
|
||||||
origin = &resource.Origin{}
|
origin = &resource.Origin{}
|
||||||
}
|
}
|
||||||
ra, err := kt.AccumulateTarget(origin)
|
kt.origin = origin
|
||||||
|
ra, err := kt.AccumulateTarget()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -174,20 +176,20 @@ func (kt *KustTarget) addHashesToNames(
|
|||||||
// through kustomization directories, it updates `origin.path`
|
// through kustomization directories, it updates `origin.path`
|
||||||
// accordingly. When a remote base is found, it updates `origin.repo`
|
// accordingly. When a remote base is found, it updates `origin.repo`
|
||||||
// and `origin.ref` accordingly.
|
// and `origin.ref` accordingly.
|
||||||
func (kt *KustTarget) AccumulateTarget(origin *resource.Origin) (
|
func (kt *KustTarget) AccumulateTarget() (
|
||||||
ra *accumulator.ResAccumulator, err error) {
|
ra *accumulator.ResAccumulator, err error) {
|
||||||
return kt.accumulateTarget(accumulator.MakeEmptyAccumulator(), origin)
|
return kt.accumulateTarget(accumulator.MakeEmptyAccumulator())
|
||||||
}
|
}
|
||||||
|
|
||||||
// ra should be empty when this KustTarget is a Kustomization, or the ra of the parent if this KustTarget is a Component
|
// ra should be empty when this KustTarget is a Kustomization, or the ra of the parent if this KustTarget is a Component
|
||||||
// (or empty if the Component does not have a parent).
|
// (or empty if the Component does not have a parent).
|
||||||
func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator, origin *resource.Origin) (
|
func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator) (
|
||||||
resRa *accumulator.ResAccumulator, err error) {
|
resRa *accumulator.ResAccumulator, err error) {
|
||||||
ra, err = kt.accumulateResources(ra, kt.kustomization.Resources, origin)
|
ra, err = kt.accumulateResources(ra, kt.kustomization.Resources)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "accumulating resources")
|
return nil, errors.Wrap(err, "accumulating resources")
|
||||||
}
|
}
|
||||||
ra, err = kt.accumulateComponents(ra, kt.kustomization.Components, origin)
|
ra, err = kt.accumulateComponents(ra, kt.kustomization.Components)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "accumulating components")
|
return nil, errors.Wrap(err, "accumulating components")
|
||||||
}
|
}
|
||||||
@@ -211,11 +213,11 @@ func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator, origin *r
|
|||||||
return nil, errors.Wrapf(
|
return nil, errors.Wrapf(
|
||||||
err, "merging CRDs %v", crdTc)
|
err, "merging CRDs %v", crdTc)
|
||||||
}
|
}
|
||||||
err = kt.runGenerators(ra, origin)
|
err = kt.runGenerators(ra)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = kt.runTransformers(ra, origin)
|
err = kt.runTransformers(ra)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -249,15 +251,15 @@ func (kt *KustTarget) IgnoreLocal(ra *accumulator.ResAccumulator) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) runGenerators(
|
func (kt *KustTarget) runGenerators(
|
||||||
ra *accumulator.ResAccumulator, origin *resource.Origin) error {
|
ra *accumulator.ResAccumulator) error {
|
||||||
var generators []*resmap.GeneratorWithProperties
|
var generators []*resmap.GeneratorWithProperties
|
||||||
gs, err := kt.configureBuiltinGenerators(origin)
|
gs, err := kt.configureBuiltinGenerators()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
generators = append(generators, gs...)
|
generators = append(generators, gs...)
|
||||||
|
|
||||||
gs, err = kt.configureExternalGenerators(origin)
|
gs, err = kt.configureExternalGenerators()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "loading generator plugins")
|
return errors.Wrap(err, "loading generator plugins")
|
||||||
}
|
}
|
||||||
@@ -281,7 +283,7 @@ func (kt *KustTarget) runGenerators(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) configureExternalGenerators(origin *resource.Origin) (
|
func (kt *KustTarget) configureExternalGenerators() (
|
||||||
[]*resmap.GeneratorWithProperties, error) {
|
[]*resmap.GeneratorWithProperties, error) {
|
||||||
ra := accumulator.MakeEmptyAccumulator()
|
ra := accumulator.MakeEmptyAccumulator()
|
||||||
var generatorPaths []string
|
var generatorPaths []string
|
||||||
@@ -294,31 +296,31 @@ func (kt *KustTarget) configureExternalGenerators(origin *resource.Origin) (
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// inline config, track the origin
|
// inline config, track the origin
|
||||||
if origin != nil {
|
if kt.origin != nil {
|
||||||
resources := rm.Resources()
|
resources := rm.Resources()
|
||||||
for _, r := range resources {
|
for _, r := range resources {
|
||||||
r.SetOrigin(origin.Append(kt.kustFileName))
|
r.SetOrigin(kt.origin.Append(kt.kustFileName))
|
||||||
rm.Replace(r)
|
rm.Replace(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ra.AppendAll(rm)
|
ra.AppendAll(rm)
|
||||||
}
|
}
|
||||||
ra, err := kt.accumulateResources(ra, generatorPaths, origin)
|
ra, err := kt.accumulateResources(ra, generatorPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return kt.pLdr.LoadGenerators(kt.ldr, kt.validator, ra.ResMap())
|
return kt.pLdr.LoadGenerators(kt.ldr, kt.validator, ra.ResMap())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) runTransformers(ra *accumulator.ResAccumulator, origin *resource.Origin) error {
|
func (kt *KustTarget) runTransformers(ra *accumulator.ResAccumulator) error {
|
||||||
var r []*resmap.TransformerWithProperties
|
var r []*resmap.TransformerWithProperties
|
||||||
tConfig := ra.GetTransformerConfig()
|
tConfig := ra.GetTransformerConfig()
|
||||||
lts, err := kt.configureBuiltinTransformers(tConfig, origin)
|
lts, err := kt.configureBuiltinTransformers(tConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
r = append(r, lts...)
|
r = append(r, lts...)
|
||||||
lts, err = kt.configureExternalTransformers(kt.kustomization.Transformers, origin)
|
lts, err = kt.configureExternalTransformers(kt.kustomization.Transformers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -330,7 +332,7 @@ func (kt *KustTarget) runTransformers(ra *accumulator.ResAccumulator, origin *re
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) configureExternalTransformers(transformers []string, origin *resource.Origin) ([]*resmap.TransformerWithProperties, error) {
|
func (kt *KustTarget) configureExternalTransformers(transformers []string) ([]*resmap.TransformerWithProperties, error) {
|
||||||
ra := accumulator.MakeEmptyAccumulator()
|
ra := accumulator.MakeEmptyAccumulator()
|
||||||
var transformerPaths []string
|
var transformerPaths []string
|
||||||
for _, p := range transformers {
|
for _, p := range transformers {
|
||||||
@@ -342,16 +344,16 @@ func (kt *KustTarget) configureExternalTransformers(transformers []string, origi
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// inline config, track the origin
|
// inline config, track the origin
|
||||||
if origin != nil {
|
if kt.origin != nil {
|
||||||
resources := rm.Resources()
|
resources := rm.Resources()
|
||||||
for _, r := range resources {
|
for _, r := range resources {
|
||||||
r.SetOrigin(origin.Append(kt.kustFileName))
|
r.SetOrigin(kt.origin.Append(kt.kustFileName))
|
||||||
rm.Replace(r)
|
rm.Replace(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ra.AppendAll(rm)
|
ra.AppendAll(rm)
|
||||||
}
|
}
|
||||||
ra, err := kt.accumulateResources(ra, transformerPaths, origin)
|
ra, err := kt.accumulateResources(ra, transformerPaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -359,7 +361,7 @@ func (kt *KustTarget) configureExternalTransformers(transformers []string, origi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) runValidators(ra *accumulator.ResAccumulator) error {
|
func (kt *KustTarget) runValidators(ra *accumulator.ResAccumulator) error {
|
||||||
validators, err := kt.configureExternalTransformers(kt.kustomization.Validators, nil)
|
validators, err := kt.configureExternalTransformers(kt.kustomization.Validators)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -399,10 +401,10 @@ func (kt *KustTarget) removeValidatedByLabel(rm resmap.ResMap) error {
|
|||||||
// accumulateResources fills the given resourceAccumulator
|
// accumulateResources fills the given resourceAccumulator
|
||||||
// with resources read from the given list of paths.
|
// with resources read from the given list of paths.
|
||||||
func (kt *KustTarget) accumulateResources(
|
func (kt *KustTarget) accumulateResources(
|
||||||
ra *accumulator.ResAccumulator, paths []string, origin *resource.Origin) (*accumulator.ResAccumulator, error) {
|
ra *accumulator.ResAccumulator, paths []string) (*accumulator.ResAccumulator, error) {
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
// try loading resource as file then as base (directory or git repository)
|
// try loading resource as file then as base (directory or git repository)
|
||||||
if errF := kt.accumulateFile(ra, path, origin); errF != nil {
|
if errF := kt.accumulateFile(ra, path); errF != nil {
|
||||||
// not much we can do if the error is an HTTP error so we bail out
|
// not much we can do if the error is an HTTP error so we bail out
|
||||||
if errors.Is(errF, load.ErrorHTTP) {
|
if errors.Is(errF, load.ErrorHTTP) {
|
||||||
return nil, errF
|
return nil, errF
|
||||||
@@ -412,10 +414,15 @@ func (kt *KustTarget) accumulateResources(
|
|||||||
return nil, errors.Wrapf(
|
return nil, errors.Wrapf(
|
||||||
err, "accumulation err='%s'", errF.Error())
|
err, "accumulation err='%s'", errF.Error())
|
||||||
}
|
}
|
||||||
if origin != nil {
|
// store the origin, we'll need it later
|
||||||
ra, err = kt.accumulateDirectory(ra, ldr, origin.Append(path), false)
|
origin := kt.origin.Copy()
|
||||||
|
if kt.origin != nil {
|
||||||
|
kt.origin = kt.origin.Append(path)
|
||||||
|
ra, err = kt.accumulateDirectory(ra, ldr, false)
|
||||||
|
// after we are done recursing through the directory, reset the origin
|
||||||
|
kt.origin = &origin
|
||||||
} else {
|
} else {
|
||||||
ra, err = kt.accumulateDirectory(ra, ldr, nil, false)
|
ra, err = kt.accumulateDirectory(ra, ldr, false)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(
|
return nil, errors.Wrapf(
|
||||||
@@ -429,7 +436,7 @@ func (kt *KustTarget) accumulateResources(
|
|||||||
// accumulateResources fills the given resourceAccumulator
|
// accumulateResources fills the given resourceAccumulator
|
||||||
// with resources read from the given list of paths.
|
// with resources read from the given list of paths.
|
||||||
func (kt *KustTarget) accumulateComponents(
|
func (kt *KustTarget) accumulateComponents(
|
||||||
ra *accumulator.ResAccumulator, paths []string, origin *resource.Origin) (*accumulator.ResAccumulator, error) {
|
ra *accumulator.ResAccumulator, paths []string) (*accumulator.ResAccumulator, error) {
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
// Components always refer to directories
|
// Components always refer to directories
|
||||||
ldr, errL := kt.ldr.New(path)
|
ldr, errL := kt.ldr.New(path)
|
||||||
@@ -437,10 +444,15 @@ func (kt *KustTarget) accumulateComponents(
|
|||||||
return nil, fmt.Errorf("loader.New %q", errL)
|
return nil, fmt.Errorf("loader.New %q", errL)
|
||||||
}
|
}
|
||||||
var errD error
|
var errD error
|
||||||
if origin != nil {
|
// store the origin, we'll need it later
|
||||||
ra, errD = kt.accumulateDirectory(ra, ldr, origin.Append(path), true)
|
origin := kt.origin.Copy()
|
||||||
|
if kt.origin != nil {
|
||||||
|
kt.origin = kt.origin.Append(path)
|
||||||
|
ra, errD = kt.accumulateDirectory(ra, ldr, true)
|
||||||
|
// after we are done recursing through the directory, reset the origin
|
||||||
|
kt.origin = &origin
|
||||||
} else {
|
} else {
|
||||||
ra, errD = kt.accumulateDirectory(ra, ldr, nil, true)
|
ra, errD = kt.accumulateDirectory(ra, ldr, true)
|
||||||
}
|
}
|
||||||
if errD != nil {
|
if errD != nil {
|
||||||
return nil, fmt.Errorf("accumulateDirectory: %q", errD)
|
return nil, fmt.Errorf("accumulateDirectory: %q", errD)
|
||||||
@@ -450,7 +462,7 @@ func (kt *KustTarget) accumulateComponents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) accumulateDirectory(
|
func (kt *KustTarget) accumulateDirectory(
|
||||||
ra *accumulator.ResAccumulator, ldr ifc.Loader, origin *resource.Origin, isComponent bool) (*accumulator.ResAccumulator, error) {
|
ra *accumulator.ResAccumulator, ldr ifc.Loader, isComponent bool) (*accumulator.ResAccumulator, error) {
|
||||||
defer ldr.Cleanup()
|
defer ldr.Cleanup()
|
||||||
subKt := NewKustTarget(ldr, kt.validator, kt.rFactory, kt.pLdr)
|
subKt := NewKustTarget(ldr, kt.validator, kt.rFactory, kt.pLdr)
|
||||||
err := subKt.Load()
|
err := subKt.Load()
|
||||||
@@ -459,6 +471,7 @@ func (kt *KustTarget) accumulateDirectory(
|
|||||||
err, "couldn't make target for path '%s'", ldr.Root())
|
err, "couldn't make target for path '%s'", ldr.Root())
|
||||||
}
|
}
|
||||||
subKt.kustomization.BuildMetadata = kt.kustomization.BuildMetadata
|
subKt.kustomization.BuildMetadata = kt.kustomization.BuildMetadata
|
||||||
|
subKt.origin = kt.origin
|
||||||
var bytes []byte
|
var bytes []byte
|
||||||
path := ldr.Root()
|
path := ldr.Root()
|
||||||
if openApiPath, exists := subKt.Kustomization().OpenAPI["path"]; exists {
|
if openApiPath, exists := subKt.Kustomization().OpenAPI["path"]; exists {
|
||||||
@@ -482,12 +495,12 @@ func (kt *KustTarget) accumulateDirectory(
|
|||||||
var subRa *accumulator.ResAccumulator
|
var subRa *accumulator.ResAccumulator
|
||||||
if isComponent {
|
if isComponent {
|
||||||
// Components don't create a new accumulator: the kustomization directives are added to the current accumulator
|
// Components don't create a new accumulator: the kustomization directives are added to the current accumulator
|
||||||
subRa, err = subKt.accumulateTarget(ra, origin)
|
subRa, err = subKt.accumulateTarget(ra)
|
||||||
ra = accumulator.MakeEmptyAccumulator()
|
ra = accumulator.MakeEmptyAccumulator()
|
||||||
} else {
|
} else {
|
||||||
// Child Kustomizations create a new accumulator which resolves their kustomization directives, which will later
|
// Child Kustomizations create a new accumulator which resolves their kustomization directives, which will later
|
||||||
// be merged into the current accumulator.
|
// be merged into the current accumulator.
|
||||||
subRa, err = subKt.AccumulateTarget(origin)
|
subRa, err = subKt.AccumulateTarget()
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(
|
return nil, errors.Wrapf(
|
||||||
@@ -502,13 +515,13 @@ func (kt *KustTarget) accumulateDirectory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) accumulateFile(
|
func (kt *KustTarget) accumulateFile(
|
||||||
ra *accumulator.ResAccumulator, path string, origin *resource.Origin) error {
|
ra *accumulator.ResAccumulator, path string) error {
|
||||||
resources, err := kt.rFactory.FromFile(kt.ldr, path)
|
resources, err := kt.rFactory.FromFile(kt.ldr, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "accumulating resources from '%s'", path)
|
return errors.Wrapf(err, "accumulating resources from '%s'", path)
|
||||||
}
|
}
|
||||||
if origin != nil {
|
if kt.origin != nil {
|
||||||
originAnno, err := origin.Append(path).String()
|
originAnno, err := kt.origin.Append(path).String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "cannot add path annotation for '%s'", path)
|
return errors.Wrapf(err, "cannot add path annotation for '%s'", path)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
// image tag transforms. In these cases, we'll need
|
// image tag transforms. In these cases, we'll need
|
||||||
// N plugin instances with differing configurations.
|
// N plugin instances with differing configurations.
|
||||||
|
|
||||||
func (kt *KustTarget) configureBuiltinGenerators(origin *resource.Origin) (
|
func (kt *KustTarget) configureBuiltinGenerators() (
|
||||||
result []*resmap.GeneratorWithProperties, err error) {
|
result []*resmap.GeneratorWithProperties, err error) {
|
||||||
for _, bpt := range []builtinhelpers.BuiltinPluginType{
|
for _, bpt := range []builtinhelpers.BuiltinPluginType{
|
||||||
builtinhelpers.ConfigMapGenerator,
|
builtinhelpers.ConfigMapGenerator,
|
||||||
@@ -44,11 +44,11 @@ func (kt *KustTarget) configureBuiltinGenerators(origin *resource.Origin) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
var generatorOrigin *resource.Origin
|
var generatorOrigin *resource.Origin
|
||||||
if origin != nil {
|
if kt.origin != nil {
|
||||||
generatorOrigin = &resource.Origin{
|
generatorOrigin = &resource.Origin{
|
||||||
Repo: origin.Repo,
|
Repo: kt.origin.Repo,
|
||||||
Ref: origin.Ref,
|
Ref: kt.origin.Ref,
|
||||||
ConfiguredIn: filepath.Join(origin.Path, kt.kustFileName),
|
ConfiguredIn: filepath.Join(kt.origin.Path, kt.kustFileName),
|
||||||
ConfiguredBy: yaml.ResourceIdentifier{
|
ConfiguredBy: yaml.ResourceIdentifier{
|
||||||
TypeMeta: yaml.TypeMeta{
|
TypeMeta: yaml.TypeMeta{
|
||||||
APIVersion: "builtin",
|
APIVersion: "builtin",
|
||||||
@@ -66,7 +66,7 @@ func (kt *KustTarget) configureBuiltinGenerators(origin *resource.Origin) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (kt *KustTarget) configureBuiltinTransformers(
|
func (kt *KustTarget) configureBuiltinTransformers(
|
||||||
tc *builtinconfig.TransformerConfig, origin *resource.Origin) (
|
tc *builtinconfig.TransformerConfig) (
|
||||||
result []*resmap.TransformerWithProperties, err error) {
|
result []*resmap.TransformerWithProperties, err error) {
|
||||||
for _, bpt := range []builtinhelpers.BuiltinPluginType{
|
for _, bpt := range []builtinhelpers.BuiltinPluginType{
|
||||||
builtinhelpers.PatchStrategicMergeTransformer,
|
builtinhelpers.PatchStrategicMergeTransformer,
|
||||||
@@ -87,11 +87,11 @@ func (kt *KustTarget) configureBuiltinTransformers(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var transformerOrigin *resource.Origin
|
var transformerOrigin *resource.Origin
|
||||||
if origin != nil {
|
if kt.origin != nil {
|
||||||
transformerOrigin = &resource.Origin{
|
transformerOrigin = &resource.Origin{
|
||||||
Repo: origin.Repo,
|
Repo: kt.origin.Repo,
|
||||||
Ref: origin.Ref,
|
Ref: kt.origin.Ref,
|
||||||
ConfiguredIn: filepath.Join(origin.Path, kt.kustFileName),
|
ConfiguredIn: filepath.Join(kt.origin.Path, kt.kustFileName),
|
||||||
ConfiguredBy: yaml.ResourceIdentifier{
|
ConfiguredBy: yaml.ResourceIdentifier{
|
||||||
TypeMeta: yaml.TypeMeta{
|
TypeMeta: yaml.TypeMeta{
|
||||||
APIVersion: "builtin",
|
APIVersion: "builtin",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/resource"
|
|
||||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||||
@@ -66,7 +65,7 @@ vars:
|
|||||||
apiVersion: v300
|
apiVersion: v300
|
||||||
`)
|
`)
|
||||||
ra, err := makeAndLoadKustTarget(
|
ra, err := makeAndLoadKustTarget(
|
||||||
t, th.GetFSys(), "/app").AccumulateTarget(&resource.Origin{})
|
t, th.GetFSys(), "/app").AccumulateTarget()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Err: %v", err)
|
t.Fatalf("Err: %v", err)
|
||||||
}
|
}
|
||||||
@@ -121,7 +120,7 @@ resources:
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
ra, err := makeAndLoadKustTarget(
|
ra, err := makeAndLoadKustTarget(
|
||||||
t, th.GetFSys(), "/app/overlays/o2").AccumulateTarget(&resource.Origin{})
|
t, th.GetFSys(), "/app/overlays/o2").AccumulateTarget()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Err: %v", err)
|
t.Fatalf("Err: %v", err)
|
||||||
}
|
}
|
||||||
@@ -178,7 +177,7 @@ resources:
|
|||||||
- ../o1
|
- ../o1
|
||||||
`)
|
`)
|
||||||
_, err := makeAndLoadKustTarget(
|
_, err := makeAndLoadKustTarget(
|
||||||
t, th.GetFSys(), "/app/overlays/o2").AccumulateTarget(&resource.Origin{})
|
t, th.GetFSys(), "/app/overlays/o2").AccumulateTarget()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("expected var collision")
|
t.Fatalf("expected var collision")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ const (
|
|||||||
ComponentKind = "Component"
|
ComponentKind = "Component"
|
||||||
MetadataNamespacePath = "metadata/namespace"
|
MetadataNamespacePath = "metadata/namespace"
|
||||||
|
|
||||||
OriginAnnotations = "originAnnotations"
|
OriginAnnotations = "originAnnotations"
|
||||||
TransformerAnnotations = "transformerAnnotations"
|
TransformerAnnotations = "transformerAnnotations"
|
||||||
ManagedByLabelOption = "managedByLabel"
|
ManagedByLabelOption = "managedByLabel"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Kustomization holds the information needed to generate customized k8s api resources.
|
// Kustomization holds the information needed to generate customized k8s api resources.
|
||||||
|
|||||||
Reference in New Issue
Block a user