diff --git a/internal/olm/fbcutil/util.go b/internal/olm/fbcutil/util.go index f7a2346fea..57c930044f 100644 --- a/internal/olm/fbcutil/util.go +++ b/internal/olm/fbcutil/util.go @@ -47,6 +47,8 @@ const ( // DefaultIndexImage is the index base image used if none is specified. It contains no bundles. // TODO(v2.0.0): pin this image tag to a specific version. DefaultIndexImage = DefaultIndexImageBase + "latest" + // DefaultInitImage is the default image to be used in the registry init container + DefaultInitImage = "docker.io/library/busybox:1.36.0" ) // BundleDeclcfg represents a minimal File-Based Catalog. diff --git a/internal/olm/operator/bundle/install.go b/internal/olm/operator/bundle/install.go index c5b373f6df..bee9ce98c6 100644 --- a/internal/olm/operator/bundle/install.go +++ b/internal/olm/operator/bundle/install.go @@ -51,6 +51,9 @@ func NewInstall(cfg *operator.Configuration) Install { func (i *Install) BindFlags(fs *pflag.FlagSet) { fs.StringVar(&i.IndexImage, "index-image", fbcutil.DefaultIndexImage, "index image in which to inject bundle") + fs.StringVar(&i.InitImage, "decompression-image", fbcutil.DefaultInitImage, "image used in an init container in "+ + "the registry pod to decompress the compressed catalog contents. cat and gzip binaries are expected to exist "+ + "in the PATH") fs.Var(&i.InstallMode, "install-mode", "install mode") // --mode is hidden so only users who know what they're doing can alter add mode. diff --git a/internal/olm/operator/registry/fbcindex/fbc_registry_pod.go b/internal/olm/operator/registry/fbcindex/fbc_registry_pod.go index 9da6c2414e..8bb336cf36 100644 --- a/internal/olm/operator/registry/fbcindex/fbc_registry_pod.go +++ b/internal/olm/operator/registry/fbcindex/fbc_registry_pod.go @@ -60,6 +60,9 @@ type FBCRegistryPod struct { //nolint:maligned // new version of an operator bundle when published can be added to an index image IndexImage string + // InitImage is the image to be used in the registry init container + InitImage string + // GRPCPort is the container grpc port GRPCPort int32 @@ -349,7 +352,7 @@ func (f *FBCRegistryPod) addGZIPInitContainer(containerVolumeMount []corev1.Volu initContainerVolumeMount := append(containerVolumeMount, gzipVolumeMount...) f.pod.Spec.InitContainers = append(f.pod.Spec.InitContainers, corev1.Container{ Name: defaultInitContainerName, - Image: "docker.io/library/busybox:1.36.0", + Image: f.InitImage, Command: []string{ "sh", "-c", diff --git a/internal/olm/operator/registry/index_image.go b/internal/olm/operator/registry/index_image.go index 2f080d3761..048271b232 100644 --- a/internal/olm/operator/registry/index_image.go +++ b/internal/olm/operator/registry/index_image.go @@ -98,6 +98,7 @@ type IndexImageCatalogCreator struct { FBCContent string PackageName string IndexImage string + InitImage string BundleImage string SecretName string CASecretName string @@ -518,12 +519,16 @@ func (c IndexImageCatalogCreator) createAnnotatedRegistry(ctx context.Context, c if c.IndexImage == "" { c.IndexImage = fbcutil.DefaultIndexImage } + if c.InitImage == "" { + c.InitImage = fbcutil.DefaultInitImage + } if c.HasFBCLabel { // Initialize and create the FBC registry pod. fbcRegistryPod := fbcindex.FBCRegistryPod{ BundleItems: items, IndexImage: c.IndexImage, + InitImage: c.InitImage, FBCContent: c.FBCContent, SecurityContext: c.SecurityContext.String(), } diff --git a/website/content/en/docs/cli/operator-sdk_run_bundle.md b/website/content/en/docs/cli/operator-sdk_run_bundle.md index 7619e18309..d707be1ed2 100644 --- a/website/content/en/docs/cli/operator-sdk_run_bundle.md +++ b/website/content/en/docs/cli/operator-sdk_run_bundle.md @@ -29,6 +29,7 @@ operator-sdk run bundle [flags] ``` --ca-secret-name string Name of a generic secret containing a PEM root certificate file required to pull bundle images. This secret *must* be in the namespace that this command is configured to run in, and the file *must* be encoded under the key "cert.pem" + --decompression-image string image used in an init container in the registry pod to decompress the compressed catalog contents. cat and gzip binaries are expected to exist in the PATH (default "docker.io/library/busybox:1.36.0") -h, --help help for bundle --index-image string index image in which to inject bundle (default "quay.io/operator-framework/opm:latest") --install-mode InstallModeValue install mode