Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add deny purge property to stream spec #186

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion controllers/jetstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,16 @@ func createStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e
opts = append(opts, jsm.DenyDelete())
}

if spec.DenyPurge {
opts = append(opts, jsm.DenyPurge())
}

if spec.DiscardPerSubject {
opts = append(opts, jsm.DiscardNewPerSubject())
}

if spec.FirstSequence != 0 {
opts = append(opts, jsm.FirstSequence(uint64(spec.FirstSequence)))
opts = append(opts, jsm.FirstSequence(spec.FirstSequence))
}

if spec.Metadata != nil {
Expand Down Expand Up @@ -486,6 +491,7 @@ func updateStream(ctx context.Context, c jsmClient, spec apis.StreamSpec) (err e
Duplicates: duplicates,
AllowDirect: spec.AllowDirect,
DenyDelete: spec.DenyDelete,
DenyPurge: spec.DenyPurge,
RollupAllowed: spec.AllowRollup,
FirstSeq: spec.FirstSequence,
SubjectTransform: subjectTransform,
Expand Down
4 changes: 4 additions & 0 deletions deploy/crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ spec:
description: When true, restricts the ability to delete messages from a stream via the API. Cannot be changed once set to true.
type: boolean
default: false
denyPurge:
description: When true, restricts the ability to purge a stream via the API. Cannot be changed once set to true.
type: boolean
default: false
discardPerSubject:
description: Allows to discard messages on a subject basis.
type: boolean
Expand Down
1 change: 1 addition & 0 deletions pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type StreamSpec struct {
AllowRollup bool `json:"allowRollup"`
Creds string `json:"creds"`
DenyDelete bool `json:"denyDelete"`
DenyPurge bool `json:"denyPurge"`
Description string `json:"description"`
DiscardPerSubject bool `json:"discardPerSubject"`
PreventDelete bool `json:"preventDelete"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/jetstream/generated/informers/externalversions/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.