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

fix: if key/value store already exists use that #2293

Merged
merged 3 commits into from
Nov 11, 2022

Conversation

juliev0
Copy link
Contributor

@juliev0 juliev0 commented Nov 4, 2022

Fixes #2278

Use the existing key/value store if it already exists.

I tested this with the following experiments involving a webhook and a sensor with a trigger that is configured as "A&&B":

  • start up new jetstream bus where key/value store doesn't already exist
  • use existing jetstream bus, send "A", modify jetstream version and kubectl apply it, send "B", verify trigger occurs
  • use existing jetstream bus, send "A", delete sensor pod and see it restart, send "B", verify trigger occurs

Signed-off-by: Julie Vogelman julie_vogelman@intuit.com

Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
@juliev0 juliev0 marked this pull request as draft November 4, 2022 19:06
Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
@@ -55,12 +55,22 @@ func (stream *SensorJetstream) Initialize() error {
}
// create Key/Value store for this Sensor (seems to be okay to call this if it already exists)
stream.keyValueStore, err = stream.MgmtConnection.JSContext.CreateKeyValue(&nats.KeyValueConfig{Bucket: stream.sensorName})
if err != nil {
switch err {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we query first, if it's not existing, then create it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
Copy link
Member

@whynowy whynowy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@juliev0 juliev0 marked this pull request as ready for review November 8, 2022 23:58
@whynowy whynowy merged commit 864dc8d into argoproj:master Nov 11, 2022
whynowy pushed a commit that referenced this pull request Dec 12, 2022
Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
bilalba pushed a commit to intuit-data-os/argo-events that referenced this pull request Jan 9, 2023
Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
Signed-off-by: Bilal Bakht Ahmad <tringingly@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new event bus breaks sensors
2 participants