One plugin per dir.

This commit is contained in:
jregan
2019-05-19 12:00:07 -07:00
parent 31534fe47d
commit 5653ae69e4
42 changed files with 612 additions and 626 deletions

View File

@@ -1,8 +1,9 @@
#!/bin/bash
set -e
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
# Helm chart inflator
#
# Reads a file like this
#
# apiVersion: kustomize.config.k8s.io/v1
@@ -23,6 +24,7 @@ set -e
# Example execution:
# ./plugin/someteam.example.com/v1/ChartInflator configFile.yaml
set -e
# Yaml parsing is a ridiculous thing to do in bash,
# but let's try:

View File

@@ -19,7 +19,7 @@ import (
// TODO: Download and inflate the chart, and check that
// in for the test.
func TestChartInflator(t *testing.T) {
tc := plugin.NewPluginTestEnv(t).Set()
tc := plugin.NewEnvForTest(t).Set()
defer tc.Reset()
tc.BuildExecPlugin(

View File

@@ -1,20 +1,5 @@
// +build plugin
/*
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 main

View File

@@ -1,43 +0,0 @@
// +build plugin
/*
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.
*/
package main
var database = map[string]string{
"TREE": "oak",
"ROCKET": "Saturn V",
"FRUIT": "apple",
"VEGETABLE": "carrot",
"SIMPSON": "homer",
}
type plugin struct{}
var KVSource plugin
func (p plugin) Get(
root string, args []string) (map[string]string, error) {
r := make(map[string]string)
for _, k := range args {
v, ok := database[k]
if ok {
r[k] = v
}
}
return r, nil
}

View File

@@ -0,0 +1,25 @@
package kvmaker
var database = map[string]string{
"TREE": "oak",
"ROCKET": "Saturn V",
"FRUIT": "apple",
"VEGETABLE": "carrot",
"SIMPSON": "homer",
}
type plugin struct{}
var KVSource plugin
func (p plugin) Get(
root string, args []string) (map[string]string, error) {
r := make(map[string]string)
for _, k := range args {
v, ok := database[k]
if ok {
r[k] = v
}
}
return r, nil
}

View File

@@ -11,7 +11,7 @@ import (
)
func TestSedTransformer(t *testing.T) {
tc := plugin.NewPluginTestEnv(t).Set()
tc := plugin.NewEnvForTest(t).Set()
defer tc.Reset()
tc.BuildExecPlugin("someteam.example.com", "v1", "SedTransformer")

View File

@@ -1,5 +1,3 @@
// +build plugin
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0

View File

@@ -11,7 +11,7 @@ import (
)
func TestSomeServiceGeneratorPlugin(t *testing.T) {
tc := plugin.NewPluginTestEnv(t).Set()
tc := plugin.NewEnvForTest(t).Set()
defer tc.Reset()
tc.BuildGoPlugin(

View File

@@ -1,5 +1,3 @@
// +build plugin
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0