mirror of https://github.com/k3s-io/k3s
cleanup TODO comments from PrintFlags wiring
parent
a67ccaeab1
commit
7b1b107ea4
|
@ -51,6 +51,7 @@ import (
|
|||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
"k8s.io/kubernetes/pkg/kubectl/scheme"
|
||||
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
|
||||
"k8s.io/kubernetes/pkg/kubectl/validation"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
)
|
||||
|
||||
|
@ -64,15 +65,27 @@ type ApplyOptions struct {
|
|||
DeleteFlags *DeleteFlags
|
||||
DeleteOptions *DeleteOptions
|
||||
|
||||
Selector string
|
||||
DryRun bool
|
||||
Prune bool
|
||||
PruneResources []pruneResource
|
||||
cmdBaseName string
|
||||
All bool
|
||||
Overwrite bool
|
||||
OpenApiPatch bool
|
||||
PruneWhitelist []string
|
||||
Selector string
|
||||
DryRun bool
|
||||
Prune bool
|
||||
PruneResources []pruneResource
|
||||
cmdBaseName string
|
||||
All bool
|
||||
Overwrite bool
|
||||
OpenApiPatch bool
|
||||
PruneWhitelist []string
|
||||
ShouldIncludeUninitialized bool
|
||||
|
||||
Validator validation.Schema
|
||||
Builder *resource.Builder
|
||||
Mapper meta.RESTMapper
|
||||
Scaler scaleclient.ScalesGetter
|
||||
DynamicClient dynamic.DynamicInterface
|
||||
ClientSetFunc func() (internalclientset.Interface, error)
|
||||
OpenAPISchema openapi.Resources
|
||||
|
||||
Namespace string
|
||||
EnforceNamespace bool
|
||||
|
||||
genericclioptions.IOStreams
|
||||
}
|
||||
|
@ -145,7 +158,7 @@ func NewCmdApply(baseName string, f cmdutil.Factory, ioStreams genericclioptions
|
|||
cmdutil.CheckErr(o.Complete(f, cmd))
|
||||
cmdutil.CheckErr(validateArgs(cmd, args))
|
||||
cmdutil.CheckErr(validatePruneAll(o.Prune, o.All, o.Selector))
|
||||
cmdutil.CheckErr(o.Run(f, cmd))
|
||||
cmdutil.CheckErr(o.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -198,6 +211,32 @@ func (o *ApplyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
}
|
||||
|
||||
o.DeleteOptions = o.DeleteFlags.ToOptions(o.IOStreams)
|
||||
o.ShouldIncludeUninitialized = cmdutil.ShouldIncludeUninitialized(cmd, o.Prune)
|
||||
|
||||
o.OpenAPISchema, _ = f.OpenAPISchema()
|
||||
o.ClientSetFunc = f.ClientSet
|
||||
o.Validator, err = f.Validator(cmdutil.GetFlagBool(cmd, "validate"))
|
||||
o.Builder = f.NewBuilder()
|
||||
o.Mapper, err = f.RESTMapper()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Scaler, err = f.ScaleClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.DynamicClient, err = f.DynamicClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Namespace, o.EnforceNamespace, err = f.DefaultNamespace()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -249,56 +288,37 @@ func parsePruneResources(mapper meta.RESTMapper, gvks []string) ([]pruneResource
|
|||
return pruneResources, nil
|
||||
}
|
||||
|
||||
// TODO(juanvallejo): break dependency on factory and cmd
|
||||
func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error {
|
||||
schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
func (o *ApplyOptions) Run() error {
|
||||
var openapiSchema openapi.Resources
|
||||
if o.OpenApiPatch {
|
||||
openapiSchema, err = f.OpenAPISchema()
|
||||
if err != nil {
|
||||
openapiSchema = nil
|
||||
}
|
||||
}
|
||||
|
||||
cmdNamespace, enforceNamespace, err := f.DefaultNamespace()
|
||||
if err != nil {
|
||||
return err
|
||||
openapiSchema = o.OpenAPISchema
|
||||
}
|
||||
|
||||
// include the uninitialized objects by default if --prune is true
|
||||
// unless explicitly set --include-uninitialized=false
|
||||
includeUninitialized := cmdutil.ShouldIncludeUninitialized(cmd, o.Prune)
|
||||
r := f.NewBuilder().
|
||||
r := o.Builder.
|
||||
Unstructured().
|
||||
Schema(schema).
|
||||
Schema(o.Validator).
|
||||
ContinueOnError().
|
||||
NamespaceParam(cmdNamespace).DefaultNamespace().
|
||||
FilenameParam(enforceNamespace, &o.DeleteOptions.FilenameOptions).
|
||||
NamespaceParam(o.Namespace).DefaultNamespace().
|
||||
FilenameParam(o.EnforceNamespace, &o.DeleteOptions.FilenameOptions).
|
||||
LabelSelectorParam(o.Selector).
|
||||
IncludeUninitialized(includeUninitialized).
|
||||
IncludeUninitialized(o.ShouldIncludeUninitialized).
|
||||
Flatten().
|
||||
Do()
|
||||
if err := r.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mapper, err := f.RESTMapper()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var err error
|
||||
if o.Prune {
|
||||
o.PruneResources, err = parsePruneResources(mapper, o.PruneWhitelist)
|
||||
o.PruneResources, err = parsePruneResources(o.Mapper, o.PruneWhitelist)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
output := cmdutil.GetFlagString(cmd, "output")
|
||||
output := *o.PrintFlags.OutputFormat
|
||||
shortOutput := output == "name"
|
||||
|
||||
encoder := scheme.DefaultJSONEncoder()
|
||||
|
@ -382,22 +402,15 @@ func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
if _, ok := annotationMap[api.LastAppliedConfigAnnotation]; !ok {
|
||||
fmt.Fprintf(o.ErrOut, warningNoLastAppliedConfigAnnotation, o.cmdBaseName)
|
||||
}
|
||||
scaler, err := f.ScaleClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
helper := resource.NewHelper(info.Client, info.Mapping)
|
||||
dynamicClient, err := f.DynamicClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
patcher := &patcher{
|
||||
encoder: encoder,
|
||||
decoder: deserializer,
|
||||
mapping: info.Mapping,
|
||||
helper: helper,
|
||||
dynamicClient: dynamicClient,
|
||||
clientsetFunc: f.ClientSet,
|
||||
dynamicClient: o.DynamicClient,
|
||||
clientsetFunc: o.ClientSetFunc,
|
||||
overwrite: o.Overwrite,
|
||||
backOff: clockwork.NewRealClock(),
|
||||
force: o.DeleteOptions.ForceDeletion,
|
||||
|
@ -405,7 +418,7 @@ func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
timeout: o.DeleteOptions.Timeout,
|
||||
gracePeriod: o.DeleteOptions.GracePeriod,
|
||||
openapiSchema: openapiSchema,
|
||||
scaleClient: scaler,
|
||||
scaleClient: o.Scaler,
|
||||
}
|
||||
|
||||
patchBytes, patchedObject, err := patcher.patch(info.Object, modified, info.Source, info.Namespace, info.Name, o.ErrOut)
|
||||
|
@ -479,15 +492,10 @@ func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
dynamicClient, err := f.DynamicClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p := pruner{
|
||||
mapper: mapper,
|
||||
dynamicClient: dynamicClient,
|
||||
clientsetFunc: f.ClientSet,
|
||||
mapper: o.Mapper,
|
||||
dynamicClient: o.DynamicClient,
|
||||
clientsetFunc: o.ClientSetFunc,
|
||||
|
||||
labelSelector: o.Selector,
|
||||
visitedUids: visitedUids,
|
||||
|
@ -495,26 +503,27 @@ func (o *ApplyOptions) Run(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
cascade: o.DeleteOptions.Cascade,
|
||||
dryRun: o.DryRun,
|
||||
gracePeriod: o.DeleteOptions.GracePeriod,
|
||||
scaler: o.Scaler,
|
||||
|
||||
toPrinter: o.ToPrinter,
|
||||
|
||||
out: o.Out,
|
||||
}
|
||||
|
||||
namespacedRESTMappings, nonNamespacedRESTMappings, err := getRESTMappings(mapper, &(o.PruneResources))
|
||||
namespacedRESTMappings, nonNamespacedRESTMappings, err := getRESTMappings(o.Mapper, &(o.PruneResources))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error retrieving RESTMappings to prune: %v", err)
|
||||
}
|
||||
|
||||
for n := range visitedNamespaces {
|
||||
for _, m := range namespacedRESTMappings {
|
||||
if err := p.prune(f, n, m, includeUninitialized); err != nil {
|
||||
if err := p.prune(n, m, o.ShouldIncludeUninitialized); err != nil {
|
||||
return fmt.Errorf("error pruning namespaced object %v: %v", m.GroupVersionKind, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, m := range nonNamespacedRESTMappings {
|
||||
if err := p.prune(f, metav1.NamespaceNone, m, includeUninitialized); err != nil {
|
||||
if err := p.prune(metav1.NamespaceNone, m, o.ShouldIncludeUninitialized); err != nil {
|
||||
return fmt.Errorf("error pruning nonNamespaced object %v: %v", m.GroupVersionKind, err)
|
||||
}
|
||||
}
|
||||
|
@ -585,12 +594,14 @@ type pruner struct {
|
|||
dryRun bool
|
||||
gracePeriod int
|
||||
|
||||
scaler scaleclient.ScalesGetter
|
||||
|
||||
toPrinter func(string) (printers.ResourcePrinterFunc, error)
|
||||
|
||||
out io.Writer
|
||||
}
|
||||
|
||||
func (p *pruner) prune(f cmdutil.Factory, namespace string, mapping *meta.RESTMapping, includeUninitialized bool) error {
|
||||
func (p *pruner) prune(namespace string, mapping *meta.RESTMapping, includeUninitialized bool) error {
|
||||
objList, err := p.dynamicClient.Resource(mapping.Resource).
|
||||
Namespace(namespace).
|
||||
List(metav1.ListOptions{
|
||||
|
@ -606,10 +617,6 @@ func (p *pruner) prune(f cmdutil.Factory, namespace string, mapping *meta.RESTMa
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
scaler, err := f.ScaleClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, obj := range objs {
|
||||
metadata, err := meta.Accessor(obj)
|
||||
|
@ -627,7 +634,7 @@ func (p *pruner) prune(f cmdutil.Factory, namespace string, mapping *meta.RESTMa
|
|||
}
|
||||
name := metadata.GetName()
|
||||
if !p.dryRun {
|
||||
if err := p.delete(namespace, name, mapping, scaler); err != nil {
|
||||
if err := p.delete(namespace, name, mapping, p.scaler); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ go_library(
|
|||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/client-go/dynamic:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1:go_default_library",
|
||||
],
|
||||
|
|
|
@ -19,19 +19,19 @@ package create
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"net/url"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
|
||||
|
@ -340,6 +340,12 @@ type CreateSubcommandOptions struct {
|
|||
DryRun bool
|
||||
CreateAnnotation bool
|
||||
|
||||
Namespace string
|
||||
EnforceNamespace bool
|
||||
|
||||
Mapper meta.RESTMapper
|
||||
DynamicClient dynamic.DynamicInterface
|
||||
|
||||
PrintObj func(obj kruntime.Object) error
|
||||
|
||||
genericclioptions.IOStreams
|
||||
|
@ -352,7 +358,7 @@ func NewCreateSubcommandOptions(ioStreams genericclioptions.IOStreams) *CreateSu
|
|||
}
|
||||
}
|
||||
|
||||
func (o *CreateSubcommandOptions) Complete(cmd *cobra.Command, args []string, generator kubectl.StructuredGenerator) error {
|
||||
func (o *CreateSubcommandOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string, generator kubectl.StructuredGenerator) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -375,38 +381,43 @@ func (o *CreateSubcommandOptions) Complete(cmd *cobra.Command, args []string, ge
|
|||
return printer.PrintObj(obj, o.Out)
|
||||
}
|
||||
|
||||
o.Namespace, o.EnforceNamespace, err = f.DefaultNamespace()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.DynamicClient, err = f.DynamicClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.Mapper, err = f.RESTMapper()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO(juanvallejo): remove dependency on factory here. Complete necessary bits
|
||||
// from it in the Complete() method.
|
||||
// RunCreateSubcommand executes a create subcommand using the specified options
|
||||
func RunCreateSubcommand(f cmdutil.Factory, options *CreateSubcommandOptions) error {
|
||||
namespace, nsOverriden, err := f.DefaultNamespace()
|
||||
func (o *CreateSubcommandOptions) Run() error {
|
||||
obj, err := o.StructuredGenerator.StructuredGenerate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj, err := options.StructuredGenerator.StructuredGenerate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mapper, err := f.RESTMapper()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !options.DryRun {
|
||||
if !o.DryRun {
|
||||
// create subcommands have compiled knowledge of things they create, so type them directly
|
||||
gvks, _, err := legacyscheme.Scheme.ObjectKinds(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gvk := gvks[0]
|
||||
mapping, err := mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
|
||||
mapping, err := o.Mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := kubectl.CreateOrUpdateAnnotation(options.CreateAnnotation, obj, cmdutil.InternalVersionJSONEncoder()); err != nil {
|
||||
if err := kubectl.CreateOrUpdateAnnotation(o.CreateAnnotation, obj, cmdutil.InternalVersionJSONEncoder()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -414,14 +425,10 @@ func RunCreateSubcommand(f cmdutil.Factory, options *CreateSubcommandOptions) er
|
|||
if err := legacyscheme.Scheme.Convert(obj, asUnstructured, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
dynamicClient, err := f.DynamicClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if mapping.Scope.Name() == meta.RESTScopeNameRoot {
|
||||
namespace = ""
|
||||
o.Namespace = ""
|
||||
}
|
||||
actualObject, err := dynamicClient.Resource(mapping.Resource).Namespace(namespace).Create(asUnstructured)
|
||||
actualObject, err := o.DynamicClient.Resource(mapping.Resource).Namespace(o.Namespace).Create(asUnstructured)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -429,10 +436,10 @@ func RunCreateSubcommand(f cmdutil.Factory, options *CreateSubcommandOptions) er
|
|||
// ensure we pass a versioned object to the printer
|
||||
obj = actualObject
|
||||
} else {
|
||||
if meta, err := meta.Accessor(obj); err == nil && nsOverriden {
|
||||
meta.SetNamespace(namespace)
|
||||
if meta, err := meta.Accessor(obj); err == nil && o.EnforceNamespace {
|
||||
meta.SetNamespace(o.Namespace)
|
||||
}
|
||||
}
|
||||
|
||||
return options.PrintObj(obj)
|
||||
return o.PrintObj(obj)
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, ioStreams genericclioptio
|
|||
Long: clusterRoleBindingLong,
|
||||
Example: clusterRoleBindingExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, ioStreams genericclioptio
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ClusterRoleBindingOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ClusterRoleBindingOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -90,10 +90,10 @@ func (o *ClusterRoleBindingOpts) Complete(cmd *cobra.Command, args []string) err
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateClusterRoleBinding is the implementation of the create clusterrolebinding command.
|
||||
func (o *ClusterRoleBindingOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ClusterRoleBindingOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -74,8 +74,8 @@ func NewCmdCreateConfigMap(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
Long: configMapLong,
|
||||
Example: configMapExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ func NewCmdCreateConfigMap(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ConfigMapOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ConfigMapOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -111,10 +111,10 @@ func (o *ConfigMapOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateConfigMap is the implementation of the create configmap command.
|
||||
func (o *ConfigMapOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ConfigMapOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ func NewCmdCreateDeployment(f cmdutil.Factory, ioStreams genericclioptions.IOStr
|
|||
Example: deploymentExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -143,13 +143,13 @@ func (o *DeploymentOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// createDeployment
|
||||
// 1. Reads user config values from Cobra.
|
||||
// 2. Sets up the correct Generator object.
|
||||
// 3. Calls RunCreateSubcommand.
|
||||
func (o *DeploymentOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *DeploymentOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -153,6 +153,6 @@ func TestCreateDeploymentNoImage(t *testing.T) {
|
|||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
err = options.Run(tf)
|
||||
err = options.Run()
|
||||
assert.Error(t, err, "at least one image must be specified")
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ func NewCmdCreateNamespace(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
Long: namespaceLong,
|
||||
Example: namespaceExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func NewCmdCreateNamespace(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *NamespaceOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *NamespaceOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -81,10 +81,10 @@ func (o *NamespaceOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateNamespace implements the behavior to run the create namespace command
|
||||
func (o *NamespaceOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *NamespaceOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, ioStreams genericcliopti
|
|||
Long: pdbLong,
|
||||
Example: pdbExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, ioStreams genericcliopti
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *PodDisruptionBudgetOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *PodDisruptionBudgetOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -100,10 +100,10 @@ func (o *PodDisruptionBudgetOpts) Complete(cmd *cobra.Command, args []string) er
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreatePodDisruptionBudget implements the behavior to run the create pdb command.
|
||||
func (o *PodDisruptionBudgetOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *PodDisruptionBudgetOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ func TestCreatePdb(t *testing.T) {
|
|||
IOStreams: ioStreams,
|
||||
},
|
||||
}
|
||||
err := options.Complete(cmd, []string{pdbName})
|
||||
err := options.Complete(tf, cmd, []string{pdbName})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
err = options.Run(tf)
|
||||
err = options.Run()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO
|
|||
Long: pcLong,
|
||||
Example: pcExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *PriorityClassOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *PriorityClassOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -92,10 +92,10 @@ func (o *PriorityClassOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreatePriorityClass implements the behavior to run the create priorityClass command.
|
||||
func (o *PriorityClassOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *PriorityClassOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ func TestCreatePriorityClass(t *testing.T) {
|
|||
IOStreams: ioStreams,
|
||||
},
|
||||
}
|
||||
err := options.Complete(cmd, []string{pcName})
|
||||
err := options.Complete(tf, cmd, []string{pcName})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
err = options.Run(tf)
|
||||
err = options.Run()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ func NewCmdCreateQuota(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||
Long: quotaLong,
|
||||
Example: quotaExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func NewCmdCreateQuota(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *QuotaOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *QuotaOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -89,10 +89,10 @@ func (o *QuotaOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateQuota implements the behavior to run the create quota command
|
||||
func (o *QuotaOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *QuotaOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ func NewCmdCreateRoleBinding(f cmdutil.Factory, ioStreams genericclioptions.IOSt
|
|||
Long: roleBindingLong,
|
||||
Example: roleBindingExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ func NewCmdCreateRoleBinding(f cmdutil.Factory, ioStreams genericclioptions.IOSt
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *RoleBindingOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *RoleBindingOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -91,9 +91,9 @@ func (o *RoleBindingOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
func (o *RoleBindingOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *RoleBindingOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ func NewCmdCreateSecretGeneric(f cmdutil.Factory, ioStreams genericclioptions.IO
|
|||
Long: secretLong,
|
||||
Example: secretExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ func NewCmdCreateSecretGeneric(f cmdutil.Factory, ioStreams genericclioptions.IO
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *SecretGenericOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *SecretGenericOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -128,12 +128,12 @@ func (o *SecretGenericOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateSecretGeneric is the implementation of the create secret generic command
|
||||
func (o *SecretGenericOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *SecretGenericOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -174,8 +174,8 @@ func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, ioStreams genericcliopt
|
|||
Long: secretForDockerRegistryLong,
|
||||
Example: secretForDockerRegistryExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, ioStreams genericcliopt
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *SecretDockerRegistryOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *SecretDockerRegistryOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -228,12 +228,12 @@ func (o *SecretDockerRegistryOpts) Complete(cmd *cobra.Command, args []string) e
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateSecretDockerRegistry is the implementation of the create secret docker-registry command
|
||||
func (o *SecretDockerRegistryOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *SecretDockerRegistryOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -265,8 +265,8 @@ func NewCmdCreateSecretTLS(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
Long: secretForTLSLong,
|
||||
Example: secretForTLSExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ func NewCmdCreateSecretTLS(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *SecretTLSOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *SecretTLSOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -306,10 +306,10 @@ func (o *SecretTLSOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateSecretTLS is the implementation of the create secret tls command
|
||||
func (o *SecretTLSOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *SecretTLSOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ func NewCmdCreateServiceClusterIP(f cmdutil.Factory, ioStreams genericclioptions
|
|||
Long: serviceClusterIPLong,
|
||||
Example: serviceClusterIPExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ func errUnsupportedGenerator(cmd *cobra.Command, generatorName string) error {
|
|||
return cmdutil.UsageErrorf(cmd, "Generator %s not supported. ", generatorName)
|
||||
}
|
||||
|
||||
func (o *ServiceClusterIPOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ServiceClusterIPOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -115,12 +115,12 @@ func (o *ServiceClusterIPOpts) Complete(cmd *cobra.Command, args []string) error
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateServiceClusterIP is the implementation of the create service clusterip command
|
||||
func (o *ServiceClusterIPOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ServiceClusterIPOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -149,8 +149,8 @@ func NewCmdCreateServiceNodePort(f cmdutil.Factory, ioStreams genericclioptions.
|
|||
Long: serviceNodePortLong,
|
||||
Example: serviceNodePortExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ func NewCmdCreateServiceNodePort(f cmdutil.Factory, ioStreams genericclioptions.
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ServiceNodePortOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ServiceNodePortOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -184,12 +184,12 @@ func (o *ServiceNodePortOpts) Complete(cmd *cobra.Command, args []string) error
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateServiceNodePort is the implementation of the create service nodeport command
|
||||
func (o *ServiceNodePortOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ServiceNodePortOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -218,8 +218,8 @@ func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, ioStreams genericcliopti
|
|||
Long: serviceLoadBalancerLong,
|
||||
Example: serviceLoadBalancerExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, ioStreams genericcliopti
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ServiceLoadBalancerOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ServiceLoadBalancerOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -251,12 +251,12 @@ func (o *ServiceLoadBalancerOpts) Complete(cmd *cobra.Command, args []string) er
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateServiceLoadBalancer is the implementation of the create service loadbalancer command
|
||||
func (o *ServiceLoadBalancerOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ServiceLoadBalancerOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -289,8 +289,8 @@ func NewCmdCreateServiceExternalName(f cmdutil.Factory, ioStreams genericcliopti
|
|||
Long: serviceExternalNameLong,
|
||||
Example: serviceExternalNameExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ func NewCmdCreateServiceExternalName(f cmdutil.Factory, ioStreams genericcliopti
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ServiceExternalNameOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ServiceExternalNameOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -324,10 +324,10 @@ func (o *ServiceExternalNameOpts) Complete(cmd *cobra.Command, args []string) er
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateExternalNameService is the implementation of the create service externalname command
|
||||
func (o *ServiceExternalNameOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ServiceExternalNameOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ func NewCmdCreateServiceAccount(f cmdutil.Factory, ioStreams genericclioptions.I
|
|||
Long: serviceAccountLong,
|
||||
Example: serviceAccountExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.Complete(cmd, args))
|
||||
cmdutil.CheckErr(options.Run(f))
|
||||
cmdutil.CheckErr(options.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(options.Run())
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ func NewCmdCreateServiceAccount(f cmdutil.Factory, ioStreams genericclioptions.I
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (o *ServiceAccountOpts) Complete(cmd *cobra.Command, args []string) error {
|
||||
func (o *ServiceAccountOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||
name, err := NameFromCommandArgs(cmd, args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -80,10 +80,10 @@ func (o *ServiceAccountOpts) Complete(cmd *cobra.Command, args []string) error {
|
|||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
}
|
||||
|
||||
return o.CreateSubcommandOptions.Complete(cmd, args, generator)
|
||||
return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
|
||||
}
|
||||
|
||||
// CreateServiceAccount implements the behavior to run the create service account command
|
||||
func (o *ServiceAccountOpts) Run(f cmdutil.Factory) error {
|
||||
return RunCreateSubcommand(f, o.CreateSubcommandOptions)
|
||||
func (o *ServiceAccountOpts) Run() error {
|
||||
return o.CreateSubcommandOptions.Run()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue