1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/osdk-cli-reference-generate.adoc
2020-04-24 21:13:10 +00:00

94 lines
2.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * operators/operator_sdk/osdk-cli-reference.adoc
[id="osdk-cli-reference-generate_{context}"]
= generate
The `operator-sdk generate` command invokes a specific generator to generate
code as needed.
[id="osdk-cli-reference-generate-csv_{context}"]
== csv
The `csv` subcommand writes a Cluster Service Version (CSV) manifest for use
with Operator Lifecycle Manager (OLM). It also optionally writes Custom Resource
Definition (CRD) files to `deploy/olm-catalog/<operator_name>/<csv_version>`.
.`generate csv` flags
[options="header",cols="1,3"]
|===
|Flag |Description
|`--csv-channel` (string)
|The channel the CSV should be registered under in the package manifest.
|`--csv-config` (string)
|The path to the CSV configuration file. Default:
`deploy/olm-catalog/csv-config.yaml`.
|`--csv-version` (string)
|The semantic version of the CSV manifest. Required.
|`--default-channel`
|Use the channel passed to `--csv-channel` as the package manifests' default
channel. Only valid when `--csv-channel` is set.
|`--from-version` (string)
|The semantic version of CSV manifest to use as a base for a new version.
|`--operator-name`
|The Operator name to use while generating the CSV.
|`--update-crds`
|Updates CRD manifests in `deploy/<operator_name>/<csv_version>` using the
latest CRD manifests.
|===
.Example output
----
$ operator-sdk generate csv --csv-version 0.1.0 --update-crds
INFO[0000] Generating CSV manifest version 0.1.0
INFO[0000] Fill in the following required fields in file deploy/olm-catalog/operator-name/0.1.0/operator-name.v0.1.0.clusterserviceversion.yaml:
spec.keywords
spec.maintainers
spec.provider
spec.labels
INFO[0000] Created deploy/olm-catalog/operator-name/0.1.0/operator-name.v0.1.0.clusterserviceversion.yaml
----
[id="osdk-cli-reference-generate-k8s_{context}"]
== k8s
The `k8s` subcommand runs the Kubernetes
link:https://github.com/kubernetes/code-generator[code-generators] for all CRD
APIs under `pkg/apis/`. Currently, `k8s` only runs `deepcopy-gen` to generate
the required `DeepCopy()` functions for all Custom Resource (CR) types.
[NOTE]
====
This command must be run every time the API (`spec` and `status`) for a custom
resource type is updated.
====
.Example output
----
$ tree pkg/apis/app/v1alpha1/
pkg/apis/app/v1alpha1/
├── appservice_types.go
├── doc.go
├── register.go
$ operator-sdk generate k8s
Running code-generation for Custom Resource (CR) group versions: [app:v1alpha1]
Generating deepcopy funcs
$ tree pkg/apis/app/v1alpha1/
pkg/apis/app/v1alpha1/
├── appservice_types.go
├── doc.go
├── register.go
└── zz_generated.deepcopy.go
----