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.0.7/csv-generation.md
+11-5Lines changed: 11 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ The `operator-sdk generate olm-catalog` command currently produces a generic CSV
14
14
15
15
## Proposed Solution
16
16
17
-
`operator-sdk generate olm-catalog` creates a `deploy` directory, which is the standard location for all manifests and scripts required to deploy an operator. This location is where users should place RBAC rules, deployments, CRD's, etc. We can leverage manifests in `deploy` to write a CSV.
17
+
`operator-sdk generate olm-catalog` creates a `deploy` directory, which is the standard location for all manifests and scripts required to deploy an operator. This location is where users should place RBAC rules, deployments, CRD's, etc. The SDK can leverage manifests in `deploy` to write a CSV.
18
18
19
19
`operator-sdk generate olm-catalog` will call the function `renderCSV` to either:
20
20
@@ -32,17 +32,21 @@ The `operator-sdk generate olm-catalog` command currently produces a generic CSV
32
32
33
33
### Extensible `CSVUpdater` CSV update mechanism
34
34
35
-
The CSV spec will likely change over time as new Kubernetes and OLM features are implemented; we need the ability to easily extend the update system. We can define the `CSVUpdater` interface as follows to encapsulate individual CSV field updates in methods:
35
+
The CSV spec will likely change over time as new Kubernetes and OLM features are implemented; we need the ability to easily extend the update system. The SDK will define the `CSVUpdater` interface as follows to encapsulate individual CSV field updates in methods:
`Apply` will use data from the underlying implementer of the `CSVUpdater` interface to operate on `*v1alpha1.ClusterServiceVersion` instance fields relevant to that updater. The OLM defines the entire CSV spec [in Golang][olm-code-csv-spec] as a (versioned) hierarchy of `struct` components, each of which we can alias to implement `CSVUpdater`. Once sub-step 2 is reached when creating or updating a CSV, `renderCSV` will extract each yaml document discovered, and pass document data into a dispatcher function. The dispatcher selects the correct `CSVUpdater` to populate based on the documents' `Kind` yaml object, a manifest type identifier used in all (*TODO*: verify) operator manifests. We access the latest version of CSV format and maintain OLM compatibility by leveraging the OLM spec implementations, rather than implementing the spec locally. The following is an example implementation of an [install strategy][olm-csv-install-strat-doc]`CSVUpdater`:
45
+
`Apply` will use data from the `CSVUpdater` implementer to operate on `*v1alpha1.ClusterServiceVersion` instance fields relevant to that updater. The OLM defines the entire CSV spec [in Golang][olm-code-csv-spec] as a (versioned) hierarchy of `struct` components, each of which the SDK can alias to implement `CSVUpdater`.
46
+
47
+
Once sub-step 2 is reached when creating or updating a CSV, `renderCSV` will extract each yaml document discovered, and pass document data into a dispatcher function. The dispatcher selects the correct `CSVUpdater` to populate based on the documents' `Kind` yaml object, a manifest type identifier used in all (*TODO*: verify) operator manifests. The SDK accesses the latest version of CSV format and maintains OLM compatibility by leveraging the OLM spec implementations, rather than implementing the spec locally.
48
+
49
+
The following is an example implementation of an [install strategy][olm-csv-install-strat-doc]`CSVUpdater`:
46
50
47
51
```Go
48
52
import (
@@ -179,7 +183,9 @@ customresourcedefinitions:
179
183
...
180
184
```
181
185
182
-
Each of the above yaml objects corresponds to homonymous `spec` object children described by the CSV [`spec` documentation][olm-csv-spec-doc]. [Here][describe-yaml-example] is a workable, complex example `describe.yaml` a Prometheus operator developer would write to assist the SDK in CSV generation.
186
+
Each of the above yaml objects corresponds to a homonymous `spec` object child described by the CSV [`spec` documentation][olm-csv-spec-doc]. [Here][describe-yaml-example] is a workable, complex example `describe.yaml` a Prometheus operator developer would write to assist the SDK in CSV generation.
187
+
188
+
**Note**: Several yaml objects currently in `describe.yaml` can potentially be parsed from operator code; this SDK functionality will be addressed in a future design document.
0 commit comments