strimzi / kafka-access-operator

Operator for sharing access to Strimzi clusters across namespaces
Apache License 2.0
17 stars 15 forks source link

InformerEventSource should have both SecondaryToPrimary and PrimaryToSecondary mappers #18

Closed katheris closed 1 year ago

katheris commented 1 year ago

According to the Java operator SDK docs, if the mapping between a primary and secondary resource is not 1-1 then when the event source is created it needs to have both a SecondaryToPrimary and PrimaryToSecondary mapper.

Since more than one different KafkaAccess CR could reference the same Kafka CR, for all of the resources that are related to the Kafka CR (e.g. the Kafka CR, KafkaUser CR, Secrets etc), when we define the event sources we need both types of mapper. Currently for most we only provider a SecondaryToPrimary mapper.

We should add PrimaryToSecondary mappers for the kafkaEventSource and strimziSecretEventSource.

References:

katheris commented 1 year ago

Update: This is only required if the function context.getSecondaryResource is called, otherwise it is not required. This means with the current operator this is only required for the Kafka Access secret event source. However if we upgrade to the latest JOSDK version the secret can be handled as a dependent resource and we will likely not need it at all.

katheris commented 1 year ago

As part of #30 we added a PrimaryToSecondary mapper for Kafka. Since for all other resources we are using the event source directly I do not think we need to create any other PrimaryToSecondary mappers at the moment.

Closing this issue and we can open a new one if this changes.