mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +00:00
Delete the KV plugin code.
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kv/plugin"
|
||||
"sigs.k8s.io/kustomize/pkg/pgmconfig"
|
||||
)
|
||||
|
||||
@@ -56,7 +55,7 @@ func DefaultSrcRoot() (string, error) {
|
||||
}
|
||||
nope = append(nope, root)
|
||||
|
||||
root = plugin.DefaultPluginConfig().DirectoryPath
|
||||
root = DefaultPluginConfig().DirectoryPath
|
||||
if FileExists(root) {
|
||||
return root, nil
|
||||
}
|
||||
|
||||
@@ -1,19 +1,53 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package plugins
|
||||
|
||||
const PluginSymbol = "KustomizePlugin"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/pflag"
|
||||
"path/filepath"
|
||||
"sigs.k8s.io/kustomize/pkg/pgmconfig"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
)
|
||||
|
||||
const (
|
||||
PluginSymbol = "KustomizePlugin"
|
||||
flagEnablePluginsName = "enable_alpha_plugins"
|
||||
flagEnablePluginsHelp = `enable plugins, an alpha feature.
|
||||
See https://github.com/kubernetes-sigs/kustomize/blob/master/docs/plugins.md
|
||||
`
|
||||
flagErrorFmt = `
|
||||
unable to load plugin %s because plugins disabled
|
||||
specify the flag
|
||||
--%s
|
||||
to %s`
|
||||
)
|
||||
|
||||
func ActivePluginConfig() *types.PluginConfig {
|
||||
pc := DefaultPluginConfig()
|
||||
pc.Enabled = true
|
||||
return pc
|
||||
}
|
||||
|
||||
func DefaultPluginConfig() *types.PluginConfig {
|
||||
return &types.PluginConfig{
|
||||
Enabled: false,
|
||||
DirectoryPath: filepath.Join(
|
||||
pgmconfig.ConfigRoot(), pgmconfig.PluginRoot),
|
||||
}
|
||||
}
|
||||
|
||||
func PluginsNotEnabledErr(name string) error {
|
||||
return fmt.Errorf(
|
||||
flagErrorFmt,
|
||||
name,
|
||||
flagEnablePluginsName,
|
||||
flagEnablePluginsHelp)
|
||||
}
|
||||
|
||||
func AddEnablePluginsFlag(set *pflag.FlagSet, v *bool) {
|
||||
set.BoolVar(
|
||||
v, flagEnablePluginsName,
|
||||
false, flagEnablePluginsHelp)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/loadertest"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kunstruct"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kv/plugin"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
)
|
||||
@@ -52,7 +51,7 @@ s/$BAR/bar/g
|
||||
|
||||
p := NewExecPlugin(
|
||||
AbsolutePluginPath(
|
||||
plugin.DefaultPluginConfig(),
|
||||
DefaultPluginConfig(),
|
||||
pluginConfig.Id()))
|
||||
|
||||
yaml, err := pluginConfig.AsYAML()
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
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.
|
||||
*/
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package plugins
|
||||
|
||||
@@ -115,9 +102,8 @@ func (l *Loader) absolutePluginPath(id resid.ResId) string {
|
||||
|
||||
func (l *Loader) loadAndConfigurePlugin(
|
||||
ldr ifc.Loader, res *resource.Resource) (c Configurable, err error) {
|
||||
if !l.pc.GoEnabled {
|
||||
return nil, errors.Errorf(
|
||||
"plugins not enabled, but trying to load %s", res.Id())
|
||||
if !l.pc.Enabled {
|
||||
return nil, PluginsNotEnabledErr(res.Id().Gvk().Kind)
|
||||
}
|
||||
if p := NewExecPlugin(
|
||||
l.absolutePluginPath(res.Id())); p.isAvailable() {
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/loadertest"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kunstruct"
|
||||
kvplugin "sigs.k8s.io/kustomize/k8sdeps/kv/plugin"
|
||||
"sigs.k8s.io/kustomize/pkg/plugins"
|
||||
. "sigs.k8s.io/kustomize/pkg/plugins"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
"sigs.k8s.io/kustomize/plugin"
|
||||
@@ -54,7 +53,7 @@ func TestLoader(t *testing.T) {
|
||||
rmF := resmap.NewFactory(resource.NewFactory(
|
||||
kunstruct.NewKunstructuredFactoryImpl()))
|
||||
|
||||
l := plugins.NewLoader(kvplugin.ActivePluginConfig(), rmF)
|
||||
l := NewLoader(ActivePluginConfig(), rmF)
|
||||
if l == nil {
|
||||
t.Fatal("expect non-nil loader")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user