Skip to content

Deleting a tenant with a Kafka app hangs the namespace in Terminating (KafkaTopic strimzi.io/topic-operator finalizer) #3793

Description

@IvanHunters

Summary

Deleting a tenant that has a Kafka app leaves the tenant namespace stuck in Terminating indefinitely. The KafkaTopic CR keeps the finalizer strimzi.io/topic-operator, but the Strimzi topic-operator is torn down together with the Kafka app, so nothing ever removes the finalizer and the namespace never finalizes.

Environment

  • Cozystack v1.6.1-rc.1
  • A Kafka app (Strimzi-based) with at least one topic

Steps to reproduce

  1. Create a tenant.
  2. Deploy a Kafka app with a topic (e.g. topic orders).
  3. Delete the tenant (this deletes the Kafka app and the namespace).

Actual result

The tenant namespace hangs in Terminating:

NamespaceContentRemaining:    Some resources are remaining: kafkatopics.kafka.strimzi.io has 1 resource instances
NamespaceFinalizersRemaining: Some content in the namespace has finalizers remaining: strimzi.io/topic-operator in 1 resource instances

The KafkaTopic (e.g. kafka-kafka-orders) still carries finalizers: [strimzi.io/topic-operator]. The Strimzi topic-operator has already been deleted together with the Kafka app, so no controller is left to drain that finalizer. The namespace stays in Terminating forever.

Reproduced on every tenant that had a Kafka app (multiple tenants stuck the same way).

Expected result

Deleting the tenant / Kafka app should clean up KafkaTopic resources (or drain their finalizers) so the namespace terminates cleanly, without manual finalizer surgery.

Workaround

Remove the finalizer manually, then the namespace finalizes within seconds:

kubectl -n tenant-<name> patch kafkatopic <topic-name> \
  --type=merge -p '{"metadata":{"finalizers":null}}'

Suggested fix

Order the teardown so the Strimzi topic-operator outlives its KafkaTopic resources (drain the strimzi.io/topic-operator finalizer before the operator itself is removed), or have the Kafka app / tenant deletion explicitly delete KafkaTopic CRs and wait for their finalizers to clear before removing the operator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/needs-triageIndicates an issue needs triage by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions