Skip to content
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENVTEST_K8S_VERSION = 1.32 #refers to the version of kubebuilder assets to be do
GOLANGCI_LINT_VERSION ?= v2.9.0
KUSTOMIZE_VERSION ?= v5.2.1
CONTROLLER_TOOLS_VERSION ?= v0.16.5
OPM_VERSION ?= v1.23.0
OPM_VERSION ?= v1.68.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPM_VERSION is now defined in both Makefile and build/Dockerfile.catalog. These might drift in the future. Two options to tackle this for now:

  • add a Makefile target for this Dockerfile that passes --build-arg OPM_VERSION=$(OPM_VERSION)
  • at minimum, add a comment in each file pointing to the other. Either way, one source of truth is better than two.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catalog file is used by ci in prow and not triggered via makefile, at least no reason too just yet.. but will update any/create targets to have such + comments crosspointing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

  • Cross-pointing comments in both Makefile (line 10) and build/Dockerfile.catalog (line 14)
  • New make catalog-fbc-build target that passes --build-arg OPM_VERSION=$(OPM_VERSION) so the Makefile is the single source of truth when building locally
  • Usage example in both files

Note

Responses generated with Claude

BRANCH_VERSION = oadp-dev
PREVIOUS_CHANNEL ?= oadp-1.5
PREVIOUS_CHANNEL_GO_VERSION ?= 1.23
Expand Down
58 changes: 58 additions & 0 deletions build/Dockerfile.catalog
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# FBC (File-Based Catalog) image for OLM operator installation.
# Renders a bundle image into an FBC catalog servable via gRPC CatalogSource.
#
# Usage:
# podman build -f build/Dockerfile.catalog \
# --build-arg BUNDLE_IMG=<bundle-image-ref> \
# -t <catalog-image-tag> .
#
# ci-operator: set BUNDLE_IMG via build_args in the ci-operator config.
# The bundle image must be pushed to a registry accessible during the build.
#
# Reference: networking-incubator/coraza-kubernetes-operator catalog/Dockerfile

ARG OPM_VERSION=v1.68.0

FROM quay.io/operator-framework/opm:${OPM_VERSION} AS opm

FROM registry.access.redhat.com/ubi9/ubi-minimal AS builder

COPY --from=opm /bin/opm /bin/opm

# Allow opm to pull bundle images from CI registries without signature verification
RUN mkdir -p /etc/containers && \
echo '{"default":[{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json

ARG BUNDLE_IMG
ARG VERSION=99.0.0
ARG DEFAULT_CHANNEL=dev

RUN test -n "${BUNDLE_IMG}" || (echo "BUNDLE_IMG build-arg is required" >&2; exit 1) && \
mkdir -p /configs/oadp-operator && \
/bin/opm render "${BUNDLE_IMG}" -o yaml > /configs/oadp-operator/index.yaml && \
cat >> /configs/oadp-operator/index.yaml <<EOF
---
schema: olm.package
name: oadp-operator
defaultChannel: ${DEFAULT_CHANNEL}
---
schema: olm.channel
name: ${DEFAULT_CHANNEL}
package: oadp-operator
entries:
- name: oadp-operator.v${VERSION}
EOF

RUN /bin/opm validate /configs/

FROM opm

COPY --from=builder /configs /configs

RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]

LABEL operators.operatorframework.io.index.configs.v1=/configs

EXPOSE 50051
ENTRYPOINT ["/bin/opm"]
CMD ["serve", "/configs", "--cache-dir=/tmp/cache"]
Comment thread
coderabbitai[bot] marked this conversation as resolved.