mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Make plugin dir match Go conventions.
This commit is contained in:
@@ -210,7 +210,7 @@ Plugins that generate KV pairs for kustomize
|
||||
must be installed at
|
||||
|
||||
> ```
|
||||
> $XDG_CONFIG_HOME/kustomize/plugins/kvSource
|
||||
> $XDG_CONFIG_HOME/kustomize/plugin/kvSource
|
||||
> ```
|
||||
|
||||
`XDG_CONFIG_HOME` is an environment variable
|
||||
@@ -227,7 +227,7 @@ Compile and install the plugin:
|
||||
|
||||
<!-- @compilePlugin @test -->
|
||||
```
|
||||
kvSources=$DEMO_HOME/kustomize/plugins/kvSources
|
||||
kvSources=$DEMO_HOME/kustomize/plugin/kvSources
|
||||
mkdir -p $kvSources
|
||||
go build -buildmode plugin \
|
||||
-o $kvSources/kvMaker.so \
|
||||
|
||||
@@ -33,7 +33,7 @@ type Registry struct {
|
||||
|
||||
const (
|
||||
PluginSymbol = "KustomizePlugin"
|
||||
PluginRoot = "plugins"
|
||||
PluginRoot = "plugin"
|
||||
pluginTypeGo = types.PluginType("go")
|
||||
pluginTypeBuiltIn = types.PluginType("builtin")
|
||||
)
|
||||
|
||||
@@ -36,6 +36,7 @@ func TestCompiler(t *testing.T) {
|
||||
if configRoot != c.ObjRoot() {
|
||||
t.Errorf("unexpected objRoot %s", c.ObjRoot())
|
||||
}
|
||||
|
||||
expectObj := filepath.Join(
|
||||
c.ObjRoot(),
|
||||
"someteam.example.com", "v1", "DatePrefixer.so")
|
||||
@@ -49,6 +50,21 @@ func TestCompiler(t *testing.T) {
|
||||
if !RecentFileExists(expectObj) {
|
||||
t.Errorf("didn't find expected obj file %s", expectObj)
|
||||
}
|
||||
|
||||
expectObj = filepath.Join(
|
||||
c.ObjRoot(),
|
||||
"builtin", "", "SecretGenerator.so")
|
||||
if FileExists(expectObj) {
|
||||
t.Errorf("obj file should not exist yet: %s", expectObj)
|
||||
}
|
||||
err = c.Compile("builtin", "", "SecretGenerator")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !RecentFileExists(expectObj) {
|
||||
t.Errorf("didn't find expected obj file %s", expectObj)
|
||||
}
|
||||
|
||||
err = os.RemoveAll(c.ObjRoot())
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
|
||||
@@ -53,7 +53,7 @@ s/$BAR/bar/g
|
||||
|
||||
p.Config(ldr, rf, pluginConfig)
|
||||
|
||||
expected := "/kustomize/plugins/someteam.example.com/v1/SedTransformer"
|
||||
expected := "/kustomize/plugin/someteam.example.com/v1/SedTransformer"
|
||||
if !strings.HasSuffix(p.name, expected) {
|
||||
t.Fatalf("expected suffix '%s', got '%s'", expected, p.name)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
secretGenerator = `apiVersion: kustomize.config.k8s.io/v1
|
||||
secretGenerator = `
|
||||
apiVersion: builtin
|
||||
kind: SecretGenerator
|
||||
metadata:
|
||||
name: secretGenerator
|
||||
@@ -59,7 +60,7 @@ func TestLoader(t *testing.T) {
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildGoPlugin(
|
||||
"kustomize.config.k8s.io", "v1", "SecretGenerator")
|
||||
"builtin", "", "SecretGenerator")
|
||||
tc.BuildGoPlugin(
|
||||
"someteam.example.com", "v1", "ServiceGenerator")
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
// This is an example of using a helm chart as a base,
|
||||
// inflating it and then customizing it with a nameprefix
|
||||
// applied to all its resources.
|
||||
//
|
||||
//
|
||||
// The helm chart used is downloaded from
|
||||
// https://github.com/helm/charts/tree/master/stable/minecraft
|
||||
// with each test run, so it's a bit brittle as that
|
||||
@@ -36,13 +36,13 @@ import (
|
||||
// This test requires having the helm binary on the PATH.
|
||||
//
|
||||
// TODO: Download and inflate the chart, and check that
|
||||
// in for the test.
|
||||
// in for the test.
|
||||
func TestChartInflatorExecPlugin(t *testing.T) {
|
||||
tc := plugintest_test.NewPluginTestEnv(t).Set()
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildExecPlugin(
|
||||
"kustomize.config.k8s.io", "v1", "ChartInflatorExec")
|
||||
"builtin", "", "ChartInflatorExec")
|
||||
|
||||
th := NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app", plugin.ActivePluginConfig())
|
||||
@@ -53,7 +53,7 @@ namePrefix: LOOOOOOOONG-
|
||||
`)
|
||||
|
||||
th.writeF("/app/chartInflatorExec.yaml", `
|
||||
apiVersion: kustomize.config.k8s.io/v1
|
||||
apiVersion: builtin
|
||||
kind: ChartInflatorExec
|
||||
metadata:
|
||||
name: notImportantHere
|
||||
|
||||
@@ -67,7 +67,7 @@ spec:
|
||||
|
||||
func writeSecretGeneratorConfig(th *KustTestHarness, root string) {
|
||||
th.writeF(filepath.Join(root, "secretGenerator.yaml"), `
|
||||
apiVersion: kustomize.config.k8s.io/v1
|
||||
apiVersion: builtin
|
||||
kind: SecretGenerator
|
||||
metadata:
|
||||
name: secretGenerator
|
||||
@@ -102,7 +102,7 @@ func TestSecretGenerator(t *testing.T) {
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildGoPlugin(
|
||||
"kustomize.config.k8s.io", "v1", "SecretGenerator")
|
||||
"builtin", "", "SecretGenerator")
|
||||
|
||||
th := NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app", plugin.ActivePluginConfig())
|
||||
|
||||
Reference in New Issue
Block a user