operator-sdk pkgman-to-bundle
operator-sdk pkgman-to-bundle
Migrates packagemanifests to bundles
Synopsis
βpkgman-to-bundleβ command helps in migrating OLM packagemanifests to bundles which is the preferred OLM packaging format. This command takes an input packagemanifest directory and generates bundles for each of the versions of manifests present in the input directory. Additionally, it also provides the flexibility to build bundle images for each of the generated bundles.
The generated bundles are always written on disk. Location for the generated bundles can be specified using ββoutput-dirβ. If not specified, the default location would be βbundle/β directory.
The base container image name for the bundles can be provided using ββimage-tag-baseβ flag. This should be provided without the tag, since the tag for the images would be the bundle version, (ie) image names will be in the format <base_image>:<bundle_version>.
Specify the build command for building container images using ββbuild-cmdβ flag. The default build command is βdocker buildβ. The command will need to be in the βPATHβ or fully qualified path name should be provided.
operator-sdk pkgman-to-bundle <packagemanifestdir> [flags]
Examples
# Provide the packagemanifests directory as input to the command. Consider the packagemanifests directory to have the following
# structure:
$ tree packagemanifests/
packagemanifests
βββ etcd
βββ 0.0.1
β βββ etcdcluster.crd.yaml
β βββ etcdoperator.clusterserviceversion.yaml
βββ 0.0.2
β βββ etcdbackup.crd.yaml
β βββ etcdcluster.crd.yaml
β βββ etcdoperator.v0.0.2.clusterserviceversion.yaml
β βββ etcdrestore.crd.yaml
βββ etcd.package.yaml
# Run the following command to generate bundles in the default 'bundle/' directory with the base-container image name
# to be 'quay.io/example/etcd'
$ operator-sdk pkgman-to-bundle packagemanifests --image-tag-base quay.io/example/etcd
INFO[0000] Packagemanifests will be migrated to bundles in bundle directory
INFO[0000] Creating bundle/bundle-0.0.1/bundle.Dockerfile
INFO[0000] Creating bundle/bundle-0.0.1/metadata/annotations.yaml
...
# After running the above command, the bundles will be generated in 'bundles/' directory.
$ tree bundles/
bundles/
βββ bundle-0.0.1
β βββ bundle
β β βββ manifests
β β β βββ etcdcluster.crd.yaml
β β β βββ etcdoperator.clusterserviceversion.yaml
β β βββ metadata
β β β βββ annotations.yaml
β β βββ tests
β β βββ scorecard
β β βββ config.yaml
β βββ bundle.Dockerfile
βββ bundle-0.0.2
βββ bundle
β βββ manifests
β β βββ etcdbackup.crd.yaml
β β βββ etcdcluster.crd.yaml
β β βββ etcdoperator.v0.0.2.clusterserviceversion.yaml
β β βββ etcdrestore.crd.yaml
β βββ metadata
β βββ annotations.yaml
βββ bundle.Dockerfile
A custom command to build bundle images can also be specified using the '--build-cmd' flag. For example,
$ operator-sdk pkgman-to-bundle packagemanifests --image-tag-base quay.io/example/etcd --build-cmd "podman build -f bundle.Dockerfile . -t"
Images for the both the bundles will be built with the following names: quay.io/example/etcd:0.0.1 and quay.io/example/etcd:0.0.2.
Options
--build-cmd string Build command to be run for building images. By default 'docker build' is run.
-h, --help help for pkgman-to-bundle
--image-tag-base string Base container image name for bundle image tags, ex. my.reg/foo/bar-operator-bundle will become my.reg/foo/bar-operator-bundle:${package-dir-name} for each child directory name in the packagemanifests directory
--output-dir string Directory to write bundle to. (default "bundles")
Options inherited from parent commands
--plugins strings plugin keys to be used for this subcommand execution
--verbose Enable verbose logging