Skip to content

Commit 899be89

Browse files
authored
updates and composite template examples (#3)
* converting veneer references to template references * add composite template examples Signed-off-by: Jordan Keister <[email protected]>
1 parent fbc1efe commit 899be89

File tree

10 files changed

+72
-13
lines changed

10 files changed

+72
-13
lines changed

Makefile

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,29 @@ catalog: $(OPERATOR_CATALOG_CONTRIBUTION)
2121
# here are a few examples of different approaches to fulfilling this target
2222
# comment out / customize the one that makes the most sense, or use them as examples in defining your own
2323
#
24-
# --- BASIC VENEER ---
24+
# --- BASIC TEMPLATE ---
2525
#catalog: basic framework
2626
#
27-
# --- SEMVER VENEER ---
27+
# --- SEMVER TEMPLATE ---
2828
#catalog: semver framework
2929
#
30-
# --- COMPOUND VENEER ---
31-
# this case is for when a single veneer cannot support the use-case, and automated changes to the generated FBC need to be made before it is complete
30+
# --- COMPOSITE TEMPLATE ---
31+
# composite target processes a composite template to generate the FBC contributions
32+
# `render-template composite` has `--validate` option enabled by default,
33+
# so no subsequent validation is required
34+
.PHONY: composite
35+
composite: bin/opm
36+
bin/opm alpha render-template composite -f catalogs.yaml -c contributions.yaml
37+
38+
#
39+
# --- COMPOUND TEMPLATE ---
40+
# this case is for when a single template cannot support the use-case, and automated changes to the generated FBC need to be made before it is complete
3241
# this example models the need to set the v0.2.1 of the operator with the `olm.deprecated` property, to prevent installation
3342
#
3443
#catalog: $(YQ) semver framework
3544
# $(YQ) eval 'select(.name == "testoperator.v0.2.1" and .schema == "olm.bundle").properties += [{"type" : "olm.deprecated", "value" : "true"}]' -i $(OPERATOR_CATALOG_CONTRIBUTION)
3645

37-
# framework target provides two pieces that are helpful for any veneer approach:
46+
# framework target provides two pieces that are helpful for any template approach:
3847
# - an OWNERS file to provide default contribution control
3948
# - an .indexignore file to illustrate how to add content to the FBC contribution which should be
4049
# excluded from validation via `opm validate`
@@ -44,20 +53,20 @@ framework: CATALOG_OWNERS
4453
echo "OWNERS" > $(OPERATOR_CATALOG_DIR)/.indexignore
4554

4655

47-
# basic target provides an example FBC generation from a `basic` veneer type.
56+
# basic target provides an example FBC generation from a `basic` template type.
4857
# this example takes a single file as input and generates a well-formed FBC operator contribution as an output
4958
# the 'validate' target should be used next to validate the output
5059
.PHONY: basic
51-
basic: bin/opm basic-veneer.yaml clean
52-
mkdir -p $(OPERATOR_CATALOG_DIR) && bin/opm alpha render-veneer basic -o yaml basic-veneer.yaml > $(OPERATOR_CATALOG_CONTRIBUTION)
60+
basic: bin/opm basic-template.yaml clean
61+
mkdir -p $(OPERATOR_CATALOG_DIR) && bin/opm alpha render-template basic -o yaml basic-template.yaml > $(OPERATOR_CATALOG_CONTRIBUTION)
5362

5463

55-
# semver target provides an example FBC generation from a `semver` veneer type.
64+
# semver target provides an example FBC generation from a `semver` template type.
5665
# this example takes a single file as input and generates a well-formed FBC operator contribution as an output
5766
# the 'validate' target should be used next to validate the output
5867
.PHONY: semver
59-
semver: bin/opm semver-veneer.yaml clean
60-
mkdir -p $(OPERATOR_CATALOG_DIR) && bin/opm alpha render-veneer semver -o yaml semver-veneer.yaml > $(OPERATOR_CATALOG_CONTRIBUTION)
68+
semver: bin/opm semver-template.yaml clean
69+
mkdir -p $(OPERATOR_CATALOG_DIR) && bin/opm alpha render-template semver -o yaml semver-template.yaml > $(OPERATOR_CATALOG_CONTRIBUTION)
6170

6271

6372
# validate target illustrates FBC validation
@@ -68,7 +77,7 @@ validate: bin/opm $(OPERATOR_CATALOG_CONTRIBUTION) preverify
6877

6978

7079
# preverify target ensures that the operator name is consistent between the destination directory and the generated catalog
71-
# since the veneer will be modified outside the build process but needs to be consistent with the directory name
80+
# since the template will be modified outside the build process but needs to be consistent with the directory name
7281
.PHONY: preverify
7382
preverify: $(YQ) $(OPERATOR_CATALOG_CONTRIBUTION)
7483
./validate.sh -n $(OPERATOR_NAME) -f $(OPERATOR_CATALOG_CONTRIBUTION)
@@ -81,7 +90,7 @@ clean:
8190

8291
OS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
8392
ARCH=$(shell uname -m | sed 's/x86_64/amd64/')
84-
OPM_VERSION ?= v1.26.1
93+
OPM_VERSION ?= v1.36.0
8594
bin/opm:
8695
mkdir -p bin
8796
curl -sLO https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$(OS)-$(ARCH)-opm && chmod +x $(OS)-$(ARCH)-opm && mv $(OS)-$(ARCH)-opm bin/opm
File renamed without changes.

catalogs.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
schema: olm.composite.catalogs
3+
catalogs:
4+
- name: example-basic-catalog
5+
destination:
6+
workingDir: catalog/example-basic-catalog
7+
builders:
8+
- olm.builder.basic
9+
- name: example-semver-catalog
10+
destination:
11+
workingDir: catalog/example-semver-catalog
12+
builders:
13+
- olm.builder.semver
14+
- name: another-example-semver-catalog
15+
destination:
16+
workingDir: catalog/another-example-semver-catalog
17+
builders:
18+
- olm.builder.semver

contributions.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
schema: olm.composite
2+
components:
3+
- name: example-basic-catalog
4+
destination:
5+
path: testoperator
6+
strategy:
7+
name: basic
8+
template:
9+
schema: olm.builder.basic
10+
config:
11+
input: basic-template.yaml
12+
output: catalog.yaml
13+
- name: example-semver-catalog
14+
destination:
15+
path: testoperator
16+
strategy:
17+
name: semver
18+
template:
19+
schema: olm.builder.semver
20+
config:
21+
input: semver-template.yaml
22+
output: catalog.yaml
23+
- name: another-example-semver-catalog
24+
destination:
25+
path: testoperator
26+
strategy:
27+
name: semver
28+
template:
29+
schema: olm.builder.semver
30+
config:
31+
input: semver-template.yaml
32+
output: catalog.yaml
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)