Skip to content

Commit b23fe0b

Browse files
authored
adds fbc resources for trident-operator (redhat-openshift-ecosystem#5550)
Signed-off-by: Chris Reeder <[email protected]>
1 parent ec204db commit b23fe0b

File tree

16 files changed

+828
-2
lines changed

16 files changed

+828
-2
lines changed

catalogs/v4.12/trident-operator/catalog.yaml

Lines changed: 95 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.13/trident-operator/catalog.yaml

Lines changed: 95 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.14/trident-operator/catalog.yaml

Lines changed: 95 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.15/trident-operator/catalog.yaml

Lines changed: 67 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.16/trident-operator/catalog.yaml

Lines changed: 67 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.17/trident-operator/catalog.yaml

Lines changed: 67 additions & 0 deletions
Large diffs are not rendered by default.

catalogs/v4.18/trident-operator/catalog.yaml

Lines changed: 67 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# This Makefile provides a set of targets to generate and validate operator catalogs
2+
# using the Operator Package Manager (opm) tool.
3+
4+
# The makefile should be placed in the root of the operator repository.
5+
# for example at: <operator-repo>/operators/<operator-name>/Makefile
6+
7+
# A user can customize "catalog" target to generate the operator catalog in a way
8+
# that suits the operator.
9+
# OPM allows for the generation of catalogs using different templates.
10+
# - basic: generates a basic catalog
11+
# - semver: generates a catalog with semver versioning
12+
13+
PDW=$(shell pwd)
14+
OPERATOR_NAME=$(shell basename $(PDW))
15+
TOPDIR=$(abspath $(dir $(PWD))/../)
16+
BINDIR=${TOPDIR}/bin
17+
18+
# Add the bin directory to the PATH
19+
export PATH := $(BINDIR):$(PATH)
20+
# A place to store the generated catalogs
21+
CATALOG_DIR=${TOPDIR}/catalogs
22+
23+
# A place to store the operator catalog templates
24+
OPERATOR_CATALOG_TEMPLATE_DIR = ${PDW}/catalog-templates
25+
26+
# The operator pipeline image to use for the fbc-onboarding target
27+
OPERATOR_PIPELINE_IMAGE ?= quay.io/redhat-isv/operator-pipelines-images:released
28+
29+
# Define the paths for both auth files
30+
DOCKER_CONFIG := $(HOME)/.docker/config.json
31+
CONTAINERS_AUTH := $(XDG_RUNTIME_DIR)/containers/auth.json
32+
33+
# A list of OCP versions to generate catalogs for
34+
# This list can be customized to include the versions that are relevant to the operator
35+
# DO NOT change this line (except for the versions) if you want to take advantage
36+
# of the automated catalog promotion
37+
OCP_VERSIONS=$(shell echo "v4.12 v4.13 v4.14 v4.15 v4.16 v4.17" )
38+
39+
40+
.PHONY: fbc-onboarding
41+
fbc-onboarding: clean
42+
@if [ -f $(DOCKER_CONFIG) ]; then \
43+
echo "Using Docker config file: $(DOCKER_CONFIG)"; \
44+
CONFIG_VOLUME="-v $(DOCKER_CONFIG):/root/.docker/config.json"; \
45+
elif [ -f $(CONTAINERS_AUTH) ]; then \
46+
echo "Using containers auth file: $(CONTAINERS_AUTH)"; \
47+
CONFIG_VOLUME="-v $(CONTAINERS_AUTH):/root/.docker/config.json"; \
48+
else \
49+
echo "No authentication file found."; \
50+
fi; \
51+
podman run \
52+
--rm \
53+
--user $(id -u):$(id -g) \
54+
--security-opt label=disable \
55+
--pull always \
56+
-v $(TOPDIR):/workspace \
57+
$$CONFIG_VOLUME \
58+
$(OPERATOR_PIPELINE_IMAGE) fbc-onboarding \
59+
--repo-root /workspace \
60+
--operator-name $(OPERATOR_NAME) \
61+
--cache-dir /workspace/.catalog_cache
62+
63+
.PHONY: catalogs
64+
# replace this stub with one customized to serve your needs ... some examples below
65+
66+
# here are a few examples of different approaches to fulfilling this target
67+
# comment out / customize the one that makes the most sense, or use them as examples in defining your own
68+
#
69+
# --- BASIC TEMPLATE ---
70+
catalogs: basic
71+
#
72+
# --- SEMVER TEMPLATE ---
73+
#catalogs: semver
74+
75+
76+
# basic target provides an example FBC generation from a `basic` template type.
77+
# this example takes a single file as input and generates a well-formed FBC operator contribution as an output
78+
.PHONY: basic
79+
basic: ${BINDIR}/opm clean
80+
for version in $(OCP_VERSIONS); do \
81+
mkdir -p ${CATALOG_DIR}/$${version}/${OPERATOR_NAME}/ && \
82+
${BINDIR}/opm alpha render-template basic -o yaml ${OPERATOR_CATALOG_TEMPLATE_DIR}/$${version}.yaml > ${CATALOG_DIR}/$${version}/${OPERATOR_NAME}/catalog.yaml; \
83+
done
84+
85+
86+
# semver target provides an example FBC generation from a `semver` template type.
87+
# this example takes a single file as input and generates a well-formed FBC operator contribution as an output
88+
.PHONY: semver
89+
semver: ${BINDIR}/opm clean
90+
for version in $(OCP_VERSIONS); do \
91+
mkdir -p ${CATALOG_DIR}/$${version}/${OPERATOR_NAME}/ && \
92+
${BINDIR}/opm alpha render-template semver -o yaml ${OPERATOR_CATALOG_TEMPLATE_DIR}/$${version}.yaml > ${CATALOG_DIR}/$${version}/${OPERATOR_NAME}/catalog.yaml; \
93+
done
94+
95+
96+
# validate-catalogs target illustrates FBC validation
97+
# all FBC must pass opm validation in order to be able to be used in a catalog
98+
.PHONY: validate-catalogs
99+
validate-catalogs: ${BINDIR}/opm
100+
for version in $(OCP_VERSIONS); do \
101+
${BINDIR}/opm validate $(CATALOG_DIR)/$${version}/${OPERATOR_NAME} && echo "$${version} catalog validation passed" || echo "$${version} catalog validation failed"; \
102+
done
103+
104+
.PHONY: create-catalog-dir
105+
create-catalog-dir:
106+
mkdir -p $(CATALOG_DIR)
107+
108+
.PHONY: clean
109+
clean: create-catalog-dir
110+
find $(CATALOG_DIR) -type d -name ${OPERATOR_NAME} -exec rm -rf {} +
111+
112+
113+
OS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
114+
ARCH=$(shell uname -m | sed 's/x86_64/amd64/')
115+
116+
# Automatically download the opm binary
117+
OPM_VERSION ?= v1.46.0
118+
${BINDIR}/opm:
119+
if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR}; fi
120+
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 ${BINDIR}/opm

operators/trident-operator/catalog-templates/v4.12.yaml

Lines changed: 24 additions & 0 deletions
Large diffs are not rendered by default.

operators/trident-operator/catalog-templates/v4.13.yaml

Lines changed: 24 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)