Refactor the PrefixSuffixTransformer into separate prefix- and suffix transformers (#4318)

* Refactor prefix filter into its own filter, decoupled from the prefixsuffix filter

* Refactor prefix transformer into its own transformer, decoupled from the prefixsuffix transformer

* Refactor suffix filter into its own filter, decoupled from the prefixsuffix filter

* Refactor suffix transformer into its own transformer, decoupled from the prefixsuffix transformer

* Add a default nameSuffix field spec in addition to the namePrefix

* Remove the PrefixSuffixTransformer from the list of builtin transformers

* Add a multi-transformer to builtinhelpers.TransformFactories

* Remove the implementation of the prefixsuffixtransformer.PrefixSuffixTransformer

* Resolve style and format related feedback from the pull request

* Add test to test the legacy PrefixSuffixTransformer for BC purposes
This commit is contained in:
Julian
2021-12-22 12:01:06 -08:00
committed by GitHub
parent 3608f335fd
commit 3dbc88bf94
33 changed files with 1019 additions and 181 deletions

View File

@@ -7,6 +7,7 @@ import (
"testing"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
"sigs.k8s.io/kustomize/api/types"
)
// Demo custom configuration as a base.
@@ -15,9 +16,9 @@ import (
// kustomizations.
func TestReusableCustomTransformers(t *testing.T) {
th := kusttest_test.MakeEnhancedHarness(t).
PrepBuiltin("PrefixSuffixTransformer").
PrepBuiltin("AnnotationsTransformer").
PrepBuiltin("LabelTransformer")
th.GetPluginConfig().BpLoadingOptions = types.BploUseStaticallyLinked
defer th.Reset()
// First write three custom configurations for builtin plugins.