Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

rollout: Publish rollout events to PubSub #109

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

rollout: Publish rollout events to PubSub #109

wants to merge 4 commits into from

Conversation

gvso
Copy link
Contributor

@gvso gvso commented Aug 26, 2020

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.

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]>
}

// Wait for all messages to be sent (or to fail).
r.pubsubClient.Stop()
Copy link
Contributor Author

@gvso gvso Aug 26, 2020

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

Copy link
Contributor

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()

Copy link
Contributor

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]>
@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

better name like publishEvent

Getulio Valentin Sánchez added 2 commits August 26, 2020 15:13
Signed-off-by: Getulio Valentin Sánchez <[email protected]>
Signed-off-by: Getulio Valentin Sánchez <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish to Pub/Sub after a rollout/rollback have occurred
2 participants