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