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

[CLD-8628 #2] Add custom status code for installation name/dns conflicts + bonus #1091

Merged
merged 6 commits into from
Dec 18, 2024

Conversation

nickmisasi
Copy link
Contributor

Summary

This PR adds the ability for the provisioner to return a custom 409 (StatusConflict) status code when the requested installation name, or DNS is already in use on creation. This will allow us to be more communicative to users of the Cloud plugin when they rapidly attempt to delete and recreate an installation within a few minutes of each other, after we turn on the 24h deletion pending window.

Ticket Link

https://mattermost.atlassian.net/browse/CLD-8628

Release Note

None

@mm-cloud-bot mm-cloud-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 10, 2024
Comment on lines +672 to +680
// Try to parse the user ID from the request context, so it can be passed along with the webhook event
actorID := ""
if value := r.Context().Value(ContextKeyUserID{}); value != nil {
if str, ok := value.(string); ok && str != "" {
actorID = str
}
}

err = c.EventProducer.ProduceInstallationStateChangeEvent(installationDTO.Installation, oldState, events.DataField{Key: "actor_id", Value: actorID})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I snuck this in while I was here. This passes the ID of the actor that initiated the deletion request, so that webhook listeners can easily detect who did the deletion. The main use case for this will be the Cloud Plugin. Currently, whenever an installation is deleted for any reason, a message "Cloud isntallation <> has been manually deleted and is now removed from the cloud plugin", which confuses users, as sometimes an automatic cleanup script deletes them. With this change, the Cloud Plugin will be able to tell if it itself made the deletion request, or if it was another system, and adjust the message sent accordingly.

Copy link
Contributor

@gabrieljackson gabrieljackson left a comment

Choose a reason for hiding this comment

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

LGTM

@nickmisasi nickmisasi requested review from andrleite and stafot and removed request for andrleite December 13, 2024 15:34
@nickmisasi nickmisasi added the 4: Reviews Complete All reviewers have approved the pull request label Dec 18, 2024
@nickmisasi nickmisasi merged commit 6a79c68 into master Dec 18, 2024
5 checks passed
@nickmisasi nickmisasi deleted the CLD-8628-2 branch December 18, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants