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

@@ -6,6 +6,8 @@ package krusty_test
import (
"testing"
"sigs.k8s.io/kustomize/api/types"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)
@@ -13,8 +15,8 @@ import (
// This is a NamePrefixer that touches Deployments
// and Services exclusively.
func TestCustomNamePrefixer(t *testing.T) {
th := kusttest_test.MakeEnhancedHarness(t).
PrepBuiltin("PrefixSuffixTransformer")
th := kusttest_test.MakeEnhancedHarness(t)
th.GetPluginConfig().BpLoadingOptions = types.BploUseStaticallyLinked
defer th.Reset()
th.WriteK(".", `