Skip to content

Commit cb10b97

Browse files
committed
OpenShift only: modifications for fbc
Signed-off-by: Ori Braunshtein <[email protected]>
1 parent 09ec3e5 commit cb10b97

23 files changed

+820
-1
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "website/themes/hugo-book"]
55
path = website/themes/hugo-book
66
url = https://github.com/alex-shpak/hugo-book
7+
[submodule "telco5g-konflux"]
8+
path = telco5g-konflux
9+
url = https://github.com/openshift-kni/telco5g-konflux

.konflux/Dockerfile.catalog

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# The base image is expected to contain /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
2+
#
3+
# CAVEAT
4+
#
5+
# For <= 4.14, use registry.redhat.io/openshift4/ose-operator-registry:v4.y
6+
# For >= 4.15, use registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4.y
7+
#
8+
# TODO: once available, migrate to: registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4.y
9+
ARG OPM_IMAGE=brew.registry.redhat.io/rh-osbs/openshift-ose-operator-registry-rhel9:v4.20
10+
11+
# build the catalog
12+
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.24@sha256:b91431604c435f3cabec20ddb653c0537c8ba8097ada57960d54a1266f95a7c3 AS builder
13+
14+
# create dir structure to generate the catalog
15+
RUN mkdir -p /app/hack /app/.konflux/catalog
16+
17+
COPY .konflux/hack/ /app/hack/
18+
COPY .konflux/catalog/ /app/.konflux/catalog/
19+
COPY telco5g-konflux /app/telco5g-konflux
20+
COPY konflux.Makefile /app/Makefile
21+
22+
23+
# generate the catalog
24+
25+
# debug
26+
RUN echo "root dir" && ls -lra $HOME
27+
28+
WORKDIR /app
29+
RUN --mount=type=secret,id=telco-5g-redhat-pull-secret/.dockerconfigjson \
30+
mkdir -p $HOME/.docker/ && \
31+
cp /run/secrets/telco-5g-redhat-pull-secret/.dockerconfigjson $HOME/.docker/config.json
32+
33+
# debug
34+
RUN echo "run secrets" && ls -lra /run/secrets/ && echo "docker dir" && ls -lra $HOME/.docker/ && cat $HOME/.docker/config.json
35+
36+
ENV REGISTRY_AUTH_FILE=$HOME/.docker/config.json
37+
# The fbc build is not hermetic, so make will download yq and opm
38+
RUN make konflux-generate-catalog-production && \
39+
rm -f $HOME/.docker/config.json
40+
41+
# run the catalog
42+
FROM ${OPM_IMAGE}
43+
44+
ENTRYPOINT ["/bin/opm"]
45+
CMD ["serve", "/configs", "--cache-dir=/tmp/cache"]
46+
47+
# ensure this correponds to olm.package name
48+
ENV PACKAGE_NAME=openperouter-operator
49+
50+
COPY --from=builder /app/.konflux/catalog/$PACKAGE_NAME/ /configs/$PACKAGE_NAME
51+
# RUN ["/bin/opm", "validate", "/configs/openperouter-operator"]
52+
RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]
53+
54+
LABEL operators.operatorframework.io.index.configs.v1=/configs

.konflux/catalog/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
openperouter-operator/catalog.yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
quay: quay.io/redhat-user-workloads/telco-5g-tenant/openperouter-operator-bundle-4-20@sha256:6bd0360775343a5ae8238c5d53bbfac1838e0c57e6f30c9c5df51633e720cbaf
3+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
entries:
3+
- defaultChannel: alpha
4+
name: openperouter-operator
5+
schema: olm.package
6+
# Add 'replaces' after we ship 4.20.0
7+
- entries:
8+
- name: openperouter-operator.v4.20.0
9+
skipRange: '>=4.9.0 <4.20.0'
10+
name: alpha
11+
package: openperouter-operator
12+
schema: olm.channel
13+
- entries:
14+
- name: openperouter-operator.v4.20.0
15+
skipRange: '>=4.9.0 <4.20.0'
16+
name: "4.20"
17+
package: openperouter-operator
18+
schema: olm.channel
19+
- image: quay.io/redhat-user-workloads/telco-5g-tenant/openperouter-operator-bundle-4-20@sha256:bf6a076d5b7dea000a817eb9dc3155131ab1655657855719f6ca62d1e5794911
20+
schema: olm.bundle
21+
schema: olm.template.basic
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# We use this IDMS to check if the images in the FBC are resolvable using the staging or production catalog.
2+
# https://github.com/konflux-ci/community-catalog/tree/development/pipelines/validate-fbc-images-resolvable
3+
apiVersion: operator.openshift.io/v1
4+
kind: ImageDigestMirrorSet
5+
metadata:
6+
name: fbc-images-resolvable-integration-test-idms
7+
spec:
8+
imageDigestMirrors:
9+
- mirrors:
10+
- registry.stage.redhat.io/openshift4-dev-preview-beta/openperouter-rhel9-operator
11+
source: registry.redhat.io/openshift4-dev-preview-beta/openperouter-rhel9-operator
12+
- mirrors:
13+
- registry.stage.redhat.io/openshift4-dev-preview-beta/openperouter-operator-bundle
14+
source: registry.redhat.io/openshift4-dev-preview-beta/openperouter-operator-bundle

.konflux/catalog/openperouter-operator/.gitkeep

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Following example of: https://github.com/openshift/enhancements/blob/master/hack/Dockerfile.markdownlint
2+
FROM registry.access.redhat.com/ubi9/ubi:latest
3+
WORKDIR /workdir
4+
RUN dnf install -y git golang
5+
COPY install-markdownlint.sh /tmp
6+
RUN /tmp/install-markdownlint.sh
7+
ENTRYPOINT /workdir/hack/markdownlint.sh

.konflux/hack/boilerplate.go.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
SPDX-FileCopyrightText: Red Hat
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/

.konflux/hack/catalog-undeploy.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
#
3+
# SPDX-FileCopyrightText: Red Hat
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
function usage {
9+
cat <<EOF >&2
10+
Paramaters:
11+
--namespace <namespace>
12+
--package <package name>
13+
--crd-search <crd search grep pattern>
14+
EOF
15+
exit 1
16+
}
17+
18+
function cleanSubscription {
19+
oc delete subscriptions.operators.coreos.com -n "${NAMESPACE}" "${PACKAGE}"
20+
oc get csv -n "${NAMESPACE}" | grep "${PACKAGE}" | awk '{print $1}' \
21+
| xargs --no-run-if-empty oc delete csv -n "${NAMESPACE}"
22+
oc get crd | grep "${CRD_SEARCH}" | awk '{print $1}' \
23+
| xargs --no-run-if-empty oc delete crd
24+
oc delete ns "${NAMESPACE}"
25+
oc get clusterrole.rbac.authorization.k8s.io | grep "${PACKAGE}" | awk '{print $1}' \
26+
| xargs --no-run-if-empty oc delete clusterrole.rbac.authorization.k8s.io
27+
oc get clusterrolebinding.rbac.authorization.k8s.io | grep "${PACKAGE}" | awk '{print $1}' \
28+
| xargs --no-run-if-empty oc delete clusterrolebinding.rbac.authorization.k8s.io
29+
30+
oc delete catalogsources.operators.coreos.com -n openshift-marketplace "${PACKAGE}"
31+
}
32+
33+
#
34+
# Command-line processing
35+
#
36+
declare PACKAGE=
37+
declare NAMESPACE=
38+
declare CRD_SEARCH=
39+
40+
longopts=(
41+
"help"
42+
"namespace:"
43+
"package:"
44+
"crd-search:"
45+
)
46+
47+
longopts_str=$(IFS=,; echo "${longopts[*]}")
48+
49+
if ! OPTS=$(getopt -o "ho:" --long "${longopts_str}" --name "$0" -- "$@"); then
50+
usage
51+
fi
52+
53+
eval set -- "${OPTS}"
54+
55+
while :; do
56+
case "$1" in
57+
--namespace)
58+
NAMESPACE="$2"
59+
shift 2
60+
;;
61+
--package)
62+
PACKAGE="$2"
63+
shift 2
64+
;;
65+
--crd-search)
66+
CRD_SEARCH="$2"
67+
shift 2
68+
;;
69+
--)
70+
shift
71+
break
72+
;;
73+
*)
74+
usage
75+
;;
76+
esac
77+
done
78+
79+
if [ -z "${NAMESPACE}" ] || [ -z "${PACKAGE}" ] || [ -z "${CRD_SEARCH}" ]; then
80+
usage
81+
fi
82+
83+
cleanSubscription

0 commit comments

Comments
 (0)