Skip to content

Commit

Permalink
Add stream and sources subject mappings
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Sep 22, 2023
1 parent c8510d6 commit 44512a0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 9 deletions.
7 changes: 7 additions & 0 deletions controllers/jetstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,5 +681,12 @@ func getStreamSource(ss *apis.StreamSource) (*jsmapi.StreamSource, error) {
}
}

for _, transform := range ss.SubjectTransforms {
jss.SubjectTransforms = append(jss.SubjectTransforms, jsmapi.SubjectTransformConfig{
Source: transform.Source,
Destination: transform.Dest,
})
}

return jss, nil
}
28 changes: 27 additions & 1 deletion deploy/crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ spec:
type: string
externalDeliverPrefix:
type: string
subjectTransforms:
description: List of subject transforms for this mirror.
type: array
items:
description: A subject transform pair.
type: object
properties:
source:
description: Source subject.
type: string
dest:
description: Destination subject.
type: string
placement:
description: A stream's placement.
type: object
Expand Down Expand Up @@ -146,6 +159,19 @@ spec:
type: string
externalDeliverPrefix:
type: string
subjectTransforms:
description: List of subject transforms for this mirror.
type: array
items:
description: A subject transform pair.
type: object
properties:
source:
description: Source subject.
type: string
dest:
description: Destination subject.
type: string
servers:
description: A list of servers for creating stream
type: array
Expand Down Expand Up @@ -209,7 +235,7 @@ spec:
description: Source subject
dest:
type: string
description: Destination subject to transform to
description: Destination subject to transform into
preventDelete:
description: When true, the managed Stream will not be deleted when the resource is deleted
type: boolean
Expand Down
2 changes: 2 additions & 0 deletions pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ type StreamSource struct {

ExternalAPIPrefix string `json:"externalApiPrefix"`
ExternalDeliverPrefix string `json:"externalDeliverPrefix"`

SubjectTransforms []*SubjectTransform `json:"subjectTransforms"`
}

type RePublish struct {
Expand Down
15 changes: 13 additions & 2 deletions pkg/jetstream/apis/jetstream/v1beta2/zz_generated.deepcopy.go

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

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

0 comments on commit 44512a0

Please sign in to comment.