Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions pkg/utils/kube/resource_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ func (k *kubectlResourceOperations) ReplaceResource(ctx context.Context, obj *un
return err
}

if err := replaceOptions.Validate(); err != nil {
return fmt.Errorf("error validating replace options: %w", err)
}

return replaceOptions.Run(k.fact)
})
}
Expand Down Expand Up @@ -433,6 +429,10 @@ func (k *kubectlServerSideDiffDryRunApplier) newApplyOptions(ioStreams genericcl
}

o.ForceConflicts = true

if err := o.Validate(); err != nil {
return nil, fmt.Errorf("error validating options: %w", err)
}
return o, nil
}

Expand Down Expand Up @@ -462,6 +462,10 @@ func (k *kubectlResourceOperations) newApplyOptions(ioStreams genericclioptions.
if serverSideApply {
o.ForceConflicts = true
}

if err := o.Validate(); err != nil {
return nil, fmt.Errorf("error validating options: %w", err)
}
return o, nil
}

Expand Down Expand Up @@ -496,6 +500,10 @@ func (k *kubectlResourceOperations) newCreateOptions(ioStreams genericclioptions
return printer.PrintObj(obj, o.Out)
}
o.FilenameOptions.Filenames = []string{fileName}

if err := o.Validate(); err != nil {
return nil, fmt.Errorf("error validating options: %w", err)
}
return o, nil
}

Expand Down Expand Up @@ -551,6 +559,9 @@ func (k *kubectlResourceOperations) newReplaceOptions(config *rest.Config, f cmd
o.DeleteOptions.ForceDeletion = force
}

if err := o.Validate(); err != nil {
return nil, fmt.Errorf("error validating options: %w", err)
}
return o, nil
}

Expand Down Expand Up @@ -580,6 +591,10 @@ func newReconcileOptions(f cmdutil.Factory, kubeClient *kubernetes.Clientset, fi
return nil, fmt.Errorf("error configuring printer: %w", err)
}
o.PrintObject = printer.PrintObj

if err := o.Validate(); err != nil {
return nil, fmt.Errorf("error validating options: %w", err)
}
return o, nil
}

Expand Down