mirror of
https://github.com/fluxcd/flux2.git
synced 2025-10-27 04:34:51 +08:00
refactor: convert Kustomization resource into unstructured map only once during variable substitution
Signed-off-by: Ramasai Venkatsitarambhaskar Tadepalli <ramasai.tadepalli@mongodb.com>
This commit is contained in:
parent
0fe4449870
commit
2bb7f38603
@ -520,13 +520,16 @@ func (b *Builder) do(ctx context.Context, kustomization kustomizev1.Kustomizatio
|
|||||||
return nil, fmt.Errorf("kustomize build failed: %w", err)
|
return nil, fmt.Errorf("kustomize build failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, res := range m.Resources() {
|
if kustomization.Spec.PostBuild == nil {
|
||||||
// run variable substitutions
|
return m, nil
|
||||||
if kustomization.Spec.PostBuild != nil {
|
}
|
||||||
|
|
||||||
data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&kustomization)
|
data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&kustomization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
for _, res := range m.Resources() {
|
||||||
|
// run variable substitutions
|
||||||
outRes, err := kustomize.SubstituteVariables(ctx,
|
outRes, err := kustomize.SubstituteVariables(ctx,
|
||||||
b.client,
|
b.client,
|
||||||
unstructured.Unstructured{Object: data},
|
unstructured.Unstructured{Object: data},
|
||||||
@ -545,7 +548,6 @@ func (b *Builder) do(ctx context.Context, kustomization kustomizev1.Kustomizatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user