Skip to content

Commit 4b2b377

Browse files
committed
OCPBUGS-73844: Let import mode be decided by the cluster when not specified
Today, we default to "Legacy" importmode when no option is specified. With the introduction of https://issues.redhat.com/browse/MULTIARCH-4552, the importmode is determined by the Cluster version's `desired.architecture` - which if set to "Multi", the import mode is PreserveOriginal else Legacy. Hence we don't need to default to Legacy all the time.
1 parent 4df0e94 commit 4b2b377

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/cli/importimage/importimage.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func NewImportImageOptions(streams genericiooptions.IOStreams) *ImportImageOptio
100100
PrintFlags: genericclioptions.NewPrintFlags("imported"),
101101
IOStreams: streams,
102102
ReferencePolicy: tag.SourceReferencePolicy,
103-
ImportMode: string(imagev1.ImportModeLegacy),
104103
}
105104
}
106105

@@ -129,7 +128,7 @@ func NewCmdImportImage(f kcmdutil.Factory, streams genericiooptions.IOStreams) *
129128
cmd.Flags().BoolVar(&o.Confirm, "confirm", o.Confirm, "If true, allow the image stream import location to be set or changed")
130129
cmd.Flags().BoolVar(&o.All, "all", o.All, "If true, import all tags from the provided source on creation or if --from is specified")
131130
cmd.Flags().StringVar(&o.ReferencePolicy, "reference-policy", o.ReferencePolicy, "Allow to request pullthrough for external image when set to 'local'. Defaults to 'source'.")
132-
cmd.Flags().StringVar(&o.ImportMode, "import-mode", o.ImportMode, "Imports the full manifest list of a tag when set to 'PreserveOriginal'. Defaults to 'Legacy'.")
131+
cmd.Flags().StringVar(&o.ImportMode, "import-mode", o.ImportMode, "Imports the full manifest list of a tag when set to 'PreserveOriginal'. When set to 'Legacy', imports a single sub-manifest. When unspecified, the cluster determines the import mode.")
133132
cmd.Flags().BoolVar(&o.DryRun, "dry-run", o.DryRun, "Fetch information about images without creating or updating an image stream.")
134133
cmd.Flags().BoolVar(&o.Scheduled, "scheduled", o.Scheduled, "Set each imported container image to be periodically imported from a remote repository. Defaults to false.")
135134
cmd.Flags().BoolVar(&o.Insecure, "insecure", o.Insecure, "If true, allow importing from registries that have invalid HTTPS certificates or are hosted via HTTP. This flag will take precedence over the insecure annotation.")
@@ -218,7 +217,8 @@ func (o *ImportImageOptions) Validate() error {
218217
case string(imagev1.ImportModeLegacy):
219218
case string(imagev1.ImportModePreserveOriginal):
220219
case "":
221-
o.ImportMode = string(imagev1.ImportModeLegacy)
220+
// Leave empty and let it be decided based on the ClusterVersion's "desired.architecture" value. If the value is "Multi",
221+
// the import mode is set to "PreserveOriginal", if not it is set to "Legacy"
222222
default:
223223
return fmt.Errorf("valid ImportMode values are %s or %s", imagev1.ImportModeLegacy, imagev1.ImportModePreserveOriginal)
224224
}

0 commit comments

Comments
 (0)