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.

  1. operator-sdk pkgman-to-bundle <packagemanifestdir> [flags]

Examples

  1. # Provide the packagemanifests directory as input to the command. Consider the packagemanifests directory to have the following
  2. # structure:
  3. $ tree packagemanifests/
  4. packagemanifests
  5. └── etcd
  6. ├── 0.0.1
  7. ├── etcdcluster.crd.yaml
  8. └── etcdoperator.clusterserviceversion.yaml
  9. ├── 0.0.2
  10. ├── etcdbackup.crd.yaml
  11. ├── etcdcluster.crd.yaml
  12. ├── etcdoperator.v0.0.2.clusterserviceversion.yaml
  13. └── etcdrestore.crd.yaml
  14. └── etcd.package.yaml
  15. # Run the following command to generate bundles in the default 'bundle/' directory with the base-container image name
  16. # to be 'quay.io/example/etcd'
  17. $ operator-sdk pkgman-to-bundle packagemanifests --image-tag-base quay.io/example/etcd
  18. INFO[0000] Packagemanifests will be migrated to bundles in bundle directory
  19. INFO[0000] Creating bundle/bundle-0.0.1/bundle.Dockerfile
  20. INFO[0000] Creating bundle/bundle-0.0.1/metadata/annotations.yaml
  21. ...
  22. # After running the above command, the bundles will be generated in 'bundles/' directory.
  23. $ tree bundles/
  24. bundles/
  25. ├── bundle-0.0.1
  26. ├── bundle
  27. ├── manifests
  28. ├── etcdcluster.crd.yaml
  29. ├── etcdoperator.clusterserviceversion.yaml
  30. ├── metadata
  31. └── annotations.yaml
  32. └── tests
  33. └── scorecard
  34. └── config.yaml
  35. └── bundle.Dockerfile
  36. └── bundle-0.0.2
  37. ├── bundle
  38. ├── manifests
  39. ├── etcdbackup.crd.yaml
  40. ├── etcdcluster.crd.yaml
  41. ├── etcdoperator.v0.0.2.clusterserviceversion.yaml
  42. ├── etcdrestore.crd.yaml
  43. └── metadata
  44. └── annotations.yaml
  45. └── bundle.Dockerfile
  46. A custom command to build bundle images can also be specified using the '--build-cmd' flag. For example,
  47. $ operator-sdk pkgman-to-bundle packagemanifests --image-tag-base quay.io/example/etcd --build-cmd "podman build -f bundle.Dockerfile . -t"
  48. 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

  1. --build-cmd string Build command to be run for building images. By default 'docker build' is run.
  2. -h, --help help for pkgman-to-bundle
  3. --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
  4. --output-dir string Directory to write bundle to. (default "bundles")

Options inherited from parent commands

  1. --plugins strings plugin keys to be used for this subcommand execution
  2. --verbose Enable verbose logging

SEE ALSO

Last modified June 9, 2021: fix: build-cmd arg in pkgman-to-bundle (#4964) (375acc76)