Skip to content

Commit 1a51cc5

Browse files
committed
doc/design/milestone-0.0.7/csv-generation.md: change actors in various sentences, make note of future changes to 'describe.yaml'
1 parent 640dce3 commit 1a51cc5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

doc/design/milestone-0.0.7/csv-generation.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The `operator-sdk generate olm-catalog` command currently produces a generic CSV
1414

1515
## Proposed Solution
1616

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.
1818

1919
`operator-sdk generate olm-catalog` will call the function `renderCSV` to either:
2020

@@ -32,17 +32,21 @@ The `operator-sdk generate olm-catalog` command currently produces a generic CSV
3232

3333
### Extensible `CSVUpdater` CSV update mechanism
3434

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:
3636

3737
```Go
38-
import v1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
38+
import "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
3939

4040
type CSVUpdater interface {
4141
Apply(*v1alpha1.ClusterServiceVersion) error
4242
}
4343
```
4444

45-
`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`:
4650

4751
```Go
4852
import (
@@ -179,7 +183,9 @@ customresourcedefinitions:
179183
...
180184
```
181185

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.
183189

184190

185191
[olm-csv-definition]:https://github.com/operator-framework/operator-lifecycle-manager/blob/master/Documentation/design/building-your-csv.md#what-is-a-cluster-service-version-csv

0 commit comments

Comments
 (0)