operator-sdk generate bundle

operator-sdk generate bundle

Generates bundle data for the operator

Synopsis

Running ‘generate bundle’ is the first step to publishing your operator to a catalog and/or deploying it with OLM. This command generates a set of bundle manifests, metadata, and a bundle.Dockerfile for your operator, and will interactively ask for UI metadata, an important component of publishing your operator, by default unless a bundle for your operator exists or you set ‘–interactive=false’.

Set ‘–version’ to supply a semantic version for your bundle if you are creating one for the first time or upgrading an existing one.

If ‘–output-dir’ is set and you wish to build bundle images from that directory, either manually update your bundle.Dockerfile or set ‘–overwrite’.

More information on bundles: https://github.com/operator-framework/operator-registry/#manifest-format

  1. operator-sdk generate bundle [flags]

Examples

  1. # Create bundle manifests, metadata, and a bundle.Dockerfile:
  2. $ operator-sdk generate bundle --version 0.0.1
  3. INFO[0000] Generating bundle manifest version 0.0.1
  4. Display name for the operator (required):
  5. > memcached-operator
  6. ...
  7. # After running the above commands, you should see:
  8. $ tree deploy/olm-catalog
  9. deploy/olm-catalog
  10. └── memcached-operator
  11. ├── manifests
  12. ├── cache.example.com_memcacheds_crd.yaml
  13. └── memcached-operator.clusterserviceversion.yaml
  14. └── metadata
  15. └── annotations.yaml
  16. # Then build and push your bundle image:
  17. $ export USERNAME=<your registry username>
  18. $ export BUNDLE_IMG=quay.io/$USERNAME/memcached-operator-bundle:v0.0.1
  19. $ docker build -f bundle.Dockerfile -t $BUNDLE_IMG .
  20. Sending build context to Docker daemon 42.33MB
  21. Step 1/9 : FROM scratch
  22. ...
  23. $ docker push $BUNDLE_IMG

Options

  1. --apis-dir string Root directory for API type defintions
  2. --channels string A comma-separated list of channels the bundle belongs to (default "alpha")
  3. --crds-dir string Root directory for CustomResoureDefinition manifests
  4. --default-channel string The default channel for the bundle
  5. --deploy-dir string Root directory for operator manifests such as Deployments and RBAC, ex. 'deploy'. This directory is different from that passed to --input-dir
  6. -h, --help help for bundle
  7. --input-dir string Directory to read an existing bundle from. This directory is the parent of your bundle 'manifests' directory, and different from --deploy-dir
  8. --interactive When set or no bundle base exists, an interactive command prompt will be presented to accept bundle ClusterServiceVersion metadata
  9. --manifests Generate bundle manifests
  10. --metadata Generate bundle metadata and Dockerfile
  11. --operator-name string Name of the bundle's operator
  12. --output-dir string Directory to write the bundle to
  13. --overwrite Overwrite the bundle's metadata and Dockerfile if they exist (default true)
  14. -q, --quiet Run in quiet mode
  15. -v, --version string Semantic version of the operator in the generated bundle. Only set if creating a new bundle or upgrading your operator

SEE ALSO

Last modified June 23, 2020: Modify default value of overwrite flag in generate-bundle cmd (#3280) (29182e42)