mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-18 02:35:10 +00:00
Merge pull request #1651 from monopole/startApi
Start api directory, which will become the api module.
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package filesys
|
||||
package filesys_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestJoin(t *testing.T) {
|
||||
@@ -27,7 +29,8 @@ func TestJoin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPrefix_Slash(t *testing.T) {
|
||||
d, f, err := MakeFsInMemory().CleanedAbs("/")
|
||||
fSys := MakeFsInMemory()
|
||||
d, f, err := fSys.CleanedAbs("/")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package filesys
|
||||
package filesys_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestExists(t *testing.T) {
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package filesys
|
||||
package filesys_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func makeTestDir(t *testing.T) (FileSystem, string) {
|
||||
@@ -6,7 +6,7 @@ package hasher_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/v3/hasher"
|
||||
. "sigs.k8s.io/kustomize/v3/api/hasher"
|
||||
)
|
||||
|
||||
func TestSortArrayAndComputeHash(t *testing.T) {
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/provenance"
|
||||
"sigs.k8s.io/kustomize/v3/api/provenance"
|
||||
)
|
||||
|
||||
// TODO: delete this when we find a better way to generate release notes.
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/internal/loadertest"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/transformer"
|
||||
@@ -20,10 +21,12 @@ import (
|
||||
"sigs.k8s.io/kustomize/v3/pkg/target"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/transformers/config/defaultconfig"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// KustTestHarness helps test kustomization generation and transformation.
|
||||
// KustTestHarness is an environment for running a kustomize build,
|
||||
// aka a run of MakeCustomizedResMap. It holds a file loader
|
||||
// presumably primed with an in-memory file system, a plugin
|
||||
// loader, factories to make what it needs, etc.
|
||||
type KustTestHarness struct {
|
||||
t *testing.T
|
||||
rf *resmap.Factory
|
||||
@@ -36,12 +39,12 @@ func NewKustTestHarness(t *testing.T, path string) *KustTestHarness {
|
||||
t, path, loader.RestrictionRootOnly, plugins.DefaultPluginConfig())
|
||||
}
|
||||
|
||||
func NewKustTestPluginHarness(t *testing.T, path string) *KustTestHarness {
|
||||
func NewKustTestHarnessAllowPlugins(t *testing.T, path string) *KustTestHarness {
|
||||
return NewKustTestHarnessFull(
|
||||
t, path, loader.RestrictionRootOnly, plugins.ActivePluginConfig())
|
||||
}
|
||||
|
||||
func NewKustTestNoLoadRestrictorHarness(t *testing.T, path string) *KustTestHarness {
|
||||
func NewKustTestHarnessNoLoadRestrictor(t *testing.T, path string) *KustTestHarness {
|
||||
return NewKustTestHarnessFull(
|
||||
t, path, loader.RestrictionNone, plugins.DefaultPluginConfig())
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package pluglib
|
||||
package kusttest_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
@@ -15,9 +15,10 @@ import (
|
||||
"sigs.k8s.io/kustomize/v3/pkg/plugins"
|
||||
)
|
||||
|
||||
// EnvForTest manages the plugin test environment.
|
||||
// It sets/resets XDG_CONFIG_HOME, makes/removes a temp objRoot.
|
||||
type EnvForTest struct {
|
||||
// PluginTestEnv manages the plugin test environment.
|
||||
// It sets/resets XDG_CONFIG_HOME, makes/removes a temp objRoot,
|
||||
// manages a plugin compiler, etc.
|
||||
type PluginTestEnv struct {
|
||||
t *testing.T
|
||||
compiler *plugins.Compiler
|
||||
workDir string
|
||||
@@ -25,30 +26,30 @@ type EnvForTest struct {
|
||||
wasSet bool
|
||||
}
|
||||
|
||||
func NewEnvForTest(t *testing.T) *EnvForTest {
|
||||
return &EnvForTest{t: t}
|
||||
func NewPluginTestEnv(t *testing.T) *PluginTestEnv {
|
||||
return &PluginTestEnv{t: t}
|
||||
}
|
||||
|
||||
func (x *EnvForTest) Set() *EnvForTest {
|
||||
func (x *PluginTestEnv) Set() *PluginTestEnv {
|
||||
x.createWorkDir()
|
||||
x.compiler = x.makeCompiler()
|
||||
x.setEnv()
|
||||
return x
|
||||
}
|
||||
|
||||
func (x *EnvForTest) Reset() {
|
||||
func (x *PluginTestEnv) Reset() {
|
||||
x.resetEnv()
|
||||
x.removeWorkDir()
|
||||
}
|
||||
|
||||
func (x *EnvForTest) BuildGoPlugin(g, v, k string) {
|
||||
func (x *PluginTestEnv) BuildGoPlugin(g, v, k string) {
|
||||
err := x.compiler.Compile(g, v, k)
|
||||
if err != nil {
|
||||
x.t.Errorf("compile failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EnvForTest) BuildExecPlugin(g, v, k string) {
|
||||
func (x *PluginTestEnv) BuildExecPlugin(g, v, k string) {
|
||||
lowK := strings.ToLower(k)
|
||||
obj := filepath.Join(x.compiler.ObjRoot(), g, v, lowK, k)
|
||||
src := filepath.Join(x.compiler.SrcRoot(), g, v, lowK, k)
|
||||
@@ -62,7 +63,7 @@ func (x *EnvForTest) BuildExecPlugin(g, v, k string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EnvForTest) makeCompiler() *plugins.Compiler {
|
||||
func (x *PluginTestEnv) makeCompiler() *plugins.Compiler {
|
||||
// The plugin loader wants to find object code under
|
||||
// $XDG_CONFIG_HOME/kustomize/plugins
|
||||
// and the compiler writes object code to
|
||||
@@ -81,7 +82,7 @@ func (x *EnvForTest) makeCompiler() *plugins.Compiler {
|
||||
return plugins.NewCompiler(srcRoot, objRoot)
|
||||
}
|
||||
|
||||
func (x *EnvForTest) createWorkDir() {
|
||||
func (x *PluginTestEnv) createWorkDir() {
|
||||
var err error
|
||||
x.workDir, err = ioutil.TempDir("", "kustomize-plugin-tests")
|
||||
if err != nil {
|
||||
@@ -89,7 +90,7 @@ func (x *EnvForTest) createWorkDir() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EnvForTest) removeWorkDir() {
|
||||
func (x *PluginTestEnv) removeWorkDir() {
|
||||
err := os.RemoveAll(x.workDir)
|
||||
if err != nil {
|
||||
x.t.Errorf(
|
||||
@@ -97,12 +98,12 @@ func (x *EnvForTest) removeWorkDir() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EnvForTest) setEnv() {
|
||||
func (x *PluginTestEnv) setEnv() {
|
||||
x.oldXdg, x.wasSet = os.LookupEnv(pgmconfig.XdgConfigHome)
|
||||
os.Setenv(pgmconfig.XdgConfigHome, x.workDir)
|
||||
}
|
||||
|
||||
func (x *EnvForTest) resetEnv() {
|
||||
func (x *PluginTestEnv) resetEnv() {
|
||||
if x.wasSet {
|
||||
os.Setenv(pgmconfig.XdgConfigHome, x.oldXdg)
|
||||
} else {
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
var utf8bom = []byte{0xEF, 0xBB, 0xBF}
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
ldr "sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func makeKvLoader(fSys filesys.FileSystem) *loader {
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package gvk
|
||||
package resid
|
||||
|
||||
import (
|
||||
"strings"
|
||||
@@ -22,10 +22,10 @@ func FromKind(k string) Gvk {
|
||||
}
|
||||
}
|
||||
|
||||
// FromString makes a Gvk with a string,
|
||||
// GvkFromString makes a Gvk with a string,
|
||||
// which is constructed by String() function
|
||||
func FromString(s string) Gvk {
|
||||
values := strings.Split(s, separator)
|
||||
func GvkFromString(s string) Gvk {
|
||||
values := strings.Split(s, fieldSep)
|
||||
g := values[0]
|
||||
if g == noGroup {
|
||||
g = ""
|
||||
@@ -50,7 +50,7 @@ const (
|
||||
noGroup = "~G"
|
||||
noVersion = "~V"
|
||||
noKind = "~K"
|
||||
separator = "_"
|
||||
fieldSep = "_"
|
||||
)
|
||||
|
||||
// String returns a string representation of the GVK.
|
||||
@@ -67,7 +67,7 @@ func (x Gvk) String() string {
|
||||
if k == "" {
|
||||
k = noKind
|
||||
}
|
||||
return strings.Join([]string{g, v, k}, separator)
|
||||
return strings.Join([]string{g, v, k}, fieldSep)
|
||||
}
|
||||
|
||||
// Equals returns true if the Gvk's have equal fields.
|
||||
@@ -14,9 +14,11 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package gvk
|
||||
package resid
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var equalsTests = []struct {
|
||||
x1 Gvk
|
||||
@@ -5,14 +5,12 @@ package resid
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
)
|
||||
|
||||
// ResId is an identifier of a k8s resource object.
|
||||
type ResId struct {
|
||||
// Gvk of the resource.
|
||||
gvk.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
|
||||
// Name of the resource before transformation.
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
@@ -26,18 +24,18 @@ type ResId struct {
|
||||
|
||||
// NewResIdWithNamespace creates new ResId
|
||||
// in a given namespace.
|
||||
func NewResIdWithNamespace(k gvk.Gvk, n, ns string) ResId {
|
||||
func NewResIdWithNamespace(k Gvk, n, ns string) ResId {
|
||||
return ResId{Gvk: k, Name: n, Namespace: ns}
|
||||
}
|
||||
|
||||
// NewResId creates new ResId.
|
||||
func NewResId(k gvk.Gvk, n string) ResId {
|
||||
func NewResId(k Gvk, n string) ResId {
|
||||
return ResId{Gvk: k, Name: n}
|
||||
}
|
||||
|
||||
// NewResIdKindOnly creates a new ResId.
|
||||
func NewResIdKindOnly(k string, n string) ResId {
|
||||
return ResId{Gvk: gvk.FromKind(k), Name: n}
|
||||
return ResId{Gvk: FromKind(k), Name: n}
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -64,7 +62,7 @@ func (id ResId) String() string {
|
||||
|
||||
func FromString(s string) ResId {
|
||||
values := strings.Split(s, separator)
|
||||
g := gvk.FromString(values[0])
|
||||
g := GvkFromString(values[0])
|
||||
|
||||
ns := values[1]
|
||||
if ns == noNamespace {
|
||||
@@ -5,18 +5,16 @@ package resid
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
)
|
||||
|
||||
var stringTests = []struct {
|
||||
var resIdStringTests = []struct {
|
||||
x ResId
|
||||
s string
|
||||
}{
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"g_v_k|ns|nm",
|
||||
@@ -24,7 +22,7 @@ var stringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_v_k|ns|nm",
|
||||
@@ -32,7 +30,7 @@ var stringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_k|ns|nm",
|
||||
@@ -40,34 +38,34 @@ var stringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|ns|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|~X|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|~X|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
},
|
||||
"~G_~V_~K|~X|~N",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
},
|
||||
"~G_~V_~K|~X|~N",
|
||||
},
|
||||
@@ -77,8 +75,8 @@ var stringTests = []struct {
|
||||
},
|
||||
}
|
||||
|
||||
func TestString(t *testing.T) {
|
||||
for _, hey := range stringTests {
|
||||
func TestResIdString(t *testing.T) {
|
||||
for _, hey := range resIdStringTests {
|
||||
if hey.x.String() != hey.s {
|
||||
t.Fatalf("Actual: %v, Expected: '%s'", hey.x, hey.s)
|
||||
}
|
||||
@@ -92,7 +90,7 @@ var gvknStringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"g_v_k|nm",
|
||||
@@ -100,7 +98,7 @@ var gvknStringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_v_k|nm",
|
||||
@@ -108,7 +106,7 @@ var gvknStringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_k|nm",
|
||||
@@ -116,34 +114,34 @@ var gvknStringTests = []struct {
|
||||
{
|
||||
ResId{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
"~G_~V_~K|nm",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
},
|
||||
"~G_~V_~K|",
|
||||
},
|
||||
{
|
||||
ResId{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
},
|
||||
"~G_~V_~K|",
|
||||
},
|
||||
@@ -161,7 +159,7 @@ func TestGvknString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEquals(t *testing.T) {
|
||||
func TestResIdEquals(t *testing.T) {
|
||||
|
||||
var GvknEqualsTest = []struct {
|
||||
id1 ResId
|
||||
@@ -173,12 +171,12 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: true,
|
||||
@@ -188,12 +186,12 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Namespace: "Z",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: true,
|
||||
@@ -203,11 +201,11 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: true,
|
||||
@@ -217,12 +215,12 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Namespace: "Z",
|
||||
Gvk: gvk.Gvk{Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: true,
|
||||
@@ -232,12 +230,12 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "X",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Namespace: "Z",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: true,
|
||||
@@ -246,11 +244,11 @@ func TestEquals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
id1: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm2",
|
||||
},
|
||||
gVknResult: false,
|
||||
@@ -259,11 +257,11 @@ func TestEquals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
id1: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
id2: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "Node"},
|
||||
Gvk: Gvk{Kind: "Node"},
|
||||
Name: "nm",
|
||||
},
|
||||
gVknResult: false,
|
||||
@@ -272,11 +270,11 @@ func TestEquals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
id1: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "Node"},
|
||||
Gvk: Gvk{Kind: "Node"},
|
||||
Name: "nm1",
|
||||
},
|
||||
id2: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "Node"},
|
||||
Gvk: Gvk{Kind: "Node"},
|
||||
Name: "nm2",
|
||||
},
|
||||
gVknResult: false,
|
||||
@@ -286,11 +284,11 @@ func TestEquals(t *testing.T) {
|
||||
{
|
||||
id1: ResId{
|
||||
Namespace: "default",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm1",
|
||||
},
|
||||
id2: ResId{
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm2",
|
||||
},
|
||||
gVknResult: false,
|
||||
@@ -331,34 +329,34 @@ func TestEquals(t *testing.T) {
|
||||
var ids = []ResId{
|
||||
{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{Kind: "k"},
|
||||
Gvk: Gvk{Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Namespace: "ns",
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
Name: "nm",
|
||||
},
|
||||
{
|
||||
Gvk: gvk.Gvk{},
|
||||
Gvk: Gvk{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -378,7 +376,7 @@ func TestEffectiveNamespace(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
id: ResId{
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "Node"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "Node"},
|
||||
Name: "nm",
|
||||
},
|
||||
expected: TotallyNotANamespace,
|
||||
@@ -386,7 +384,7 @@ func TestEffectiveNamespace(t *testing.T) {
|
||||
{
|
||||
id: ResId{
|
||||
Namespace: "foo",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "Node"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "Node"},
|
||||
Name: "nm",
|
||||
},
|
||||
expected: TotallyNotANamespace,
|
||||
@@ -394,7 +392,7 @@ func TestEffectiveNamespace(t *testing.T) {
|
||||
{
|
||||
id: ResId{
|
||||
Namespace: "foo",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
expected: "foo",
|
||||
@@ -402,14 +400,14 @@ func TestEffectiveNamespace(t *testing.T) {
|
||||
{
|
||||
id: ResId{
|
||||
Namespace: "",
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
expected: DefaultNamespace,
|
||||
},
|
||||
{
|
||||
id: ResId{
|
||||
Gvk: gvk.Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Gvk: Gvk{Group: "g", Version: "v", Kind: "k"},
|
||||
Name: "nm",
|
||||
},
|
||||
expected: DefaultNamespace,
|
||||
@@ -6,7 +6,7 @@ package types_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/v3/types"
|
||||
. "sigs.k8s.io/kustomize/v3/api/types"
|
||||
)
|
||||
|
||||
func TestGenArgs_String(t *testing.T) {
|
||||
@@ -3,11 +3,13 @@
|
||||
|
||||
package types
|
||||
|
||||
import "sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
)
|
||||
|
||||
// PatchTarget represents the kubernetes object that the patch is applied to
|
||||
type PatchTarget struct {
|
||||
gvk.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
}
|
||||
@@ -3,13 +3,15 @@
|
||||
|
||||
package types
|
||||
|
||||
import "sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
)
|
||||
|
||||
// Selector specifies a set of resources.
|
||||
// Any resource that matches intersection of all conditions
|
||||
// is included in this set.
|
||||
type Selector struct {
|
||||
gvk.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
)
|
||||
|
||||
const defaultFieldPath = "metadata.name"
|
||||
@@ -40,13 +40,13 @@ type Var struct {
|
||||
// for Var.ObjRef
|
||||
type Target struct {
|
||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||
gvk.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// GVK returns the Gvk object in Target
|
||||
func (t *Target) GVK() gvk.Gvk {
|
||||
func (t *Target) GVK() resid.Gvk {
|
||||
if t.APIVersion == "" {
|
||||
return t.Gvk
|
||||
}
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
)
|
||||
|
||||
func TestGVK(t *testing.T) {
|
||||
type testcase struct {
|
||||
data string
|
||||
expected gvk.Gvk
|
||||
expected resid.Gvk
|
||||
}
|
||||
|
||||
testcases := []testcase{
|
||||
@@ -25,7 +25,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
name: my-secret
|
||||
`,
|
||||
expected: gvk.Gvk{Group: "", Version: "v1", Kind: "Secret"},
|
||||
expected: resid.Gvk{Group: "", Version: "v1", Kind: "Secret"},
|
||||
},
|
||||
{
|
||||
data: `
|
||||
@@ -33,7 +33,7 @@ apiVersion: myapps/v1
|
||||
kind: MyKind
|
||||
name: my-kind
|
||||
`,
|
||||
expected: gvk.Gvk{Group: "myapps", Version: "v1", Kind: "MyKind"},
|
||||
expected: resid.Gvk{Group: "myapps", Version: "v1", Kind: "MyKind"},
|
||||
},
|
||||
{
|
||||
data: `
|
||||
@@ -41,7 +41,7 @@ version: v2
|
||||
kind: MyKind
|
||||
name: my-kind
|
||||
`,
|
||||
expected: gvk.Gvk{Version: "v2", Kind: "MyKind"},
|
||||
expected: resid.Gvk{Version: "v2", Kind: "MyKind"},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestDefaulting(t *testing.T) {
|
||||
v := &Var{
|
||||
Name: "SOME_VARIABLE_NAME",
|
||||
ObjRef: Target{
|
||||
Gvk: gvk.Gvk{
|
||||
Gvk: resid.Gvk{
|
||||
Version: "v1",
|
||||
Kind: "Secret",
|
||||
},
|
||||
@@ -82,21 +82,21 @@ func TestVarSet(t *testing.T) {
|
||||
Name: "SHELLVARS",
|
||||
ObjRef: Target{
|
||||
APIVersion: "v7",
|
||||
Gvk: gvk.Gvk{Kind: "ConfigMap"},
|
||||
Gvk: resid.Gvk{Kind: "ConfigMap"},
|
||||
Name: "bash"},
|
||||
},
|
||||
{
|
||||
Name: "BACKEND",
|
||||
ObjRef: Target{
|
||||
APIVersion: "v7",
|
||||
Gvk: gvk.Gvk{Kind: "Deployment"},
|
||||
Gvk: resid.Gvk{Kind: "Deployment"},
|
||||
Name: "myTiredBackend"},
|
||||
},
|
||||
{
|
||||
Name: "AWARD",
|
||||
ObjRef: Target{
|
||||
APIVersion: "v7",
|
||||
Gvk: gvk.Gvk{Kind: "Service"},
|
||||
Gvk: resid.Gvk{Kind: "Service"},
|
||||
Name: "nobelPrize"},
|
||||
FieldRef: FieldSelector{FieldPath: "some.arbitrary.path"},
|
||||
},
|
||||
@@ -33,16 +33,16 @@ be defaulted. The latter method allows for
|
||||
complete plugin argument specification.
|
||||
|
||||
|
||||
[types.GeneratorOptions]: ../../types/generatoroptions.go
|
||||
[types.SecretArgs]: ../../types/secretargs.go
|
||||
[types.ConfigMapArgs]: ../../types/configmapargs.go
|
||||
[types.GeneratorOptions]: ../../api/types/generatoroptions.go
|
||||
[types.SecretArgs]: ../../api/types/secretargs.go
|
||||
[types.ConfigMapArgs]: ../../api/types/configmapargs.go
|
||||
[config.FieldSpec]: ../../pkg/transformers/config/fieldspec.go
|
||||
[types.ObjectMeta]: ../../types/objectmeta.go
|
||||
[types.Selector]: ../../types/selector.go
|
||||
[types.Replica]: ../../types/replica.go
|
||||
[types.PatchStrategicMerge]: ../../types/patchstrategicmerge.go
|
||||
[types.PatchTarget]: ../../types/patchtarget.go
|
||||
[image.Image]: ../../types/image.go
|
||||
[types.ObjectMeta]: ../../api/types/objectmeta.go
|
||||
[types.Selector]: ../../api/types/selector.go
|
||||
[types.Replica]: ../../api/types/replica.go
|
||||
[types.PatchStrategicMerge]: ../../api/types/patchstrategicmerge.go
|
||||
[types.PatchTarget]: ../../api/types/patchtarget.go
|
||||
[image.Image]: ../../api/types/image.go
|
||||
|
||||
## _AnnotationTransformer_
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
@@ -7,7 +7,7 @@ package loadertest
|
||||
import (
|
||||
"log"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
)
|
||||
|
||||
func makeFreshConfigMap(
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func makeEnvConfigMap(name string) *corev1.ConfigMap {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
package configmapandsecret
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// Factory makes ConfigMaps and Secrets.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
)
|
||||
|
||||
func makeFreshSecret(
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func makeEnvSecret(name string) *corev1.Secret {
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/configmapandsecret"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// KunstructuredFactoryImpl hides construction using apimachinery types.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"sigs.k8s.io/kustomize/v3/hasher"
|
||||
"sigs.k8s.io/kustomize/v3/api/hasher"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
@@ -45,9 +45,9 @@ func NewKunstructuredFromObject(obj runtime.Object) (ifc.Kunstructured, error) {
|
||||
}
|
||||
|
||||
// GetGvk returns the Gvk name of the object.
|
||||
func (fs *UnstructAdapter) GetGvk() gvk.Gvk {
|
||||
func (fs *UnstructAdapter) GetGvk() resid.Gvk {
|
||||
x := fs.GroupVersionKind()
|
||||
return gvk.Gvk{
|
||||
return resid.Gvk{
|
||||
Group: x.Group,
|
||||
Version: x.Version,
|
||||
Kind: x.Kind,
|
||||
@@ -55,7 +55,7 @@ func (fs *UnstructAdapter) GetGvk() gvk.Gvk {
|
||||
}
|
||||
|
||||
// SetGvk set the Gvk of the object to the input Gvk
|
||||
func (fs *UnstructAdapter) SetGvk(g gvk.Gvk) {
|
||||
func (fs *UnstructAdapter) SetGvk(g resid.Gvk) {
|
||||
fs.SetGroupVersionKind(toSchemaGvk(g))
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ func (fs *UnstructAdapter) Patch(patch ifc.Kunstructured) error {
|
||||
}
|
||||
|
||||
// toSchemaGvk converts to a schema.GroupVersionKind.
|
||||
func toSchemaGvk(x gvk.Gvk) schema.GroupVersionKind {
|
||||
func toSchemaGvk(x resid.Gvk) schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: x.Group,
|
||||
Version: x.Version,
|
||||
|
||||
@@ -7,15 +7,14 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/gvk"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/resmap"
|
||||
|
||||
"github.com/evanphx/json-patch"
|
||||
jsonpatch "github.com/evanphx/json-patch"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/mergepatch"
|
||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/resource"
|
||||
)
|
||||
|
||||
@@ -188,7 +187,7 @@ func MergePatches(patches []*resource.Resource,
|
||||
}
|
||||
|
||||
// toSchemaGvk converts to a schema.GroupVersionKind.
|
||||
func toSchemaGvk(x gvk.Gvk) schema.GroupVersionKind {
|
||||
func toSchemaGvk(x resid.Gvk) schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: x.Group,
|
||||
Version: x.Version,
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/create"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/version"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/transformer"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/validator"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/transformers/config/defaultconfig"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
var factory = kunstruct.NewKunstructuredFactoryImpl()
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
type addBaseOptions struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// kindOfAdd is the kind of metadata being added: label or annotation
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func makeKustomization(t *testing.T) *types.Kustomization {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/patch"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
type addResourceOptions struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,7 +5,7 @@ package add
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ package add
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// newCmdAddConfigMap returns a new command.
|
||||
|
||||
@@ -6,11 +6,11 @@ package add
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func TestNewAddConfigMapIsNotNil(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
// flagsAndArgs encapsulates the options for add secret/configmap commands.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestDataValidation_NoName(t *testing.T) {
|
||||
|
||||
@@ -6,9 +6,9 @@ package add
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// newCmdAddSecret returns a new command.
|
||||
|
||||
@@ -6,12 +6,12 @@ package add
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/kv"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func TestNewCmdAddSecretIsNotNil(t *testing.T) {
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/fix"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/remove"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/set"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/kv"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/kv"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/loader"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ package fix
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
// NewCmdFix returns an instance of 'fix' subcommand.
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestFix(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ package remove
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
// kindOfAdd is the kind of metadata being added: label or annotation
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/validators"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
)
|
||||
|
||||
func makeKustomizationFS() filesys.FileSystem {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/util"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/patch"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/patch"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/pgmconfig"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestRemoveResources(t *testing.T) {
|
||||
|
||||
@@ -5,7 +5,7 @@ package set
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
type setNamePrefixOptions struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
type setNameSuffixOptions struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,13 +6,13 @@ package set
|
||||
import (
|
||||
"errors"
|
||||
"regexp"
|
||||
"sigs.k8s.io/kustomize/v3/types"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
type setImageOptions struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
)
|
||||
|
||||
func TestSetImage(t *testing.T) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||
"sigs.k8s.io/kustomize/v3/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/api/filesys"
|
||||
"sigs.k8s.io/kustomize/v3/pkg/ifc"
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user