Skip to content

Commit

Permalink
Fix consumer recreate (#190)
Browse files Browse the repository at this point in the history
* Explicitly denote octal for consistency

Signed-off-by: Tomasz Pietrek <[email protected]>

* Fix consumer recreation if it was manually deleted

If the Consumer was deleted outside of NACK, it should be recreated.
This fixes the behavior by removing generation check, similar to
c6ca1ed

Signed-off-by: Tomasz Pietrek <[email protected]>

---------

Signed-off-by: Tomasz Pietrek <[email protected]>
  • Loading branch information
Jarema authored Jul 2, 2024
1 parent e273a17 commit 6867d25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/jetstream/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *Controller) processConsumerObject(cns *apis.Consumer, jsm jsmClientFunc
remoteRootCA = filepath.Join(accDir, acc.Spec.TLS.RootCAs)

for k, v := range secret.Data {
if err := os.WriteFile(filepath.Join(accDir, k), v, 0644); err != nil {
if err := os.WriteFile(filepath.Join(accDir, k), v, 0o644); err != nil {
return err
}
}
Expand All @@ -107,7 +107,7 @@ func (c *Controller) processConsumerObject(cns *apis.Consumer, jsm jsmClientFunc
for k, v := range secret.Data {
if k == acc.Spec.Creds.File {
accUserCreds = filepath.Join(c.cacheDir, ns, spec.Account, k)
if err := os.WriteFile(filepath.Join(accDir, k), v, 0644); err != nil {
if err := os.WriteFile(filepath.Join(accDir, k), v, 0o644); err != nil {
return err
}
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func (c *Controller) processConsumerObject(cns *apis.Consumer, jsm jsmClientFunc
return err
}
updateOK := (consumerOK && !deleteOK && newGeneration)
createOK := (!consumerOK && !deleteOK && newGeneration)
createOK := (!consumerOK && !deleteOK) || (!updateOK && !deleteOK && newGeneration)

switch {
case createOK:
Expand Down

0 comments on commit 6867d25

Please sign in to comment.