quarkus-operator-sdk: Generated OLM Bundle is not usable out of the box

There are two primary issues with the generated OLM Bundle

OLM standard for configuraing watched namespaces is via olm.targetNamespaces annotation whereas QOSKD uses QUARKUS_OPERATOR_SDK_NAMESPACES for the exact same purpose (in boh cases empty value means “watch all”)

This can be easily remedied by generating the equivalend of the follwing yq command

yq ea -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env += [{"name": "QUARKUS_OPERATOR_SDK_NAMESPACES", "valueFrom": {"fieldRef": {"fieldPath": "metadata.annotations['"'"'olm.targetNamespaces'"'"']"}}}]' "$CSV_PATH"

The @CSVMetadata annotation is too static – in a sense that it doesn’t allow setting values from properties. Modifying the sourcecs to change e.g. spec.replaces of the generated CSV is not really practical.

This could be improved (for example) by one of the following

  1. Introduce new @CsvMetadata.ConfigValue(“prop.name”) annotation which could be used as the following
@CSVMetadata(replaces = @CsvMetadata.ConfigValue("dbz.version.prev"))
DebeziumCsvMetadata

This has of course the downside of replaces no longer being a plain string. So we would have to figure out a more polished approach

  1. Simply make all CSV metadata defaults configurable via properties. So one would siply set a property during buld (or in application.properties) e.g. quarkus.operator-sdk.bundle.metadata.replaces=X.Y.Z

This might be of course a bit more complex for metadata which are not a simple type (e.g. installModes)

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

how do you configure the watch namespaces (scope of the operator) then? Like the generated CSV doesn’t add the QUARKUS_OPERATOR_SDK_NAMESPACES and JOSDK doesn’t support the configuration of watched namespaces via the OLM annotation

You’d current have to do something like:

quarkus.kubernetes.env.fields.“quarkus.operator-sdk.namespaces”=metadata.annotations[‘olm.targetNamespaces’]

Or if you have a deployment fragment, add in something similar.

However that does seem cumbersome - this is something that the sdk could take care of.

Which version of QOSDK are you using?

6.3.0

Doesn’t appear to be the case: https://github.com/debezium/debezium-operator/blob/main/pom.xml#L34

It does appear to be the case https://github.com/debezium/debezium-operator/pull/9/files#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R47

OLM integration is just not merged yet (this PR was linked here multiple times 😉)