Skip to content

Commit 627e885

Browse files
committed
fix namespace and topic docs / CRDs (#325)
* fix ns docs * update topic schema doc
1 parent 22e332e commit 627e885

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

api/v1alpha1/pulsarnamespace_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type PulsarNamespaceSpec struct {
6969
// If not specified, the cluster's default schema compatibility strategy will be used.
7070
// This setting controls how schema evolution is handled for topics within this namespace.
7171
// +optional
72-
// +kubebuilder:validation:Enum=AutoUpdateDisabled;Backward;Forward;Full;AlwaysCompatible;BackwardTransitive;ForwardTransitive;FullTransitive
72+
// +kubebuilder:validation:Enum=UNDEFINED;ALWAYS_INCOMPATIBLE;ALWAYS_COMPATIBLE;BACKWARD;FORWARD;FULL;BACKWARD_TRANSITIVE;FORWARD_TRANSITIVE;FULL_TRANSITIVE
7373
SchemaCompatibilityStrategy *adminutils.SchemaCompatibilityStrategy `json:"schemaCompatibilityStrategy,omitempty"`
7474

7575
// SchemaValidationEnforced controls whether schema validation is enforced for this namespace.

config/crd/bases/resource.streamnative.io_pulsarnamespaces.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,15 @@ spec:
244244
If not specified, the cluster's default schema compatibility strategy will be used.
245245
This setting controls how schema evolution is handled for topics within this namespace.
246246
enum:
247-
- AutoUpdateDisabled
248-
- Backward
249-
- Forward
250-
- Full
251-
- AlwaysCompatible
252-
- BackwardTransitive
253-
- ForwardTransitive
254-
- FullTransitive
247+
- UNDEFINED
248+
- ALWAYS_INCOMPATIBLE
249+
- ALWAYS_COMPATIBLE
250+
- BACKWARD
251+
- FORWARD
252+
- FULL
253+
- BACKWARD_TRANSITIVE
254+
- FORWARD_TRANSITIVE
255+
- FULL_TRANSITIVE
255256
type: string
256257
schemaValidationEnforced:
257258
description: |-

docs/pulsar_namespace.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `PulsarNamespace` resource defines a namespace in a Pulsar cluster. It allow
2929
| `deduplication` | Whether to enable message deduplication for the namespace. | No |
3030
| `bookieAffinityGroup` | Set the bookie-affinity group for the namespace, which has two sub fields: `bookkeeperAffinityGroupPrimary(String)` is required, and `bookkeeperAffinityGroupSecondary(String)` is optional. | No |
3131
| `topicAutoCreationConfig` | Configures automatic topic creation behavior within this namespace. Contains settings for whether auto-creation is allowed, the type of topics created, and default number of partitions. | No |
32-
| `schemaCompatibilityStrategy` | Schema compatibility strategy for this namespace. Controls how schema evolution is handled for topics within this namespace. Options: `AutoUpdateDisabled`, `Backward`, `Forward`, `Full`, `AlwaysCompatible`, `BackwardTransitive`, `ForwardTransitive`, `FullTransitive`. | No |
32+
| `schemaCompatibilityStrategy` | Schema compatibility strategy for this namespace. Controls how schema evolution is handled for topics within this namespace. Options: `UNDEFINED`, `ALWAYS_INCOMPATIBLE`, `ALWAYS_COMPATIBLE`, `BACKWARD`, `FORWARD`, `FULL`, `BACKWARD_TRANSITIVE`, `FORWARD_TRANSITIVE`, `FULL_TRANSITIVE`. | No |
3333
| `schemaValidationEnforced` | Controls whether schema validation is enforced for this namespace. When enabled, producers must provide a schema when publishing messages. If not specified, the cluster's default schema validation enforcement setting will be used. | No |
3434

3535
Note: Valid time units are "s" (seconds), "m" (minutes), "h" (hours), "d" (days), "w" (weeks).
@@ -82,37 +82,39 @@ The `schemaCompatibilityStrategy` field controls how Pulsar handles schema evolu
8282

8383
#### Available Strategies
8484

85-
1. **AutoUpdateDisabled**: Disables automatic schema updates and requires manual schema management. This is the most restrictive strategy, suitable for ultra-stable environments where strict schema control is required and no automatic schema evolution is desired.
85+
1. **UNDEFINED**: Uses the cluster's default schema compatibility strategy. When this value is set, the namespace inherits the schema compatibility settings from the Pulsar cluster configuration. This is useful when you want to maintain consistency with cluster-wide policies.
8686

87-
2. **AlwaysCompatible**: Allows any schema changes without validation. This is the most permissive strategy but may lead to compatibility issues. Suitable for development/testing environments.
87+
2. **ALWAYS_INCOMPATIBLE**: Disallows any schema changes. This is the most restrictive strategy, suitable for ultra-stable environments where no schema evolution is desired and strict schema immutability is required.
8888

89-
3. **Backward**: New schema can read data written with the previous schema. This strategy supports consumer-driven schema evolution, such as adding optional fields or removing fields.
89+
3. **ALWAYS_COMPATIBLE**: Allows any schema changes without validation. This is the most permissive strategy but may lead to compatibility issues. Suitable for development/testing environments where rapid iteration is needed.
9090

91-
4. **BackwardTransitive**: New schema can read data written with any previous schema in the chain. This provides long-term backward compatibility across multiple schema versions.
91+
4. **BACKWARD**: New schema can read data written with the previous schema. This strategy supports consumer-driven schema evolution, such as adding optional fields or removing fields. Consumers with new schemas can process data from producers with older schemas.
9292

93-
5. **Forward**: Previous schema can read data written with the new schema. This strategy supports producer-driven schema evolution, such as adding fields that older consumers can ignore.
93+
5. **FORWARD**: Previous schema can read data written with the new schema. This strategy supports producer-driven schema evolution, such as adding fields that older consumers can ignore. Consumers with older schemas can still process data from producers with newer schemas.
9494

95-
6. **ForwardTransitive**: Any previous schema can read data written with the new schema. This ensures new data is readable by any older schema version.
95+
6. **FULL**: Schema changes are both forward and backward compatible. Both new and previous schemas can read data written by either schema. This provides strict compatibility requirements in both directions and is suitable for environments requiring maximum interoperability.
9696

97-
7. **Full**: Schema changes are both forward and backward compatible. Both new and previous schemas can read data written by either schema. This provides strict compatibility requirements in both directions.
97+
7. **BACKWARD_TRANSITIVE**: New schema can read data written with any previous schema in the chain. This provides long-term backward compatibility across multiple schema versions, ensuring consumers can always read historical data regardless of schema evolution.
9898

99-
8. **FullTransitive**: Schema changes are forward and backward compatible with all schemas. Any schema in the chain can read data written by any other schema in the chain. This provides maximum compatibility guarantees.
99+
8. **FORWARD_TRANSITIVE**: Any previous schema can read data written with the new schema. This ensures new data is readable by any older schema version, providing comprehensive forward compatibility across the entire schema evolution chain.
100+
101+
9. **FULL_TRANSITIVE**: Schema changes are forward and backward compatible with all schemas. Any schema in the chain can read data written by any other schema in the chain. This provides maximum compatibility guarantees across all schema versions.
100102

101103
#### Usage Examples
102104

103105
**Development Environment**:
104106
```yaml
105-
schemaCompatibilityStrategy: AlwaysCompatible
107+
schemaCompatibilityStrategy: ALWAYS_COMPATIBLE
106108
```
107109

108110
**Production Environment**:
109111
```yaml
110-
schemaCompatibilityStrategy: Backward
112+
schemaCompatibilityStrategy: BACKWARD
111113
```
112114

113115
**Critical Systems**:
114116
```yaml
115-
schemaCompatibilityStrategy: FullTransitive
117+
schemaCompatibilityStrategy: FULL_TRANSITIVE
116118
```
117119

118120
### Schema Validation Enforcement
@@ -129,28 +131,28 @@ The `schemaValidationEnforced` field controls whether producers must provide a s
129131

130132
#### Development/Testing Environment
131133
```yaml
132-
schemaCompatibilityStrategy: AlwaysCompatible
134+
schemaCompatibilityStrategy: ALWAYS_COMPATIBLE
133135
schemaValidationEnforced: false
134136
```
135137
This configuration allows rapid schema iteration and flexible schema validation for experimentation.
136138

137139
#### Standard Production Environment
138140
```yaml
139-
schemaCompatibilityStrategy: Backward
141+
schemaCompatibilityStrategy: BACKWARD
140142
schemaValidationEnforced: true
141143
```
142144
This provides a good balance between flexibility and safety, ensuring consumers can handle schema changes while enforcing schema validation for data consistency.
143145

144146
#### Mission-Critical Systems
145147
```yaml
146-
schemaCompatibilityStrategy: FullTransitive
148+
schemaCompatibilityStrategy: FULL_TRANSITIVE
147149
schemaValidationEnforced: true
148150
```
149151
This configuration provides maximum compatibility guarantees with strict schema validation enforcement.
150152

151153
#### Legacy System Integration
152154
```yaml
153-
schemaCompatibilityStrategy: ForwardTransitive
155+
schemaCompatibilityStrategy: FORWARD_TRANSITIVE
154156
schemaValidationEnforced: false
155157
```
156158
This ensures older systems can consume new data while allowing gradual migration without strict schema requirements.
@@ -191,7 +193,7 @@ spec:
191193
bundles: 16
192194
messageTTL: 1h
193195
# Schema management configuration
194-
# schemaCompatibilityStrategy: Backward
196+
# schemaCompatibilityStrategy: BACKWARD
195197
# schemaValidationEnforced: true
196198
# backlogQuotaRetentionPolicy: producer_request_hold
197199
# maxProducersPerTopic: 2

docs/pulsar_topic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ The `schemaInfo` field has the following structure:
151151
| Field | Description | Required |
152152
|-------|-------------|----------|
153153
| `type` | The schema type, which determines how to interpret the schema data. | Yes |
154-
| `schema` | The schema definition, which is a base64 encoded string representing the schema. | Yes |
154+
| `schema` | The schema definition. For AVRO and JSON schemas, this should be a JSON string of the schema definition. For PROTOBUF_NATIVE schemas, this should be the JSON string of protobuf definition string from [ProtobufNativeSchemaData](https://github.com/apache/pulsar/blob/master/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/schema/ProtobufNativeSchemaData.java). | Yes |
155155
| `properties` | A map of user-defined properties as key-value pairs. Applications can use this for carrying any application-specific logic. | No |
156156

157157
### Supported Schema Types

0 commit comments

Comments
 (0)