Skip to content

Conversation

@freeznet
Copy link
Member

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

Fixes #310

(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 Jun 27, 2025
@freeznet freeznet requested review from a team as code owners June 27, 2025 06:25
@github-actions
Copy link
Contributor

@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 Jun 27, 2025
@freeznet freeznet requested a review from Copilot June 27, 2025 08:10
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 implements a stateful reconciliation framework for managing Pulsar resource state, with new tests added to validate permission state annotations and multi-permission handling.

  • Introduces a BaseStatefulReconciler and its interfaces for generic state tracking
  • Enhances PulsarPermission reconciliation with context change detection and state annotation updates
  • Adds comprehensive test cases to verify correct permission operations and state transitions

Reviewed Changes

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

File Description
tests/operator/resources_test.go Added test cases for initial state, role modifications, and multi-permission scenarios
pkg/reconciler/stateful_reconciler.go Introduced a generic framework for stateful resource reconciliation using annotations
pkg/connection/reconcile_permission.go Updated PulsarPermission reconciliation with context change detection and improved state tracking
Comments suppressed due to low confidence (1)

pkg/connection/reconcile_permission.go:181

  • The variable 'currentPermissions' is used to determine slice capacity and in the iteration below but is not defined in this scope. Consider replacing it with the appropriate source of current roles (for example, using permission.Spec.Roles) to ensure the intended logic is applied.
	currentRoles := make([]string, 0, len(currentPermissions))

Copy link
Member

@maxsxu maxsxu left a comment

Choose a reason for hiding this comment

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

👍 Creative work! two questions here:

  1. what if the annotations been modified externally or lost?
  2. we need take care that annotation has max value size limitation

@freeznet freeznet merged commit 21f350e into main Jun 30, 2025
5 checks passed
@freeznet freeznet deleted the freeznet/use-annotation-stage-permissions branch June 30, 2025 03:50
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.

#295 broke handling multiple PulsarPermissions for PulsarTopic/PulsarNamespace

3 participants