Add --strict-substitute flag to flux build and flux diff ks commands
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -80,6 +80,7 @@ type Builder struct {
|
||||
timeout time.Duration
|
||||
spinner *yacspin.Spinner
|
||||
dryRun bool
|
||||
strictSubst bool
|
||||
}
|
||||
|
||||
// BuilderOptionFunc is a function that configures a Builder
|
||||
@@ -158,6 +159,14 @@ func WithDryRun(dryRun bool) BuilderOptionFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// WithStrictSubstitute sets the strict substitute flag
|
||||
func WithStrictSubstitute(strictSubstitute bool) BuilderOptionFunc {
|
||||
return func(b *Builder) error {
|
||||
b.strictSubst = strictSubstitute
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithIgnore sets ignore field
|
||||
func WithIgnore(ignore []string) BuilderOptionFunc {
|
||||
return func(b *Builder) error {
|
||||
@@ -391,7 +400,13 @@ func (b *Builder) do(ctx context.Context, kustomization kustomizev1.Kustomizatio
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
outRes, err := kustomize.SubstituteVariables(ctx, b.client, unstructured.Unstructured{Object: data}, res, b.dryRun)
|
||||
outRes, err := kustomize.SubstituteVariables(ctx,
|
||||
b.client,
|
||||
unstructured.Unstructured{Object: data},
|
||||
res,
|
||||
kustomize.SubstituteWithDryRun(b.dryRun),
|
||||
kustomize.SubstituteWithStrict(b.strictSubst),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("var substitution failed for '%s': %w", res.GetName(), err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user