mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 09:49:13 +00:00
Improve config package names and reduce API exposure.
This commit is contained in:
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const commonAnnotationFieldSpecs = `
|
const commonAnnotationFieldSpecs = `
|
||||||
commonAnnotations:
|
commonAnnotations:
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const commonLabelFieldSpecs = `
|
const commonLabelFieldSpecs = `
|
||||||
commonLabels:
|
commonLabels:
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
8
api/konfig/builtinpluginconsts/doc.go
Normal file
8
api/konfig/builtinpluginconsts/doc.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Copyright 2019 The Kubernetes Authors.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Package builtinpluginconsts provides builtin plugin
|
||||||
|
// configuration data. Builtin plugins can also be
|
||||||
|
// configured individually with plugin config files,
|
||||||
|
// in which case the constants in this package are ignored.
|
||||||
|
package builtinpluginconsts
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// imageFieldSpecs is left empty since `containers` and `initContainers`
|
// imageFieldSpecs is left empty since `containers` and `initContainers`
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const (
|
const (
|
||||||
namePrefixFieldSpecs = `
|
namePrefixFieldSpecs = `
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const (
|
const (
|
||||||
nameReferenceFieldSpecs = `
|
nameReferenceFieldSpecs = `
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const (
|
const (
|
||||||
namespaceFieldSpecs = `
|
namespaceFieldSpecs = `
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const replicasFieldSpecs = `
|
const replicasFieldSpecs = `
|
||||||
replicas:
|
replicas:
|
||||||
@@ -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 consts
|
package builtinpluginconsts
|
||||||
|
|
||||||
const (
|
const (
|
||||||
varReferenceFieldSpecs = `
|
varReferenceFieldSpecs = `
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2019 The Kubernetes Authors.
|
// Copyright 2019 The Kubernetes Authors.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Package pgmconfig provides configuration methods and constants
|
// Package konfig provides configuration methods and constants
|
||||||
// for the kustomize API.
|
// for the kustomize API.
|
||||||
package pgmconfig
|
package konfig
|
||||||
@@ -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 pgmconfig
|
package konfig
|
||||||
|
|
||||||
// RecognizedKustomizationFileNames is a list of file names
|
// RecognizedKustomizationFileNames is a list of file names
|
||||||
// that kustomize recognizes.
|
// that kustomize recognizes.
|
||||||
@@ -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 pgmconfig
|
package konfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@@ -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 pgmconfig
|
package konfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
package krusty
|
package krusty
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,6 +35,6 @@ func MakeDefaultOptions() *Options {
|
|||||||
DoLegacyResourceSort: true,
|
DoLegacyResourceSort: true,
|
||||||
LoadRestrictions: types.LoadRestrictionsRootOnly,
|
LoadRestrictions: types.LoadRestrictionsRootOnly,
|
||||||
DoPrune: false,
|
DoPrune: false,
|
||||||
PluginConfig: pgmconfig.DisabledPluginConfig(),
|
PluginConfig: konfig.DisabledPluginConfig(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/git"
|
"sigs.k8s.io/kustomize/api/git"
|
||||||
"sigs.k8s.io/kustomize/api/ifc"
|
"sigs.k8s.io/kustomize/api/ifc"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testData struct {
|
type testData struct {
|
||||||
@@ -374,7 +374,7 @@ func TestNewLoaderAtGitClone(t *testing.T) {
|
|||||||
fSys.MkdirAll(coRoot + "/" + pathInRepo)
|
fSys.MkdirAll(coRoot + "/" + pathInRepo)
|
||||||
fSys.WriteFile(
|
fSys.WriteFile(
|
||||||
coRoot+"/"+pathInRepo+"/"+
|
coRoot+"/"+pathInRepo+"/"+
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
[]byte(`
|
[]byte(`
|
||||||
whatever
|
whatever
|
||||||
`))
|
`))
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
// Copyright 2019 The Kubernetes Authors.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
// Package consts provides builtin plugin configuration data.
|
|
||||||
package consts
|
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/ifc"
|
"sigs.k8s.io/kustomize/api/ifc"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinconfig/consts"
|
"sigs.k8s.io/kustomize/api/konfig/builtinpluginconsts"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ func MakeEmptyConfig() *TransformerConfig {
|
|||||||
// MakeDefaultConfig returns a default TransformerConfig.
|
// MakeDefaultConfig returns a default TransformerConfig.
|
||||||
func MakeDefaultConfig() *TransformerConfig {
|
func MakeDefaultConfig() *TransformerConfig {
|
||||||
c, err := makeTransformerConfigFromBytes(
|
c, err := makeTransformerConfigFromBytes(
|
||||||
consts.GetDefaultFieldSpecs())
|
builtinpluginconsts.GetDefaultFieldSpecs())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Unable to make default transformconfig: %v", err)
|
log.Fatalf("Unable to make default transformconfig: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Compiler creates Go plugin object files.
|
// Compiler creates Go plugin object files.
|
||||||
@@ -31,32 +31,32 @@ type Compiler struct {
|
|||||||
// DefaultSrcRoot guesses where the user
|
// DefaultSrcRoot guesses where the user
|
||||||
// has her ${g}/${v}/$lower(${k})/${k}.go files.
|
// has her ${g}/${v}/$lower(${k})/${k}.go files.
|
||||||
func DefaultSrcRoot(fSys filesys.FileSystem) (string, error) {
|
func DefaultSrcRoot(fSys filesys.FileSystem) (string, error) {
|
||||||
return pgmconfig.FirstDirThatExistsElseError(
|
return konfig.FirstDirThatExistsElseError(
|
||||||
"source directory", fSys, []pgmconfig.NotedFunc{
|
"source directory", fSys, []konfig.NotedFunc{
|
||||||
{
|
{
|
||||||
Note: "old style $GOPATH",
|
Note: "old style $GOPATH",
|
||||||
F: func() string {
|
F: func() string {
|
||||||
return filepath.Join(
|
return filepath.Join(
|
||||||
os.Getenv("GOPATH"),
|
os.Getenv("GOPATH"),
|
||||||
"src", pgmconfig.DomainName,
|
"src", konfig.DomainName,
|
||||||
pgmconfig.ProgramName, pgmconfig.RelPluginHome)
|
konfig.ProgramName, konfig.RelPluginHome)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Note: "HOME with literal 'gopath'",
|
Note: "HOME with literal 'gopath'",
|
||||||
F: func() string {
|
F: func() string {
|
||||||
return filepath.Join(
|
return filepath.Join(
|
||||||
pgmconfig.HomeDir(), "gopath",
|
konfig.HomeDir(), "gopath",
|
||||||
"src", pgmconfig.DomainName,
|
"src", konfig.DomainName,
|
||||||
pgmconfig.ProgramName, pgmconfig.RelPluginHome)
|
konfig.ProgramName, konfig.RelPluginHome)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Note: "home directory",
|
Note: "home directory",
|
||||||
F: func() string {
|
F: func() string {
|
||||||
return filepath.Join(
|
return filepath.Join(
|
||||||
pgmconfig.HomeDir(), pgmconfig.DomainName,
|
konfig.HomeDir(), konfig.DomainName,
|
||||||
pgmconfig.ProgramName, pgmconfig.RelPluginHome)
|
konfig.ProgramName, konfig.RelPluginHome)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
. "sigs.k8s.io/kustomize/api/plugins/execplugin"
|
. "sigs.k8s.io/kustomize/api/plugins/execplugin"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/loader"
|
"sigs.k8s.io/kustomize/api/plugins/loader"
|
||||||
"sigs.k8s.io/kustomize/api/resmap"
|
"sigs.k8s.io/kustomize/api/resmap"
|
||||||
@@ -45,7 +45,7 @@ s/$BAR/bar/g
|
|||||||
|
|
||||||
p := NewExecPlugin(
|
p := NewExecPlugin(
|
||||||
loader.AbsolutePluginPath(
|
loader.AbsolutePluginPath(
|
||||||
pgmconfig.DisabledPluginConfig(),
|
konfig.DisabledPluginConfig(),
|
||||||
pluginConfig.OrgId()))
|
pluginConfig.OrgId()))
|
||||||
// Not checking to see if the plugin is executable,
|
// Not checking to see if the plugin is executable,
|
||||||
// because this test does not run it.
|
// because this test does not run it.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"sigs.k8s.io/kustomize/api/ifc"
|
"sigs.k8s.io/kustomize/api/ifc"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinhelpers"
|
"sigs.k8s.io/kustomize/api/plugins/builtinhelpers"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/execplugin"
|
"sigs.k8s.io/kustomize/api/plugins/execplugin"
|
||||||
"sigs.k8s.io/kustomize/api/resid"
|
"sigs.k8s.io/kustomize/api/resid"
|
||||||
@@ -103,7 +103,7 @@ func (l *Loader) absolutePluginPath(id resid.ResId) string {
|
|||||||
func isBuiltinPlugin(res *resource.Resource) bool {
|
func isBuiltinPlugin(res *resource.Resource) bool {
|
||||||
// TODO: the special string should appear in Group, not Version.
|
// TODO: the special string should appear in Group, not Version.
|
||||||
return res.GetGvk().Group == "" &&
|
return res.GetGvk().Group == "" &&
|
||||||
res.GetGvk().Version == pgmconfig.BuiltinPluginApiVersion
|
res.GetGvk().Version == konfig.BuiltinPluginApiVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Loader) loadAndConfigurePlugin(
|
func (l *Loader) loadAndConfigurePlugin(
|
||||||
@@ -188,11 +188,11 @@ func (l *Loader) loadGoPlugin(id resid.ResId) (resmap.Configurable, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "plugin %s fails to load", absPath)
|
return nil, errors.Wrapf(err, "plugin %s fails to load", absPath)
|
||||||
}
|
}
|
||||||
symbol, err := p.Lookup(pgmconfig.PluginSymbol)
|
symbol, err := p.Lookup(konfig.PluginSymbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(
|
return nil, errors.Wrapf(
|
||||||
err, "plugin %s doesn't have symbol %s",
|
err, "plugin %s doesn't have symbol %s",
|
||||||
regId, pgmconfig.PluginSymbol)
|
regId, konfig.PluginSymbol)
|
||||||
}
|
}
|
||||||
c, ok := symbol.(resmap.Configurable)
|
c, ok := symbol.(resmap.Configurable)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
. "sigs.k8s.io/kustomize/api/plugins/loader"
|
. "sigs.k8s.io/kustomize/api/plugins/loader"
|
||||||
"sigs.k8s.io/kustomize/api/resmap"
|
"sigs.k8s.io/kustomize/api/resmap"
|
||||||
"sigs.k8s.io/kustomize/api/resource"
|
"sigs.k8s.io/kustomize/api/resource"
|
||||||
@@ -57,7 +57,7 @@ func TestLoader(t *testing.T) {
|
|||||||
|
|
||||||
ldr := loadertest.NewFakeLoader("/foo")
|
ldr := loadertest.NewFakeLoader("/foo")
|
||||||
|
|
||||||
c, err := pgmconfig.EnabledPluginConfig()
|
c, err := konfig.EnabledPluginConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/loader"
|
"sigs.k8s.io/kustomize/api/loader"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
|
||||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ spec:
|
|||||||
func TestSharedPatchDisAllowed(t *testing.T) {
|
func TestSharedPatchDisAllowed(t *testing.T) {
|
||||||
th := kusttest_test.NewKustTestHarnessFull(
|
th := kusttest_test.NewKustTestHarnessFull(
|
||||||
t, "/app/overlay",
|
t, "/app/overlay",
|
||||||
loader.RestrictionRootOnly, pgmconfig.DisabledPluginConfig())
|
loader.RestrictionRootOnly, konfig.DisabledPluginConfig())
|
||||||
writeSmallBase(th)
|
writeSmallBase(th)
|
||||||
th.WriteK("/app/overlay", `
|
th.WriteK("/app/overlay", `
|
||||||
commonLabels:
|
commonLabels:
|
||||||
@@ -332,7 +332,7 @@ spec:
|
|||||||
func TestSharedPatchAllowed(t *testing.T) {
|
func TestSharedPatchAllowed(t *testing.T) {
|
||||||
th := kusttest_test.NewKustTestHarnessFull(
|
th := kusttest_test.NewKustTestHarnessFull(
|
||||||
t, "/app/overlay",
|
t, "/app/overlay",
|
||||||
loader.RestrictionNone, pgmconfig.DisabledPluginConfig())
|
loader.RestrictionNone, konfig.DisabledPluginConfig())
|
||||||
writeSmallBase(th)
|
writeSmallBase(th)
|
||||||
th.WriteK("/app/overlay", `
|
th.WriteK("/app/overlay", `
|
||||||
commonLabels:
|
commonLabels:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"sigs.k8s.io/kustomize/api/ifc"
|
"sigs.k8s.io/kustomize/api/ifc"
|
||||||
"sigs.k8s.io/kustomize/api/internal/accumulator"
|
"sigs.k8s.io/kustomize/api/internal/accumulator"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinconfig"
|
"sigs.k8s.io/kustomize/api/plugins/builtinconfig"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinhelpers"
|
"sigs.k8s.io/kustomize/api/plugins/builtinhelpers"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtins"
|
"sigs.k8s.io/kustomize/api/plugins/builtins"
|
||||||
@@ -85,7 +85,7 @@ func commaOr(q []string) string {
|
|||||||
func loadKustFile(ldr ifc.Loader) ([]byte, error) {
|
func loadKustFile(ldr ifc.Loader) ([]byte, error) {
|
||||||
var content []byte
|
var content []byte
|
||||||
match := 0
|
match := 0
|
||||||
for _, kf := range pgmconfig.RecognizedKustomizationFileNames() {
|
for _, kf := range konfig.RecognizedKustomizationFileNames() {
|
||||||
c, err := ldr.Load(kf)
|
c, err := ldr.Load(kf)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
match += 1
|
match += 1
|
||||||
@@ -110,7 +110,7 @@ type errMissingKustomization struct {
|
|||||||
func (e *errMissingKustomization) Error() string {
|
func (e *errMissingKustomization) Error() string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"unable to find one of %v in directory '%s'",
|
"unable to find one of %v in directory '%s'",
|
||||||
commaOr(quoted(pgmconfig.RecognizedKustomizationFileNames())),
|
commaOr(quoted(konfig.RecognizedKustomizationFileNames())),
|
||||||
e.path)
|
e.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/transformer"
|
"sigs.k8s.io/kustomize/api/k8sdeps/transformer"
|
||||||
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
fLdr "sigs.k8s.io/kustomize/api/loader"
|
fLdr "sigs.k8s.io/kustomize/api/loader"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
|
||||||
pLdr "sigs.k8s.io/kustomize/api/plugins/loader"
|
pLdr "sigs.k8s.io/kustomize/api/plugins/loader"
|
||||||
"sigs.k8s.io/kustomize/api/resmap"
|
"sigs.k8s.io/kustomize/api/resmap"
|
||||||
"sigs.k8s.io/kustomize/api/resource"
|
"sigs.k8s.io/kustomize/api/resource"
|
||||||
@@ -65,7 +65,7 @@ metadata:
|
|||||||
rf := resmap.NewFactory(resource.NewFactory(
|
rf := resmap.NewFactory(resource.NewFactory(
|
||||||
kunstruct.NewKunstructuredFactoryImpl()), nil)
|
kunstruct.NewKunstructuredFactoryImpl()), nil)
|
||||||
|
|
||||||
c, err := pgmconfig.EnabledPluginConfig()
|
c, err := konfig.EnabledPluginConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
"sigs.k8s.io/kustomize/api/internal/loadertest"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/transformer"
|
"sigs.k8s.io/kustomize/api/k8sdeps/transformer"
|
||||||
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
|
"sigs.k8s.io/kustomize/api/konfig/builtinpluginconsts"
|
||||||
fLdr "sigs.k8s.io/kustomize/api/loader"
|
fLdr "sigs.k8s.io/kustomize/api/loader"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinconfig/consts"
|
|
||||||
pLdr "sigs.k8s.io/kustomize/api/plugins/loader"
|
pLdr "sigs.k8s.io/kustomize/api/plugins/loader"
|
||||||
"sigs.k8s.io/kustomize/api/resmap"
|
"sigs.k8s.io/kustomize/api/resmap"
|
||||||
"sigs.k8s.io/kustomize/api/resource"
|
"sigs.k8s.io/kustomize/api/resource"
|
||||||
"sigs.k8s.io/kustomize/api/target"
|
"sigs.k8s.io/kustomize/api/target"
|
||||||
"sigs.k8s.io/kustomize/api/testutils/valtest"
|
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,11 +36,11 @@ type KustTestHarness struct {
|
|||||||
|
|
||||||
func NewKustTestHarness(t *testing.T, path string) *KustTestHarness {
|
func NewKustTestHarness(t *testing.T, path string) *KustTestHarness {
|
||||||
return NewKustTestHarnessFull(
|
return NewKustTestHarnessFull(
|
||||||
t, path, fLdr.RestrictionRootOnly, pgmconfig.DisabledPluginConfig())
|
t, path, fLdr.RestrictionRootOnly, konfig.DisabledPluginConfig())
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKustTestHarnessAllowPlugins(t *testing.T, path string) *KustTestHarness {
|
func NewKustTestHarnessAllowPlugins(t *testing.T, path string) *KustTestHarness {
|
||||||
c, err := pgmconfig.EnabledPluginConfig()
|
c, err := konfig.EnabledPluginConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ func NewKustTestHarnessAllowPlugins(t *testing.T, path string) *KustTestHarness
|
|||||||
|
|
||||||
func NewKustTestHarnessNoLoadRestrictor(t *testing.T, path string) *KustTestHarness {
|
func NewKustTestHarnessNoLoadRestrictor(t *testing.T, path string) *KustTestHarness {
|
||||||
return NewKustTestHarnessFull(
|
return NewKustTestHarnessFull(
|
||||||
t, path, fLdr.RestrictionNone, pgmconfig.DisabledPluginConfig())
|
t, path, fLdr.RestrictionNone, konfig.DisabledPluginConfig())
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKustTestHarnessFull(
|
func NewKustTestHarnessFull(
|
||||||
@@ -89,7 +89,7 @@ func (th *KustTestHarness) WriteK(dir string, content string) {
|
|||||||
th.WriteF(
|
th.WriteF(
|
||||||
filepath.Join(
|
filepath.Join(
|
||||||
dir,
|
dir,
|
||||||
pgmconfig.DefaultKustomizationFileName()), `
|
konfig.DefaultKustomizationFileName()), `
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
`+content)
|
`+content)
|
||||||
@@ -111,7 +111,7 @@ func (th *KustTestHarness) FromMapAndOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (th *KustTestHarness) WriteDefaultConfigs(fName string) {
|
func (th *KustTestHarness) WriteDefaultConfigs(fName string) {
|
||||||
m := consts.GetDefaultFieldSpecsAsMap()
|
m := builtinpluginconsts.GetDefaultFieldSpecsAsMap()
|
||||||
var content []byte
|
var content []byte
|
||||||
for _, tCfg := range m {
|
for _, tCfg := range m {
|
||||||
content = append(content, []byte(tCfg)...)
|
content = append(content, []byte(tCfg)...)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/compiler"
|
"sigs.k8s.io/kustomize/api/plugins/compiler"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ func (x *PluginTestEnv) makeCompiler() *compiler.Compiler {
|
|||||||
// $objRoot
|
// $objRoot
|
||||||
// so set things up accordingly.
|
// so set things up accordingly.
|
||||||
objRoot := filepath.Join(
|
objRoot := filepath.Join(
|
||||||
x.workDir, pgmconfig.ProgramName, pgmconfig.RelPluginHome)
|
x.workDir, konfig.ProgramName, konfig.RelPluginHome)
|
||||||
err := os.MkdirAll(objRoot, os.ModePerm)
|
err := os.MkdirAll(objRoot, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
x.t.Error(err)
|
x.t.Error(err)
|
||||||
@@ -100,14 +100,14 @@ func (x *PluginTestEnv) removeWorkDir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *PluginTestEnv) setEnv() {
|
func (x *PluginTestEnv) setEnv() {
|
||||||
x.oldXdg, x.wasSet = os.LookupEnv(pgmconfig.XdgConfigHomeEnv)
|
x.oldXdg, x.wasSet = os.LookupEnv(konfig.XdgConfigHomeEnv)
|
||||||
os.Setenv(pgmconfig.XdgConfigHomeEnv, x.workDir)
|
os.Setenv(konfig.XdgConfigHomeEnv, x.workDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PluginTestEnv) resetEnv() {
|
func (x *PluginTestEnv) resetEnv() {
|
||||||
if x.wasSet {
|
if x.wasSet {
|
||||||
os.Setenv(pgmconfig.XdgConfigHomeEnv, x.oldXdg)
|
os.Setenv(konfig.XdgConfigHomeEnv, x.oldXdg)
|
||||||
} else {
|
} else {
|
||||||
os.Unsetenv(pgmconfig.XdgConfigHomeEnv)
|
os.Unsetenv(konfig.XdgConfigHomeEnv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function whatApi {
|
|||||||
grep -v " resid " |\
|
grep -v " resid " |\
|
||||||
grep -v " resmap " |\
|
grep -v " resmap " |\
|
||||||
grep -v " testutils/" |\
|
grep -v " testutils/" |\
|
||||||
grep -v "types "
|
grep -v " types "
|
||||||
echo "==== end $1 =================================="
|
echo "==== end $1 =================================="
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/krusty"
|
"sigs.k8s.io/kustomize/api/krusty"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
|
||||||
"sigs.k8s.io/kustomize/api/resmap"
|
"sigs.k8s.io/kustomize/api/resmap"
|
||||||
"sigs.k8s.io/kustomize/api/resource"
|
"sigs.k8s.io/kustomize/api/resource"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
@@ -57,7 +57,7 @@ func NewCmdBuild(out io.Writer) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "build {path}",
|
Use: "build {path}",
|
||||||
Short: "Print configuration per contents of " +
|
Short: "Print configuration per contents of " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: examples,
|
Example: examples,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
@@ -87,7 +87,7 @@ func (o *Options) Validate(args []string) (err error) {
|
|||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
return errors.New(
|
return errors.New(
|
||||||
"specify one path to " +
|
"specify one path to " +
|
||||||
pgmconfig.DefaultKustomizationFileName())
|
konfig.DefaultKustomizationFileName())
|
||||||
}
|
}
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
o.kustomizationPath = CWD
|
o.kustomizationPath = CWD
|
||||||
@@ -109,13 +109,13 @@ func (o *Options) makeOptions() *krusty.Options {
|
|||||||
DoPrune: false,
|
DoPrune: false,
|
||||||
}
|
}
|
||||||
if isFlagEnablePluginsSet() {
|
if isFlagEnablePluginsSet() {
|
||||||
c, err := pgmconfig.EnabledPluginConfig()
|
c, err := konfig.EnabledPluginConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
opts.PluginConfig = c
|
opts.PluginConfig = c
|
||||||
} else {
|
} else {
|
||||||
opts.PluginConfig = pgmconfig.DisabledPluginConfig()
|
opts.PluginConfig = konfig.DisabledPluginConfig()
|
||||||
}
|
}
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package build
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewOptionsToSilenceCodeInspectionError(t *testing.T) {
|
func TestNewOptionsToSilenceCodeInspectionError(t *testing.T) {
|
||||||
@@ -28,7 +28,7 @@ func TestBuildValidate(t *testing.T) {
|
|||||||
{"path", []string{"too", "many"},
|
{"path", []string{"too", "many"},
|
||||||
"",
|
"",
|
||||||
"specify one path to " +
|
"specify one path to " +
|
||||||
pgmconfig.DefaultKustomizationFileName()},
|
konfig.DefaultKustomizationFileName()},
|
||||||
}
|
}
|
||||||
for _, mycase := range cases {
|
for _, mycase := range cases {
|
||||||
opts := Options{}
|
opts := Options{}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
|
||||||
"sigs.k8s.io/kustomize/api/k8sdeps/validator"
|
"sigs.k8s.io/kustomize/api/k8sdeps/validator"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/build"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/build"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/config"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/config"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/create"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/create"
|
||||||
@@ -26,7 +26,7 @@ func NewDefaultCommand() *cobra.Command {
|
|||||||
stdOut := os.Stdout
|
stdOut := os.Stdout
|
||||||
|
|
||||||
c := &cobra.Command{
|
c := &cobra.Command{
|
||||||
Use: pgmconfig.ProgramName,
|
Use: konfig.ProgramName,
|
||||||
Short: "Manages declarative configuration of Kubernetes",
|
Short: "Manages declarative configuration of Kubernetes",
|
||||||
Long: `
|
Long: `
|
||||||
Manages declarative configuration of Kubernetes.
|
Manages declarative configuration of Kubernetes.
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/plugins/builtinconfig/consts"
|
"sigs.k8s.io/kustomize/api/konfig/builtinpluginconsts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewCmdConfig returns an instance of 'config' subcommand.
|
// NewCmdConfig returns an instance of 'config' subcommand.
|
||||||
@@ -89,7 +88,7 @@ func (o *saveOptions) Complete(fSys filesys.FileSystem) error {
|
|||||||
|
|
||||||
// RunSave saves the default transformer configurations local directory
|
// RunSave saves the default transformer configurations local directory
|
||||||
func (o *saveOptions) RunSave(fSys filesys.FileSystem) error {
|
func (o *saveOptions) RunSave(fSys filesys.FileSystem) error {
|
||||||
m := consts.GetDefaultFieldSpecsAsMap()
|
m := builtinpluginconsts.GetDefaultFieldSpecsAsMap()
|
||||||
for tname, tcfg := range m {
|
for tname, tcfg := range m {
|
||||||
filename := filepath.Join(o.saveDirectory, tname+".yaml")
|
filename := filepath.Join(o.saveDirectory, tname+".yaml")
|
||||||
err := fSys.WriteFile(filename, []byte(tcfg))
|
err := fSys.WriteFile(filename, []byte(tcfg))
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/ifc"
|
"sigs.k8s.io/kustomize/api/ifc"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"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"
|
||||||
)
|
)
|
||||||
@@ -162,7 +162,7 @@ func detectResources(fSys filesys.FileSystem, uf ifc.KunstructuredFactory, base
|
|||||||
}
|
}
|
||||||
// If a sub-directory contains an existing kustomization file add the
|
// If a sub-directory contains an existing kustomization file add the
|
||||||
// directory as a resource and do not decend into it.
|
// directory as a resource and do not decend into it.
|
||||||
for _, kfilename := range pgmconfig.RecognizedKustomizationFileNames() {
|
for _, kfilename := range konfig.RecognizedKustomizationFileNames() {
|
||||||
if fSys.Exists(filepath.Join(path, kfilename)) {
|
if fSys.Exists(filepath.Join(path, kfilename)) {
|
||||||
paths = append(paths, path)
|
paths = append(paths, path)
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
"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"
|
||||||
@@ -48,7 +48,7 @@ func newCmdAddAnnotation(fSys filesys.FileSystem, v func(map[string]string) erro
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "annotation",
|
Use: "annotation",
|
||||||
Short: "Adds one or more commonAnnotations to " +
|
Short: "Adds one or more commonAnnotations to " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
add annotation {annotationKey1:annotationValue1},{annotationKey2:annotationValue2}`,
|
add annotation {annotationKey1:annotationValue1},{annotationKey2:annotationValue2}`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
@@ -69,7 +69,7 @@ func newCmdAddLabel(fSys filesys.FileSystem, v func(map[string]string) error) *c
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "label",
|
Use: "label",
|
||||||
Short: "Adds one or more commonLabels to " +
|
Short: "Adds one or more commonLabels to " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
add label {labelKey1:labelValue1},{labelKey2:labelValue2}`,
|
add label {labelKey1:labelValue1},{labelKey2:labelValue2}`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|||||||
@@ -1,18 +1,5 @@
|
|||||||
/*
|
// Copyright 2019 The Kubernetes Authors.
|
||||||
Copyright 2018 The Kubernetes Authors.
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package patch
|
package patch
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||||
)
|
)
|
||||||
@@ -48,7 +48,7 @@ func newCmdRemoveAnnotation(fSys filesys.FileSystem, v func([]string) error) *co
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "annotation",
|
Use: "annotation",
|
||||||
Short: "Removes one or more commonAnnotations from " +
|
Short: "Removes one or more commonAnnotations from " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
remove annotation {annotationKey1},{annotationKey2}`,
|
remove annotation {annotationKey1},{annotationKey2}`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
@@ -69,7 +69,7 @@ func newCmdRemoveLabel(fSys filesys.FileSystem, v func([]string) error) *cobra.C
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "label",
|
Use: "label",
|
||||||
Short: "Removes one or more commonLabels from " +
|
Short: "Removes one or more commonLabels from " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
remove label {labelKey1},{labelKey2}`,
|
remove label {labelKey1},{labelKey2}`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/patch"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/edit/patch"
|
||||||
"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"
|
||||||
@@ -26,7 +26,7 @@ func newCmdRemovePatch(fSys filesys.FileSystem) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "patch",
|
Use: "patch",
|
||||||
Short: "Removes one or more patches from " +
|
Short: "Removes one or more patches from " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
remove patch {filepath}`,
|
remove patch {filepath}`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
"sigs.k8s.io/kustomize/kustomize/v3/internal/commands/kustfile"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ func newCmdRemoveResource(fSys filesys.FileSystem) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "resource",
|
Use: "resource",
|
||||||
Short: "Removes one or more resource file paths from " +
|
Short: "Removes one or more resource file paths from " +
|
||||||
pgmconfig.DefaultKustomizationFileName(),
|
konfig.DefaultKustomizationFileName(),
|
||||||
Example: `
|
Example: `
|
||||||
remove resource my-resource.yml
|
remove resource my-resource.yml
|
||||||
remove resource resource1.yml resource2.yml resource3.yml
|
remove resource resource1.yml resource2.yml resource3.yml
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
@@ -119,7 +119,7 @@ func NewKustomizationFile(fSys filesys.FileSystem) (*kustomizationFile, error) {
|
|||||||
func (mf *kustomizationFile) validate() error {
|
func (mf *kustomizationFile) validate() error {
|
||||||
match := 0
|
match := 0
|
||||||
var path []string
|
var path []string
|
||||||
for _, kfilename := range pgmconfig.RecognizedKustomizationFileNames() {
|
for _, kfilename := range konfig.RecognizedKustomizationFileNames() {
|
||||||
if mf.fSys.Exists(kfilename) {
|
if mf.fSys.Exists(kfilename) {
|
||||||
match += 1
|
match += 1
|
||||||
path = append(path, kfilename)
|
path = append(path, kfilename)
|
||||||
@@ -130,7 +130,7 @@ func (mf *kustomizationFile) validate() error {
|
|||||||
case 0:
|
case 0:
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"Missing kustomization file '%s'.\n",
|
"Missing kustomization file '%s'.\n",
|
||||||
pgmconfig.DefaultKustomizationFileName())
|
konfig.DefaultKustomizationFileName())
|
||||||
case 1:
|
case 1:
|
||||||
mf.path = path[0]
|
mf.path = path[0]
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
testutils_test "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
testutils_test "sigs.k8s.io/kustomize/kustomize/v3/internal/commands/testutils"
|
||||||
)
|
)
|
||||||
@@ -104,7 +104,7 @@ configMapGenerator:
|
|||||||
- baz=qux
|
- baz=qux
|
||||||
name: my-configmap
|
name: my-configmap
|
||||||
`
|
`
|
||||||
for _, n := range pgmconfig.RecognizedKustomizationFileNames() {
|
for _, n := range konfig.RecognizedKustomizationFileNames() {
|
||||||
fSys := filesys.MakeFsInMemory()
|
fSys := filesys.MakeFsInMemory()
|
||||||
fSys.WriteFile(n, []byte(kcontent))
|
fSys.WriteFile(n, []byte(kcontent))
|
||||||
k, err := NewKustomizationFile(fSys)
|
k, err := NewKustomizationFile(fSys)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package testutils_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sigs.k8s.io/kustomize/api/filesys"
|
"sigs.k8s.io/kustomize/api/filesys"
|
||||||
"sigs.k8s.io/kustomize/api/pgmconfig"
|
"sigs.k8s.io/kustomize/api/konfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -38,10 +38,10 @@ func WriteTestKustomization(fSys filesys.FileSystem) {
|
|||||||
|
|
||||||
// WriteTestKustomizationWith writes content to a well known file name.
|
// WriteTestKustomizationWith writes content to a well known file name.
|
||||||
func WriteTestKustomizationWith(fSys filesys.FileSystem, bytes []byte) {
|
func WriteTestKustomizationWith(fSys filesys.FileSystem, bytes []byte) {
|
||||||
fSys.WriteFile(pgmconfig.DefaultKustomizationFileName(), bytes)
|
fSys.WriteFile(konfig.DefaultKustomizationFileName(), bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadTestKustomization reads content from a well known file name.
|
// ReadTestKustomization reads content from a well known file name.
|
||||||
func ReadTestKustomization(fSys filesys.FileSystem) ([]byte, error) {
|
func ReadTestKustomization(fSys filesys.FileSystem) ([]byte, error) {
|
||||||
return fSys.ReadFile(pgmconfig.DefaultKustomizationFileName())
|
return fSys.ReadFile(konfig.DefaultKustomizationFileName())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user