Move flagbuilder to a shared package

Splitting up the CoreOS PR into manageable chunks
This commit is contained in:
Justin Santa Barbara 2017-01-15 18:22:45 -05:00
parent 17afbd6292
commit fa0d9e9d3c
3 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,7 @@ k8s.io/kops/pkg/client/simple
k8s.io/kops/pkg/client/simple/vfsclientset
k8s.io/kops/pkg/diff
k8s.io/kops/pkg/featureflag
k8s.io/kops/pkg/flagbuilder
k8s.io/kops/pkg/kubeconfig
k8s.io/kops/pkg/model
k8s.io/kops/pkg/model/components

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package nodeup
package flagbuilder
import (
"fmt"
@ -25,8 +25,8 @@ import (
"strings"
)
// buildFlags is a template helper, which builds a string containing the flags to be passed to a command
func buildFlags(options interface{}) (string, error) {
// BuildFlags builds flag arguments based on "flag" tags on the structure
func BuildFlags(options interface{}) (string, error) {
var flags []string
walker := func(path string, field *reflect.StructField, val reflect.Value) error {

View File

@ -26,6 +26,7 @@ import (
"github.com/golang/glog"
"k8s.io/kops"
api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/flagbuilder"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/secrets"
"k8s.io/kops/util/pkg/vfs"
@ -123,7 +124,7 @@ func (t *templateFunctions) populate(dest template.FuncMap) {
dest["AllTokens"] = t.AllTokens
dest["GetToken"] = t.GetToken
dest["BuildFlags"] = buildFlags
dest["BuildFlags"] = flagbuilder.BuildFlags
dest["Base64Encode"] = func(s string) string {
return base64.StdEncoding.EncodeToString([]byte(s))
}