remove LabelsForObject and ResolveImage from factory

This commit is contained in:
juanvallejo
2018-05-21 15:07:08 -04:00
parent 1f0d950579
commit 8fc0bfd287
5 changed files with 13 additions and 72 deletions

View File

@@ -49,7 +49,7 @@ type SetImageOptions struct {
All bool
Output string
Local bool
ResolveImage func(in string) (string, error)
ResolveImage ImageResolver
PrintObj printers.ResourcePrinterFunc
Recorder genericclioptions.Recorder
@@ -137,7 +137,7 @@ func (o *SetImageOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args [
o.UpdatePodSpecForObject = f.UpdatePodSpecForObject
o.DryRun = cmdutil.GetDryRunFlag(cmd)
o.Output = cmdutil.GetFlagString(cmd, "output")
o.ResolveImage = f.ResolveImage
o.ResolveImage = resolveImageFunc
if o.DryRun {
o.PrintFlags.Complete("%s (dry run)")
@@ -309,3 +309,13 @@ func hasWildcardKey(containerImages map[string]string) bool {
_, ok := containerImages["*"]
return ok
}
// ImageResolver is a func that receives an image name, and
// resolves it to an appropriate / compatible image name.
// Adds flexibility for future image resolving methods.
type ImageResolver func(in string) (string, error)
// implements ImageResolver
func resolveImageFunc(in string) (string, error) {
return in, nil
}