Skip to content

Conversation

@freeznet
Copy link
Member

@freeznet freeznet commented Jul 9, 2025

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #56

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

Describe the modifications you've done.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@freeznet freeznet self-assigned this Jul 9, 2025
@freeznet freeznet requested review from a team as code owners July 9, 2025 10:20
@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2025

@freeznet:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added the doc-info-missing This pr needs to mark a document option in description label Jul 9, 2025
freeznet added 6 commits July 9, 2025 20:23
…ings

- Added logging for creation and policy errors during topic application in `reconcile_topic.go`.
- Increased timeout settings in tests for resource updates to ensure stability and reliability.
@freeznet freeznet requested a review from Copilot July 10, 2025 14:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for the compactionThreshold field on PulsarTopic, enabling automatic topic compaction based on size.

  • Added CompactionThreshold to the API types, CRD schema, deep-copy logic, and sample.
  • Integrated CompactionThreshold in admin interface, reconciliation logic, and live tests.
  • Enabled topic-level policies in the CI cluster configuration.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/utils/spec.go Added MakePulsarTopicWithCompactionThreshold test helper
tests/operator/resources_test.go New tests for create/update/remove of compaction threshold
pkg/connection/reconcile_topic.go Include CompactionThreshold in TopicParams and log action
pkg/admin/interface.go Exposed CompactionThreshold in TopicParams interface
pkg/admin/impl.go Implemented SetCompactionThreshold policy call
config/samples/resource_v1alpha1_pulsartopic.yaml Documented compactionThreshold in sample YAML
config/crd/bases/resource.streamnative.io_pulsartopics.yaml Added CRD schema entry for compactionThreshold
api/v1alpha1/zz_generated.deepcopy.go Generated deep-copy logic for CompactionThreshold
api/v1alpha1/pulsartopic_types.go Defined optional CompactionThreshold field in spec
.ci/clusters/values.yaml Enabled topicLevelPoliciesEnabled in broker config
Comments suppressed due to low confidence (3)

tests/operator/resources_test.go:375

  • The import alias v1alphav1 here is inconsistent with the rest of the code (which uses v1alpha1). Consider renaming to v1alpha1 for clarity and consistency.
				compactionTopic     *v1alphav1.PulsarTopic

tests/operator/resources_test.go:412

  • After updating the compaction threshold, add an assertion to verify topic.Spec.CompactionThreshold equals newThreshold to ensure the field was persisted correctly.
				topic.Spec.CompactionThreshold = &newThreshold

tests/operator/resources_test.go:431

  • Add a test assertion after setting CompactionThreshold to nil to confirm that the field has been removed from the spec.
				topic.Spec.CompactionThreshold = nil

@freeznet freeznet merged commit 7cdb7c0 into main Jul 15, 2025
5 checks passed
@freeznet freeznet deleted the freeznet/topic-policy-compaction branch July 15, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-info-missing This pr needs to mark a document option in description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat](topic): Compaction support on topic resource

3 participants