Skip to content

refactor(kafka_topic): migrate KafkaTopic to Reconciler[T]#1100

Merged
ndk merged 4 commits intomainfrom
akarpov/nex-2255/kafkatopic-newreconciler
Jan 30, 2026
Merged

refactor(kafka_topic): migrate KafkaTopic to Reconciler[T]#1100
ndk merged 4 commits intomainfrom
akarpov/nex-2255/kafkatopic-newreconciler

Conversation

@ndk
Copy link
Copy Markdown
Contributor

@ndk ndk commented Jan 28, 2026

About this change—what it does

Resolves: #NEX-2284.

Migrates KafkaTopic to the shared generic Reconciler[T] and adds scenario tests to lock in behavior.

What stays the same:

  • Preconditions: the Kafka service must exist and have enough RUNNING nodes for the requested replication factor.
  • Create/Update payload and mapping (partitions/replication/tags/config).
  • READY semantics: we still mark the resource running once the topic becomes ACTIVE (instance-is-running annotation + Running condition).
  • Delete semantics: respects termination_protection; NotFound on delete is treated as success.
  • Singleflight is still used to dedupe ServiceKafkaTopicList calls per service.

Behavior changes / important notes:

  • Continuous reconciliation: the controller now keeps polling even after the resource becomes READY.
  • Existence drift: if the Kafka topic is deleted on the Aiven side while the Kubernetes KafkaTopic resource still exists, the operator will re-create it.
  • Transient 5xx from ServiceKafkaTopicList are treated as retryable without treating the topic as missing. During spec updates we assume the topic exists if it was applied before to avoid going through Create and hitting AlreadyExists.

Out of scope:

  • Config drift correction (spec vs remote config) is intentionally not implemented here. This PR only adds existence drift detection.

Tests:

  • Adds scenario tests covering preconditions, create/update, topic state transitions, transient 5xx handling, deletion/termination protection, and existence drift re-creation.

@ndk
Copy link
Copy Markdown
Contributor Author

ndk commented Jan 28, 2026

/test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 28, 2026

✅ Acceptance Tests Passed

Workflow: View Details

@ndk ndk marked this pull request as ready for review January 28, 2026 12:02
@ndk ndk requested a review from a team as a code owner January 28, 2026 12:02
@vmyroslav vmyroslav force-pushed the akarpov/nex-2255/kafkatopic-newreconciler branch from 6d78722 to b6b6a70 Compare January 28, 2026 17:03
Comment thread controllers/kafkatopic_controller.go
Comment thread controllers/kafkatopic_controller.go
Comment thread controllers/kafkatopic_controller.go
@vmyroslav
Copy link
Copy Markdown
Contributor

I would add to the change log the detailed explanation of changes which might be breaking for someone. Like the fact that now operator WILL re-create the deleted topics.

@ndk ndk force-pushed the akarpov/nex-2255/kafkatopic-newreconciler branch from b6b6a70 to e202ef6 Compare January 30, 2026 08:25
vmyroslav
vmyroslav previously approved these changes Jan 30, 2026
Comment thread controllers/kafkatopic_controller.go Outdated
Comment thread controllers/kafkatopic_controller.go
@ndk ndk requested a review from vmyroslav January 30, 2026 09:51
@ndk
Copy link
Copy Markdown
Contributor Author

ndk commented Jan 30, 2026

/test

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 30, 2026

✅ Acceptance Tests Passed

Workflow: View Details

@ndk ndk requested a review from vmyroslav January 30, 2026 10:36
@ndk ndk merged commit 6518a1b into main Jan 30, 2026
8 checks passed
@ndk ndk deleted the akarpov/nex-2255/kafkatopic-newreconciler branch January 30, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants