change: components apply after all generators and transformers applied (#5170)

* change: components apply after all generator and transformer applied

* fix name for a test case

* add comment about when the components will be executed

* components are applied before transformer
This commit is contained in:
yugo kobayashi
2023-06-03 02:26:54 +09:00
committed by GitHub
parent 6ce0bf390c
commit 0add0f95e2
3 changed files with 125 additions and 11 deletions

View File

@@ -202,10 +202,6 @@ func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator) (
if err != nil {
return nil, errors.WrapPrefixf(err, "accumulating resources")
}
ra, err = kt.accumulateComponents(ra, kt.kustomization.Components)
if err != nil {
return nil, errors.WrapPrefixf(err, "accumulating components")
}
tConfig, err := builtinconfig.MakeTransformerConfig(
kt.ldr, kt.kustomization.Configurations)
if err != nil {
@@ -230,6 +226,14 @@ func (kt *KustTarget) accumulateTarget(ra *accumulator.ResAccumulator) (
if err != nil {
return nil, err
}
// components are expected to execute after reading resources and adding generators ,before applying transformers and validation.
// https://github.com/kubernetes-sigs/kustomize/pull/5170#discussion_r1212101287
ra, err = kt.accumulateComponents(ra, kt.kustomization.Components)
if err != nil {
return nil, errors.WrapPrefixf(err, "accumulating components")
}
err = kt.runTransformers(ra)
if err != nil {
return nil, err