operator-sdk generate packagemanifests
operator-sdk generate packagemanifests
Generates package manifests data for the operator
Synopsis
Note: while the package manifests format is not yet deprecated, the operator-framework is migrated towards using bundles by default. Run ‘operator-sdk generate bundle -h’ for more information.
This command generates a set of manifests in a versioned directory and a package manifest file for your operator. Each versioned directory consists of a ClusterServiceVersion (CSV), CustomResourceDefinitions (CRDs), and manifests not part of the CSV but required by the operator.
A CSV manifest is generated by collecting data from the set of manifests passed to this command (see below), such as CRDs, RBAC, etc., and applying that data to a “base” CSV manifest. This base CSV can contain metadata, added by hand or by the ‘generate kustomize manifests’ command, and can be passed in like any other manifest (see below) or by file at the exact path ‘<kustomize-dir>/bases/<package-name>.clusterserviceversion.yaml’. Be aware that ‘generate packagemanifests’ idempotently regenerates a packagemanifests directory, so all non-metadata values in a base will be overwritten. If no base was passed in, input manifest data will be applied to an empty CSV.
There are two ways to pass the to-be-packaged set of manifests to this command: stdin via a Unix pipe, or in a directory using ‘–input-dir’. See command help for more information on these modes. Passing a directory is useful for running ‘generate packagemanifests’ outside of a project or within a project that does not use kustomize and/or contains cluster-ready manifests on disk.
Set ‘–version’ to supply a semantic version for your new package.
More information on the package manifests format: https://github.com/operator-framework/operator-registry/#manifest-format
operator-sdk generate packagemanifests [flags]
Examples
# If running within a project, make sure a 'config' kustomize directory exists and has a 'config/manifests':
$ tree config/manifests
config/manifests
├── bases
│ └── memcached-operator.clusterserviceversion.yaml
└── kustomization.yaml
# Generate a 0.0.1 packagemanifests by passing manifests to stdin:
$ kustomize build config/manifests | operator-sdk generate packagemanifests --version 0.0.1
Generating package manifests version 0.0.1
...
# If running outside of a project, make sure cluster-ready manifests are available on disk:
$ tree deploy/
deploy/
├── crds
│ └── cache.my.domain_memcacheds.yaml
├── deployment.yaml
├── role.yaml
├── role_binding.yaml
├── service_account.yaml
└── webhooks.yaml
# Generate a 0.0.1 packagemanifests by passing manifests by dir:
$ operator-sdk generate packagemanifests --deploy-dir deploy --version 0.0.1
Generating package manifests version 0.0.1
...
# After running in either of the above modes, you should see this directory structure:
$ tree packagemanifests/
packagemanifests/
├── 0.0.1
│ ├── cache.my.domain_memcacheds.yaml
│ └── memcached-operator.clusterserviceversion.yaml
└── memcached-operator.package.yaml
Options
--channel string Channel name for the generated package
--crds-dir string Directory to read cluster-ready CustomResoureDefinition manifests from. This option can only be used if --deploy-dir is set
--default-channel Use the channel passed to --channel as the package manifest file's default channel
--deploy-dir string Directory to read cluster-ready operator manifests from. If --crds-dir is not set, CRDs are ready from this directory
--from-version string Semantic version of the operator being upgraded from
-h, --help help for packagemanifests
--input-dir string Directory to read existing package manifests from. This directory is the parent of individual versioned package directories, and different from --deploy-dir (default "packagemanifests")
--kustomize-dir string Directory containing kustomize bases in a "bases" dir and a kustomization.yaml for operator-framework manifests (default "config/manifests")
--output-dir string Directory in which to write package manifests
--package string Package name
-q, --quiet Run in quiet mode
--stdout Write package to stdout
--update-objects Update non-CSV objects in this package, ex. CustomResoureDefinitions, Roles (default true)
-v, --version string Semantic version of the packaged operator
Options inherited from parent commands
--plugins strings plugin keys to be used for this subcommand execution
--verbose Enable verbose logging
SEE ALSO
- operator-sdk generate - Invokes a specific generator
Last modified March 24, 2021: deps: bump kubebuilder to v3.0.0-beta.1 (#4581) (1e014367)