-
Notifications
You must be signed in to change notification settings - Fork 11
rollout: Publish rollout events to PubSub #109
base: main
Are you sure you want to change the base?
Conversation
This integrates the rollout package with the pubsub package to publish events after rollouts/rollbacks occur. It also adds a new flag `--notify-pubsub` to specify the PubSub topic. Signed-off-by: Getulio Valentin Sánchez <[email protected]>
internal/rollout/rollout.go
Outdated
} | ||
|
||
// Wait for all messages to be sent (or to fail). | ||
r.pubsubClient.Stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're publishing one event per go routine (in each rollout process), we might just wait for the event to be published using PublishResult.Get
. In this way, we can abstract the synchronous publishing from the user of the pubsub package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's a decent idea. I think that could be done with
waitFn, err := PublishMessage()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move Get into Publish
Signed-off-by: Getulio Valentin Sánchez <[email protected]>
internal/rollout/rollout.go
Outdated
@@ -232,3 +248,23 @@ func (r *Rollout) diagnoseCandidate(candidate string, healthCriteria []config.He | |||
d, err = health.Diagnose(ctx, healthCriteria, metricsValues) | |||
return d, errors.Wrap(err, "failed to diagnose candidate's health") | |||
} | |||
|
|||
func (r *Rollout) publish(svc *run.Service, diagnosis health.DiagnosisResult) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better name like publishEvent
Signed-off-by: Getulio Valentin Sánchez <[email protected]>
Signed-off-by: Getulio Valentin Sánchez <[email protected]>
This integrates the rollout package with the pubsub package to publish events after rollouts/rollbacks occur. It also adds a new flag
--notify-pubsub
to specify the PubSub topic.