You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--from-version string Semantic version of an existing CSV to use as a base
114
114
-h, --help help for csv
115
115
--operator-name string Operator name to use while generating CSV
116
-
--output-dir string Base directory to output generated CSV. The resulting CSV bundle directorywill be "<output-dir>/olm-catalog/<operator-name>/<csv-version>" (default "deploy")
116
+
--output-dir string Base directory to output generated CSV. The resulting CSV bundle directory will be "<output-dir>/olm-catalog/<operator-name>/<csv-version>". (default "deploy")
117
117
--update-crds Update CRD manifests in deploy/{operator-name}/{csv-version} the using latest API's
Copy file name to clipboardExpand all lines: doc/user/olm-catalog/generating-a-csv.md
+17-10Lines changed: 17 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,23 @@ This document describes how to manage the following lifecycle for your Operator
10
10
11
11
## Configuration
12
12
13
-
Operator SDK projects have an expected [project layout][doc-project-layout]. In particular, a few manifests are expected to be present in the `deploy` directory:
The CSV generator requires certain inputs to construct a CSV manifest.
20
16
21
-
`generate csv` extracts manifests from files in `deploy/` by default that match the kinds above and adds them to the CSV. If your manifest files are not in `deploy/`, you can use the `--include=[list of paths]` option to instruct the command to extract manifests from files at those paths, ex. `--include="deploy/prod,deploy/test"`. Setting `--include` overrides default behavior; if you still want default behavior, you must append `deploy/` to the list of paths passed to `--include`.
17
+
1. Path to the operator manifests root directory. By default `generate csv` extracts manifests from files in `deploy/` for the following kinds and adds them to the CSV. Use the `--deploy-dir` flag to change this path.
2. Path to API types root directory. The CSV generator also parses the [CSV annotations][csv-annotations] from the API type definitions to populate certain CSV fields. By default the API types directory is `pkg/apis/`. Use the `--apis-dir` flag to change this path. The CSV generator expects either of the following layouyts for the API types directory
By default `generate csv` will generate the catalog bundle directory `olm-catalog/...` under `deploy/`. To change where the CSV bundle directory is generated use the `--ouput-dir` flag.
22
30
23
31
## Versioning
24
32
@@ -66,7 +74,7 @@ Be sure to include the `--update-crds` flag if you want to add CRD's to your bun
66
74
67
75
Below are two lists of fields: the first is a list of all fields the SDK and OLM expect in a CSV, and the second are optional.
68
76
69
-
Several fields require user input (labeled _user_) or a [code annotation][code-annotations] (labeled _annotation_). This list may change as the SDK becomes better at generating CSV's.
77
+
Several fields require user input (labeled _user_) or a [CSV annotation][csv-annotations] (labeled _annotation_). This list may change as the SDK becomes better at generating CSV's.
--apis-dir string Project relative path to root directory for API type defintions (default "pkg/apis")
108
+
--crd-dir string Project relative path to root directory for for CRD manifests
23
109
--csv-channel string Channel the CSV should be registered under in the package manifest
24
-
--csv-config string Path to CSV config file. Defaults to deploy/olm-catalog/csv-config.yaml
25
110
--csv-version string Semantic version of the CSV
26
111
--default-channel Use the channel passed to --csv-channel as the package manifests' default channel. Only valid when --csv-channel is set
112
+
--deploy-dir string Project relative path to root directory for operator manifests (Deployment, RBAC, CRDs) (default "deploy")
27
113
--from-version string Semantic version of an existing CSV to use as a base
28
114
-h, --help help for csv
29
115
--operator-name string Operator name to use while generating CSV
116
+
--output-dir string Base directory to output generated CSV. The resulting CSV bundle directory will be "<output-dir>/olm-catalog/<operator-name>/<csv-version>". (default "deploy")
30
117
--update-crds Update CRD manifests in deploy/{operator-name}/{csv-version} the using latest API's
Copy file name to clipboardExpand all lines: website/content/en/docs/golang/olm-catalog/generating-a-csv.md
+16-29Lines changed: 16 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -10,43 +10,31 @@ This document describes how to manage the following lifecycle for your Operator
10
10
11
11
## Configuration
12
12
13
-
Operator SDK projects have an expected [project layout][doc-project-layout]. In particular, a few manifests are expected to be present in the `deploy` directory:
The CSV generator requires certain inputs to construct a CSV manifest.
19
16
20
-
`generate csv` reads these files and adds their data to a CSV in an alternate form.
17
+
1. Path to the operator manifests root directory. By default `generate csv` extracts manifests from files in `deploy/` for the following kinds and adds them to the CSV. Use the `--deploy-dir` flag to change this path.
2. Path to API types root directory. The CSV generator also parses the [CSV annotations][csv-annotations] from the API type definitions to populate certain CSV fields. By default the API types directory is `pkg/apis/`. Use the `--apis-dir` flag to change this path. The CSV generator expects either of the following layouyts for the API types directory
The following example config containing default values should be copied and written to `deploy/olm-catalog/csv-config.yaml`:
27
+
### Output
23
28
24
-
```yaml
25
-
crd-cr-paths:
26
-
- deploy/crds
27
-
operator-path: deploy/operator.yaml
28
-
role-paths:
29
-
- deploy/role.yaml
30
-
```
31
-
32
-
Explanation of all config fields:
33
-
34
-
- `crd-cr-paths`: list of strings - a list of CRD and CR manifest file/directory paths. Defaults to `[deploy/crds]`.
35
-
- `operator-path`: string - the operator `Deployment` manifest file path. Defaults to `deploy/operator.yaml`.
36
-
- `role-paths`: list of strings - Role and ClusterRole manifest file paths. Defaults to `[deploy/role.yaml]`.
37
-
- `operator-name`: string - the name used to create the CSV and manifest file names. Defaults to the project's name.
38
-
39
-
**Note**: The [design doc][doc-csv-design] has outdated field information which should not be referenced.
40
-
41
-
Fields in this config file can be modified to point towards alternate manifest locations, and passed to `generate csv --csv-config=<path>` to configure CSV generation. For example, if I have one set of production CR/CRD manifests under `deploy/crds/production`, and a set of test manifests under `deploy/crds/test`, and I only want to include production manifests in my CSV, I can set `crd-cr-paths: [deploy/crds/production]`. `generate csv` will then ignore `deploy/crds/test` when getting CR/CRD data.
29
+
By default `generate csv` will generate the catalog bundle directory `olm-catalog/...` under `deploy/`. To change where the CSV bundle directory is generated use the `--ouput-dir` flag.
42
30
43
31
## Versioning
44
32
45
33
CSV's are versioned in path, file name, and in their `metadata.name` field. For example, running `operator-sdk generate csv --csv-version 0.0.1` will generate a CSV at `deploy/olm-catalog/<operator-name>/0.0.1/<operator-name>.v0.0.1.clusterserviceversion.yaml`. A versioned directory such as `deploy/olm-catalog/<operator-name>/0.0.1` is known as a [*bundle*][doc-bundle]. Versions allow the OLM to upgrade or downgrade your Operator at runtime, i.e. in a cluster. A valid semantic version is required.
46
34
47
35
`generate csv` allows you to upgrade your CSV using the `--from-version` flag. If you have an existing CSV with version `0.0.1` and want to write a new version `0.0.2`, you can run `operator-sdk generate csv --csv-version 0.0.2 --from-version 0.0.1`. This will write a new CSV manifest to `deploy/olm-catalog/<operator-name>/0.0.2/<operator-name>.v0.0.2.clusterserviceversion.yaml` containing user-defined data from `0.0.1` and any modifications you've made to `roles.yaml`, `operator.yaml`, CR's, or CRD's.
48
36
49
-
The SDK can manage CRD's in your Operator bundle as well. You can pass the `--update-crds` flag to `generate csv` to add or update your CRD's in your bundle by copying manifests pointed to by `crd-cr-paths` in your config. CRD's in a bundle are not updated by default.
37
+
The SDK can manage CRD's in your Operator bundle as well. You can pass the `--update-crds` flag to `generate csv` to add or update your CRD's in your bundle by copying manifests in `deploy/crds` to your bundle. CRD's in a bundle are not updated by default.
50
38
51
39
## First Generation
52
40
@@ -86,7 +74,7 @@ Be sure to include the `--update-crds` flag if you want to add CRD's to your bun
86
74
87
75
Below are two lists of fields: the first is a list of all fields the SDK and OLM expect in a CSV, and the second are optional.
88
76
89
-
Several fields require user input (labeled _user_) or a [code annotation][code-annotations] (labeled _annotation_). This list may change as the SDK becomes better at generating CSV's.
77
+
Several fields require user input (labeled _user_) or a [CSV annotation][csv-annotations] (labeled _annotation_). This list may change as the SDK becomes better at generating CSV's.
0 commit comments