Skip to content

Commit 8205cbe

Browse files
committed
onboarding nvidia gpu operator to fbc
Signed-off-by: Adam D. Cornett <[email protected]>
1 parent 3c9dbbb commit 8205cbe

File tree

20 files changed

+76707
-0
lines changed

20 files changed

+76707
-0
lines changed

catalogs/v4.12/gpu-operator-certified/catalog.yaml

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

catalogs/v4.13/gpu-operator-certified/catalog.yaml

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

catalogs/v4.14/gpu-operator-certified/catalog.yaml

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

catalogs/v4.15/gpu-operator-certified/catalog.yaml

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

catalogs/v4.16/gpu-operator-certified/catalog.yaml

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

catalogs/v4.17/gpu-operator-certified/catalog.yaml

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

catalogs/v4.18/gpu-operator-certified/catalog.yaml

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

catalogs/v4.19/gpu-operator-certified/catalog.yaml

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

catalogs/v4.20/gpu-operator-certified/catalog.yaml

Lines changed: 15157 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
PWD=$(shell pwd)
8+
OPERATOR_NAME=$(shell basename $(PWD))
9+
TOPDIR=$(abspath $(dir $(PWD))/../)
10+
BINDIR=${TOPDIR}/bin
11+
12+
# Add the bin directory to the PATH
13+
export PATH := $(BINDIR):$(PATH)
14+
# A place to store the generated catalogs
15+
CATALOG_DIR=${TOPDIR}/catalogs
16+
17+
# The operator pipeline image to use for the fbc-onboarding target
18+
OPERATOR_PIPELINE_IMAGE ?= quay.io/redhat-isv/operator-pipelines-images:released
19+
20+
# Define the paths for both auth files
21+
DOCKER_CONFIG := $(HOME)/.docker/config.json
22+
CONTAINERS_AUTH := $(XDG_RUNTIME_DIR)/containers/auth.json
23+
24+
25+
.PHONY: fbc-onboarding
26+
fbc-onboarding: clean
27+
@if [ -f $(DOCKER_CONFIG) ]; then \
28+
echo "Using Docker config file: $(DOCKER_CONFIG)"; \
29+
CONFIG_VOLUME="-v $(DOCKER_CONFIG):/root/.docker/config.json"; \
30+
elif [ -f $(CONTAINERS_AUTH) ]; then \
31+
echo "Using containers auth file: $(CONTAINERS_AUTH)"; \
32+
CONFIG_VOLUME="-v $(CONTAINERS_AUTH):/root/.docker/config.json"; \
33+
else \
34+
echo "No authentication file found."; \
35+
fi; \
36+
podman run \
37+
--rm \
38+
--user $(id -u):$(id -g) \
39+
--security-opt label=disable \
40+
--pull always \
41+
-v $(TOPDIR):/workspace \
42+
$$CONFIG_VOLUME \
43+
$(OPERATOR_PIPELINE_IMAGE) fbc-onboarding \
44+
--repo-root /workspace \
45+
--operator-name $(OPERATOR_NAME) \
46+
--cache-dir /workspace/.catalog_cache
47+
48+
.PHONY: catalogs
49+
50+
# Catalogs are generated based on the mapping in ci.yaml file
51+
# The example of the mapping is:
52+
# fbc:
53+
# enabled: true
54+
# catalog_mapping:
55+
# - template_name: basic.yaml
56+
# catalog_names: ["v4.14", "v4.15", "v4.16"]
57+
# type: olm.template.basic
58+
# - template_name: semver.yaml
59+
# catalog_names: ["v4.13", "v4.17"]
60+
# type: olm.semver
61+
catalogs: render_catalogs.sh ${BINDIR}/opm ${BINDIR}/yq clean
62+
@echo "Rendering catalogs from templates"
63+
@${BINDIR}/render_catalogs.sh
64+
65+
66+
# validate-catalogs target illustrates FBC validation
67+
# all FBC must pass opm validation in order to be able to be used in a catalog
68+
.PHONY: validate-catalogs
69+
validate-catalogs: ${BINDIR}/opm
70+
@find ${TOPDIR}/catalogs -type d -name ${OPERATOR_NAME} -exec \
71+
sh -c '${BINDIR}/opm validate $$(dirname "{}") && echo "✅ Catalog validation passed: {}" || echo "❌ Catalog validation failed: {}"' \;
72+
73+
.PHONY: create-catalog-dir
74+
create-catalog-dir:
75+
@mkdir -p $(CATALOG_DIR)
76+
77+
.PHONY: clean
78+
clean: create-catalog-dir
79+
@echo "Cleaning up the operator catalogs from $(CATALOG_DIR)"
80+
@find $(CATALOG_DIR) -type d -name ${OPERATOR_NAME} -exec rm -rf {} +
81+
82+
83+
OS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
84+
ARCH=$(shell uname -m | sed 's/x86_64/amd64/')
85+
86+
# Automatically download the binaries and scripts and place them in the bin directory
87+
OPM_VERSION ?= v1.46.0
88+
${BINDIR}/opm:
89+
if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR}; fi
90+
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
91+
92+
YQ_VERSION ?= v4.45.1
93+
${BINDIR}/yq:
94+
if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR}; fi
95+
curl -sLO https://github.com/mikefarah/yq/releases/download/$(YQ_VERSION)/yq_$(OS)_$(ARCH) && mv yq_$(OS)_$(ARCH) ${BINDIR}/yq && chmod +x ${BINDIR}/yq
96+
97+
.PHONY: render_catalogs.sh
98+
render_catalogs.sh:
99+
if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR}; fi
100+
curl -sLO https://raw.githubusercontent.com/redhat-openshift-ecosystem/operator-pipelines/main/fbc/render_catalogs.sh
101+
mv render_catalogs.sh ${BINDIR}/render_catalogs.sh
102+
chmod +x ${BINDIR}/render_catalogs.sh

0 commit comments

Comments
 (0)