operator-sdk bundle create

operator-sdk bundle create

Create an operator bundle image

Synopsis

The ‘operator-sdk bundle create’ command will build an operator bundle image containing operator metadata and manifests, tagged with the provided image tag.

To write all files required to build a bundle image without building the image, set ‘–generate-only=true’. A bundle.Dockerfile and bundle metadata will be written if ‘–generate-only=true’:

  1. $ operator-sdk bundle create --generate-only --directory ./deploy/olm-catalog/test-operator/manifests
  2. $ ls .
  3. ...
  4. bundle.Dockerfile
  5. ...
  6. $ tree ./deploy/olm-catalog/test-operator/
  7. ./deploy/olm-catalog/test-operator/
  8. ├── manifests
  9. ├── example.com_tests_crd.yaml
  10. └── test-operator.clusterserviceversion.yaml
  11. └── metadata
  12. └── annotations.yaml

‘–generate-only’ is useful if you want to build an operator’s bundle image manually or modify metadata before building an image.

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

NOTE: bundle images are not runnable.

  1. operator-sdk bundle create [flags]

Examples

  1. The following invocation will build a test-operator 0.1.0 bundle image using Docker.
  2. This image will contain manifests for package channels 'stable' and 'beta':
  3. $ operator-sdk bundle create quay.io/example/test-operator:v0.1.0 \
  4. --directory ./deploy/olm-catalog/test-operator/manifests \
  5. --package test-operator \
  6. --channels stable,beta \
  7. --default-channel stable
  8. Assuming your operator has the same name as your repo directory and the only
  9. channel is 'stable', the above command can be abbreviated to:
  10. $ operator-sdk bundle create quay.io/example/test-operator:v0.1.0
  11. The following invocation will generate test-operator bundle metadata and a
  12. bundle.Dockerfile for your latest operator version without building the image:
  13. $ operator-sdk bundle create \
  14. --generate-only \
  15. --package test-operator \
  16. --channels beta \
  17. --default-channel beta

Options

  1. -c, --channels string The comma-separated list of channels that bundle image belongs to (default "stable")
  2. -e, --default-channel string The default channel for the bundle image
  3. -d, --directory string The directory where bundle manifests are located, ex. <project-root>/deploy/olm-catalog/test-operator/manifests
  4. -g, --generate-only Generate metadata/, manifests/ and a Dockerfile on disk without building the bundle image
  5. -h, --help help for create
  6. -b, --image-builder string Tool to build container images. One of: [docker, podman, buildah] (default "docker")
  7. -o, --output-dir string Optional output directory for operator manifests
  8. --overwrite Overwrite bundle.Dockerfile, manifests and metadata dirs if they exist. If --output-dir is also set, the original files will not be overwritten
  9. -p, --package string The name of the package that bundle image belongs to. Set if package name differs from project name
  10. -t, --tag string The path of a registry to pull from, image name and its tag that present the bundle image (e.g. quay.io/test/test-operator:v0.1.0)

SEE ALSO

Last modified May 27, 2020: replace OCP enhancement #2880 links for sdk docs ones (#3104) (3c6af359)