From bf792d732bbae6ea6ebee0099525c47c818ac806 Mon Sep 17 00:00:00 2001 From: gbenhaim Date: Wed, 25 Sep 2024 23:12:16 +0300 Subject: [PATCH] Add configs for building a bundle with Konflux 1. Add a script that Konflux will update with the latest references to the operands. This script is also used during the build for producing the variables that will be used when generating the manifests from templates. 2. Add a Containerfile for building the bundle. Signed-off-by: gbenhaim --- build/forklift-operator-bundle/Containerfile | 63 ++++++++++++++++++++ operator/export-vars.sh | 38 ++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 build/forklift-operator-bundle/Containerfile create mode 100644 operator/export-vars.sh diff --git a/build/forklift-operator-bundle/Containerfile b/build/forklift-operator-bundle/Containerfile new file mode 100644 index 000000000..fe96057ea --- /dev/null +++ b/build/forklift-operator-bundle/Containerfile @@ -0,0 +1,63 @@ +FROM quay.io/konflux-ci/operator-sdk-builder@sha256:08f084228288d6314573d7742671fc7ddf84c19e4cf8eeb7623f261a514d0e4e as builder + +COPY ./. /repo +WORKDIR /repo/operator +RUN source ./export-vars.sh && \ + kustomize build config/manifests/ \ + | envsubst \ + | operator-sdk generate bundle \ + -q \ + --overwrite \ + --extra-service-accounts forklift-controller,forklift-api,forklift-populator-controller \ + --version 2.7.0 \ + --channels development \ + --default-channel development \ + --output-dir build + +FROM scratch + +COPY --from=builder /repo/operator/build/manifests /manifests/ +COPY --from=builder /repo/operator/build/metadata /metadata/ + +# These are three labels needed to control how the pipeline should handle this container image +# This first label tells the pipeline that this is a bundle image and should be +# delivered via an index image +LABEL com.redhat.delivery.operator.bundle=true + +# This second label tells the pipeline which versions of OpenShift the operator supports. +# This is used to control which index images should include this operator. +# TODO: move to 4.7 once available! +LABEL com.redhat.openshift.versions="v4.14-v4.16" + +# This third label tells the pipeline that this operator should *also* be supported on OCP 4.4 and +# earlier. It is used to control whether or not the pipeline should attempt to automatically +# backport this content into the old appregistry format and upload it to the quay.io application +# registry endpoints. +LABEL com.redhat.delivery.backport=false + +# The rest of these labels are copies of the same content in annotations.yaml and are needed by OLM +LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 +LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ +LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ +LABEL operators.operatorframework.io.bundle.package.v1=mtv-operator +LABEL operators.operatorframework.io.bundle.channels.v1=release-v2.7 +LABEL operators.operatorframework.io.bundle.channel.default.v1=release-v2.7 + +# Not sure whate these label expand to +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0+git +LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 +LABEL operators.operatorframework.io.metrics.project_layout=ansible.sdk.operatorframework.io/v1 +LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ +LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 + +# Main labels +LABEL \ + com.redhat.component="mtv-operator-bundle-container" \ + version="2.7.0" \ + name="migration-toolkit-virtualization/mtv-operator-bundle" \ + License="Apache License 2.0" \ + io.k8s.display-name="Migration Toolkit for Virtualization" \ + io.openshift.tags="migration" \ + io.k8s.description="Migration Toolkit for Virtualization - Operator Bundle" \ + summary="Migration Toolkit for Virtualization - Operator Bundle" \ + maintainer="Forklift by Konveyor Community " diff --git a/operator/export-vars.sh b/operator/export-vars.sh new file mode 100644 index 000000000..4d801a615 --- /dev/null +++ b/operator/export-vars.sh @@ -0,0 +1,38 @@ +#!/bin/bash -e + +declare -A images + +# The image refrences below will get updated by Konflux everytime there is a new image. + +images[API_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/forklift-api@sha256:d21e617db2382601d707e2856c328aa3862db0469a7fe8ad70a250e22736f7d4 + +images[CONTROLLER_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/forklift-controller@sha256:d156496b7dc81ab4b81c1808390f17cda7400ead44e22af6c7d682fd2d2da07b + +images[MUST_GATHER_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/forklift-must-gather@sha256:3ff09dbc5ca4c0dd196eab5da46a98da7deaa4e71de010cd52684ca2eaaa0d7a + +images[OPENSTACK_POPULATOR_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/openstack-populator@sha256:f7bbdd2504f4e8441a9be58ee780b6c6ca3b4285ba4020b8958575dc5ecf9026 + +images[OPERATOR_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/forklift-operator@sha256:e34c608d6439b9ac5f9f297e4eaf35c69a5b8b74e3622385415d33479071f420 + +images[OVA_PROVIDER_SERVER_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/ova-provider-server@sha256:f8358ba912fbb4928f9021f0dd01d290df87facd1f4eed5da912e10aff5378ae + +images[OVIRT_POPULATOR_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/ovirt-populator@sha256:53d572527b5b9a3e5e55d19c0f7b9022a08242b80fdf4e2d3b964f75a48117e8 + +images[POPULATOR_CONTROLLER_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/populator-controller@sha256:c127768d14d9c56d487e2356a315f634278a412a9a50ab9c3eda447d5e3d0f2d + +images[UI_PLUGIN_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/forklift-console-plugin@sha256:fdc62b3269de1acb669419e7581cc22e4ef6e0f55a512d48c0e4dd7295d369ab + +images[VALIDATION_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/validation@sha256:4d04b097253a0e478d5938e2496a3ead842350f74e3972af0f953083bf7fe906 + +images[VIRT_V2V_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/virt-v2v@sha256:17628ab1f836549509ad80c321f669441d3f15348a5ef151b69fbbcec03ccd30 + +# Chage the repository of the images to match the repository they would be pushed +# to during a release. + +for k in "${!images[@]}"; do + image="${images[$k]}" + new_image="${image/redhat-user-workloads\/rh-mtv-1-tenant/kubev2v}" + export "$k=$new_image" +done + +export VERSION="v2.7.0"