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
Copy file name to clipboardExpand all lines: doc/design/milestone-0.2.0/csv-generation.md
+49-46Lines changed: 49 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ The `operator-sdk generate olm-catalog` command currently produces a generic CSV
14
14
15
15
## Proposed Solution
16
16
17
-
Functionality of `operator-sdk generate olm-catalog` is now a branch in `operator-sdk build`, specifically when called with the `--gen-csv` flag; the former command no longer exists. `operator-sdk build quay.io/example/operator:v0.0.1 --gen-csv"` writes a CSV yaml file using the operators' current version to the `deploy/olm-catalog` directory by default. `deploy` is the standard location for all manifests and scripts required to deploy an operator. The SDK can use data from manifests in `deploy` to write a CSV. Users may have different requirements for what should (not) be included in a CSV, and can configure CSV composition via `deploy/olm-catalog/csv-config.yaml`, described below.
17
+
Functionality of `operator-sdk generate olm-catalog` is now in `operator-sdk build --gen-csv`; the former command no longer exists. `operator-sdk build quay.io/example/operator:v0.0.1 --gen-csv` writes a CSV yaml file using the operators' current version to the `deploy/olm-catalog` directory by default. Version is parsed from the image name argument, ex. `0.0.1` from `quay.io/example/operator:v0.0.1`.
18
+
19
+
`deploy` is the standard location for all manifests required to deploy an operator. The SDK can use data from manifests in `deploy` to write a CSV. Exactly three types of manifests are required to generate a CSV: `operator.yaml`, `*_{crd,cr}.yaml`, and RBAC role files, ex. `role.yaml`. Users may have different versioning requirements for these files and can configure CSV which specific files are included in `deploy/olm-catalog/csv-config.yaml`, described below.
18
20
19
21
Assuming all configuration defaults are used, `operator-sdk build` will call `scaffold.Execute()`, which will either:
20
22
@@ -28,15 +30,17 @@ Assuming all configuration defaults are used, `operator-sdk build` will call `sc
28
30
1. Update an existing CSV at the currently pre-defined location, using available data in yaml manifests and source files.
29
31
30
32
1. The update mechanism will check for an existing CSV in `deploy`. Upon finding one, the CSV yaml file contents will be marshalled into a `ClusterServiceVersion` cache.
31
-
1. Same as above.
32
-
1. Same as above.
33
+
1. The update mechanism will search `deploy` for manifests that contain data a CSV uses, such as a `Deployment` Kubernetes API resource, and set the appropriate CSV fields in the cache with this data.
34
+
1. Once the search completes, every cache field populated will be written back to a CSV yaml file.
35
+
-**Note:** individual yaml fields are overwritten and not the entire file, as descriptions and other non-generated parts of a CSV should be preserved.
33
36
34
37
### Configuration
35
38
36
39
Users can configure CSV composition by populating several fields in the file `deploy/olm-catalog/csv-config.yaml`:
37
40
38
-
-`search-directory`: (string) the directory to search for yaml manifest files. Defaults to `deploy`.
39
-
-`exclude-files`: ([string[, string]*]) files that match any string in the list are not included in the CSV search; glob matching allowed. Defaults to empty.
41
+
-`operator-path`: (string) the operator resource manifest file path. Defaults to `deploy/operator.yaml`.
42
+
-`crd-cr-path-list`: (string(, string)\*) a list of CRD and CR manifest file paths. Defaults to `[deploy/crds/*_{crd,cr}.yaml]`.
43
+
-`rbac-path-list`: (string(, string)\*) a list of RBAC role manifest file paths. Defaults to `[deploy/role.yaml]`.
40
44
41
45
### Extensible `CSVUpdater` CSV update mechanism
42
46
@@ -46,7 +50,7 @@ The CSV spec will likely change over time as new Kubernetes and OLM features are
-`spec.provider`: the operators' provider, with a `name`; usually an organization.
144
147
-`spec.labels`: 1..N `key`:`value` pairs to be used by operator internals.
145
148
-`spec.version`: semantic version of the operator, ex. `0.1.1`.
146
-
-`spec.customresourcedefinitions`: any CRD's the operator uses. This field will be populated automatically by the SDK if any CRD yaml files are present in `deploy`; however, several fields require user input (more details in the [CSV CRD spec section][olm_csv_crd_doc]):
149
+
-`spec.customresourcedefinitions`: any CRD's the operator uses. This field will be populated automatically by the SDK if any CRD yaml files are present in `deploy`; however, several fields not in the CRD manifest spec that require user input (more details in the [CSV CRD spec section][olm_csv_crd_doc]):
147
150
- `description`: description of the CRD.
148
151
- `resources`: any Kubernetes resources leveraged by the CRD, ex. `Pod`'s, `StatefulSet`'s.
149
152
- `specDescriptors`: UI hints for inputs and outputs of the operator.
@@ -173,4 +176,4 @@ The CSV version is the same as the operators', and should be included somewhere
0 commit comments