Skip to content

Conversation

@freeznet
Copy link
Member

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

Fixes #322 #321

(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

  • Added SchemaCompatibilityStrategy and SchemaValidationEnforced fields to PulsarNamespaceSpec for better schema evolution control.
  • Updated CRD and documentation to reflect new schema management options.
  • Modified reconciliation logic to handle schema validation enforcement.
  • Adjusted deep copy methods to accommodate new fields.

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)

- Added SchemaCompatibilityStrategy and SchemaValidationEnforced fields to PulsarNamespaceSpec for better schema evolution control.
- Updated CRD and documentation to reflect new schema management options.
- Modified reconciliation logic to handle schema validation enforcement.
- Adjusted deep copy methods to accommodate new fields.
@freeznet freeznet self-assigned this Jun 30, 2025
@freeznet freeznet requested review from a team as code owners June 30, 2025 14:24
@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 30, 2025
@freeznet freeznet requested a review from Copilot June 30, 2025 15:43

This comment was marked as outdated.

nlu90
nlu90 previously approved these changes Jul 1, 2025
@freeznet freeznet requested a review from Copilot July 1, 2025 01:53

This comment was marked as outdated.

@freeznet
Copy link
Member Author

freeznet commented Jul 1, 2025

requires apache/pulsar-client-go#1386 to fix the misuse between SchemaCompatibilityStrategy and SchemaAutoUpdateCompatibilityStrategy

@freeznet freeznet requested a review from Copilot July 3, 2025 02:03
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 extends PulsarNamespace with schema management by adding compatibility strategy and validation enforcement options across CRD, API types, reconciliation logic, admin client, and documentation.

  • Introduces schemaCompatibilityStrategy and schemaValidationEnforced fields in the spec, CRD, docs, and deep-copy logic.
  • Updates reconciliation (ReconcileNamespace) and admin client (ApplyNamespace, applyNamespacePolicies) to handle the new fields.
  • Bumps dependencies and refreshes generated code to accommodate new imports and deep-copy adjustments.

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/connection/reconcile_namespace.go Maps new schema fields from the spec into the namespace payload.
pkg/admin/interface.go Adds new fields to NamespaceParams.
pkg/admin/impl.go Applies schema settings when creating/updating namespaces.
api/v1alpha1/pulsarnamespace_types.go Defines new spec fields with validation tags.
api/v1alpha1/zz_generated.deepcopy.go Implements deep-copy for new fields and fixes duration imports.
config/crd/bases/resource...pulsarnamespaces.yaml Adds CRD entries for schema fields.
docs/pulsar_namespace.md Documents usage and examples for schema management.
go.mod Updates various module versions (including Pulsar client).
Comments suppressed due to low confidence (2)

pkg/admin/interface.go:59

  • [nitpick] The alias utils2 for the Pulsar admin utils package is unclear. Use a more descriptive alias (e.g., adminutils) to improve readability and consistency.
	SchemaCompatibilityStrategy *utils2.SchemaCompatibilityStrategy

pkg/admin/impl.go:507

  • New schema enforcement logic should be covered by unit or integration tests to verify both enabled and disabled scenarios. Add tests for SetSchemaValidationEnforced and SetSchemaCompatibilityStrategy paths.
	if params.SchemaValidationEnforced != nil {

params.Bundles = ptr.To(int32(4))
}

err := p.adminClient.Namespaces().CreateNsWithPolices(name, utils.Policies{
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

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

The initial CreateNsWithPolices call no longer includes default schema settings, so new namespaces will always use cluster defaults. Consider passing SchemaCompatibilityStrategy and SchemaValidationEnforced in the create call to align behavior with updates.

Copilot uses AI. Check for mistakes.
@freeznet freeznet merged commit 96d522e into main Jul 3, 2025
5 checks passed
@freeznet freeznet deleted the freeznet/namespace-level-schema-compatibility-strategy branch July 3, 2025 02:15
freeznet added a commit that referenced this pull request Jul 4, 2025
* feat: Enhance PulsarNamespace with schema management capabilities

- Added SchemaCompatibilityStrategy and SchemaValidationEnforced fields to PulsarNamespaceSpec for better schema evolution control.
- Updated CRD and documentation to reflect new schema management options.
- Modified reconciliation logic to handle schema validation enforcement.
- Adjusted deep copy methods to accommodate new fields.

* fix update policy

* Update pkg/admin/impl.go

Co-authored-by: Copilot <[email protected]>

* ping to fix pr

* go mod tidy

* revert

* fix dep

---------

Co-authored-by: Copilot <[email protected]>
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.

Add namespace-level schema compatibility strategy

3 participants