From 59e807ab392e180c310311183ea49c60e0edf9bb Mon Sep 17 00:00:00 2001 From: Calum Murray Date: Mon, 28 Aug 2023 10:31:01 -0400 Subject: [PATCH] Fix channel finalizer logic (#3295) Signed-off-by: Calum Murray --- control-plane/pkg/reconciler/channel/channel.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/control-plane/pkg/reconciler/channel/channel.go b/control-plane/pkg/reconciler/channel/channel.go index 27808ad73e..19207f187e 100644 --- a/control-plane/pkg/reconciler/channel/channel.go +++ b/control-plane/pkg/reconciler/channel/channel.go @@ -64,6 +64,9 @@ const ( // TopicPrefix is the Kafka Channel topic prefix - (topic name: knative-messaging-kafka..). DefaultDeliveryOrder = contract.DeliveryOrder_ORDERED NewChannelIngressServiceName = "kafka-channel-ingress" + // TopicPrefix is the old Kafka Channel topic prefix - we keep this constant so that deleting channels shortly after upgrading + // does not have issues. See https://github.com/knative-extensions/eventing-kafka-broker/issues/3289 for more info + TopicPrefix = "knative-messaging-kafka" ) type Reconciler struct { @@ -449,7 +452,7 @@ func (r *Reconciler) finalizeKind(ctx context.Context, channel *messagingv1beta1 topicName, ok := channel.Status.Annotations[kafka.TopicAnnotation] if !ok { - return fmt.Errorf("no topic annotated on channel") + topicName = kafka.ChannelTopic(TopicPrefix, channel) } topic, err := kafka.DeleteTopic(kafkaClusterAdminClient, topicName) if err != nil {