Skip to content

Commit 2980b26

Browse files
freeznetCopilot
andauthored
fix: align namespace and topic policies operation (#363)
* fix: align namespace and topic policies operation * add tests * fix ci * fix ci * fix doc * fix ci * fix ci * fix ci * Revert "fix ci" This reverts commit b05b5a6. * Revert "fix ci" This reverts commit 61d1d5f. * fix ci * fix ci * Update pkg/admin/impl.go Co-authored-by: Copilot <[email protected]> * revert copilot suggestion --------- Co-authored-by: Copilot <[email protected]>
1 parent b73fd3b commit 2980b26

16 files changed

+390
-69
lines changed

api/v1alpha1/pulsarnamespace_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ type PulsarNamespaceSpec struct {
209209

210210
// BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
211211
// Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
212+
// +kubebuilder:validation:Enum=producer_request_hold;producer_exception;consumer_backlog_eviction
212213
// +optional
213214
BacklogQuotaRetentionPolicy *string `json:"backlogQuotaRetentionPolicy,omitempty"`
214215

api/v1alpha1/pulsartopic_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,16 @@ type PulsarTopicSpec struct {
111111

112112
// BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
113113
// Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
114+
// +kubebuilder:validation:Enum=producer_request_hold;producer_exception;consumer_backlog_eviction
114115
// +optional
115116
BacklogQuotaRetentionPolicy *string `json:"backlogQuotaRetentionPolicy,omitempty"`
116117

118+
// BacklogQuotaType controls how the backlog quota is enforced.
119+
// "destination_storage" limits backlog by size (in bytes), while "message_age" limits by time.
120+
// +kubebuilder:validation:Enum=destination_storage;message_age
121+
// +optional
122+
BacklogQuotaType *string `json:"backlogQuotaType,omitempty"`
123+
117124
// SchemaInfo defines the schema for the topic, if any.
118125
// +optional
119126
SchemaInfo *SchemaInfo `json:"schemaInfo,omitempty"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsarnamespaces.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ spec:
9999
description: |-
100100
BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
101101
Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
102+
enum:
103+
- producer_request_hold
104+
- producer_exception
105+
- consumer_backlog_eviction
102106
type: string
103107
backlogQuotaType:
104108
description: |-

charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsartopics.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ spec:
105105
description: |-
106106
BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
107107
Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
108+
enum:
109+
- producer_request_hold
110+
- producer_exception
111+
- consumer_backlog_eviction
112+
type: string
113+
backlogQuotaType:
114+
description: |-
115+
BacklogQuotaType controls how the backlog quota is enforced.
116+
"destination_storage" limits backlog by size (in bytes), while "message_age" limits by time.
117+
enum:
118+
- destination_storage
119+
- message_age
108120
type: string
109121
compactionThreshold:
110122
description: |-

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ spec:
9999
description: |-
100100
BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
101101
Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
102+
enum:
103+
- producer_request_hold
104+
- producer_exception
105+
- consumer_backlog_eviction
102106
type: string
103107
backlogQuotaType:
104108
description: |-

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ spec:
105105
description: |-
106106
BacklogQuotaRetentionPolicy specifies the retention policy for messages when backlog quota is exceeded.
107107
Valid values are "producer_request_hold", "producer_exception", or "consumer_backlog_eviction".
108+
enum:
109+
- producer_request_hold
110+
- producer_exception
111+
- consumer_backlog_eviction
112+
type: string
113+
backlogQuotaType:
114+
description: |-
115+
BacklogQuotaType controls how the backlog quota is enforced.
116+
"destination_storage" limits backlog by size (in bytes), while "message_age" limits by time.
117+
enum:
118+
- destination_storage
119+
- message_age
108120
type: string
109121
compactionThreshold:
110122
description: |-

config/default/manager_auth_proxy_patch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ spec:
3737
resources:
3838
limits:
3939
cpu: 500m
40-
memory: 128Mi
40+
memory: 512Mi
4141
requests:
4242
cpu: 5m
43-
memory: 64Mi
43+
memory: 128Mi
4444
- name: manager
4545
args:
4646
- "--health-probe-bind-address=:8081"

config/manager/manager.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ spec:
6767
resources:
6868
limits:
6969
cpu: 500m
70-
memory: 128Mi
70+
memory: 512Mi
7171
requests:
7272
cpu: 10m
73-
memory: 64Mi
73+
memory: 128Mi
7474
serviceAccountName: controller-manager
7575
terminationGracePeriodSeconds: 10

docs/pulsar_namespace.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The `PulsarNamespace` resource defines a namespace in a Pulsar cluster. It allow
2020
| `retentionSize` | Maximum size of backlog retained in the namespace. Should be set in conjunction with RetentionTime for effective retention policy. Use "-1" for infinite retention size. | No |
2121
| `backlogQuotaLimitTime` | Time limit for message backlog. Messages older than this limit will be removed or handled according to the retention policy. | No |
2222
| `backlogQuotaLimitSize` | Size limit for message backlog. When the limit is reached, older messages will be removed or handled according to the retention policy. | No |
23-
| `backlogQuotaRetentionPolicy` | Retention policy for messages when backlog quota is exceeded. Options: "producer_request_hold", "producer_exception", or "consumer_backlog_eviction". | No |
23+
| `backlogQuotaRetentionPolicy` | Retention policy for messages when backlog quota is exceeded. Options: "producer_request_hold", "producer_exception", or "consumer_backlog_eviction". **Required whenever backlogQuotaLimitTime or backlogQuotaLimitSize is set.** | Conditional |
2424
| `backlogQuotaType` | Controls how the backlog quota is enforced. Options: "destination_storage" (limits backlog by size in bytes), "message_age" (limits by time). | No |
2525
| `offloadThresholdTime` | Time limit for message offloading. Messages older than this limit will be offloaded to the tiered storage. | No |
2626
| `offloadThresholdSize` | Size limit for message offloading. When the limit is reached, older messages will be offloaded to the tiered storage. | No |
@@ -450,6 +450,8 @@ spec:
450450
name: test-pulsar-connection
451451
backlogQuotaLimitSize: 1Gi
452452
backlogQuotaLimitTime: 24h
453+
backlogQuotaRetentionPolicy: producer_request_hold
454+
# backlogQuotaType: destination_storage
453455
bundles: 16
454456
messageTTL: 1h
455457

0 commit comments

Comments
 (0)