Revert change on ApplyOptions

Change back `Options` to `ApplyOptions`, as well as remove
`pkg/kubectl/cmd/apply/apply.go` from `.golint_failures` again
This commit is contained in:
obitech 2019-05-23 13:28:13 +02:00
parent 994d7fc90d
commit ae41c0202b
2 changed files with 9 additions and 8 deletions

View File

@ -108,6 +108,7 @@ pkg/kubeapiserver
pkg/kubeapiserver/options pkg/kubeapiserver/options
pkg/kubectl pkg/kubectl
pkg/kubectl/cmd/annotate pkg/kubectl/cmd/annotate
pkg/kubectl/cmd/apply
pkg/kubectl/cmd/attach pkg/kubectl/cmd/attach
pkg/kubectl/cmd/autoscale pkg/kubectl/cmd/autoscale
pkg/kubectl/cmd/certificates pkg/kubectl/cmd/certificates

View File

@ -56,8 +56,8 @@ import (
"k8s.io/kubernetes/pkg/kubectl/validation" "k8s.io/kubernetes/pkg/kubectl/validation"
) )
// Options defines flags and other configuration parameters for the `apply` command // ApplyOptions defines flags and other configuration parameters for the `apply` command
type Options struct { type ApplyOptions struct {
RecordFlags *genericclioptions.RecordFlags RecordFlags *genericclioptions.RecordFlags
Recorder genericclioptions.Recorder Recorder genericclioptions.Recorder
@ -133,9 +133,9 @@ var (
warningNoLastAppliedConfigAnnotation = "Warning: %[1]s apply should be used on resource created by either %[1]s create --save-config or %[1]s apply\n" warningNoLastAppliedConfigAnnotation = "Warning: %[1]s apply should be used on resource created by either %[1]s create --save-config or %[1]s apply\n"
) )
// NewApplyOptions creates new Options for the `apply` command // NewApplyOptions creates new ApplyOptions for the `apply` command
func NewApplyOptions(ioStreams genericclioptions.IOStreams) *Options { func NewApplyOptions(ioStreams genericclioptions.IOStreams) *ApplyOptions {
return &Options{ return &ApplyOptions{
RecordFlags: genericclioptions.NewRecordFlags(), RecordFlags: genericclioptions.NewRecordFlags(),
DeleteFlags: delete.NewDeleteFlags("that contains the configuration to apply"), DeleteFlags: delete.NewDeleteFlags("that contains the configuration to apply"),
PrintFlags: genericclioptions.NewPrintFlags("created").WithTypeSetter(scheme.Scheme), PrintFlags: genericclioptions.NewPrintFlags("created").WithTypeSetter(scheme.Scheme),
@ -196,8 +196,8 @@ func NewCmdApply(baseName string, f cmdutil.Factory, ioStreams genericclioptions
return cmd return cmd
} }
// Complete verifies if Options are valid and without conflicts. // Complete verifies if ApplyOptions are valid and without conflicts.
func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command) error { func (o *ApplyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
o.ServerSideApply = cmdutil.GetServerSideApplyFlag(cmd) o.ServerSideApply = cmdutil.GetServerSideApplyFlag(cmd)
o.ForceConflicts = cmdutil.GetForceConflictsFlag(cmd) o.ForceConflicts = cmdutil.GetForceConflictsFlag(cmd)
o.FieldManager = cmdutil.GetFieldManagerFlag(cmd) o.FieldManager = cmdutil.GetFieldManagerFlag(cmd)
@ -329,7 +329,7 @@ func isIncompatibleServerError(err error) bool {
} }
// Run executes the `apply` command. // Run executes the `apply` command.
func (o *Options) Run() error { func (o *ApplyOptions) Run() error {
var openapiSchema openapi.Resources var openapiSchema openapi.Resources
if o.OpenAPIPatch { if o.OpenAPIPatch {
openapiSchema = o.OpenAPISchema openapiSchema = o.OpenAPISchema