Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

framework: Resource Manager #29

Merged
merged 24 commits into from
May 17, 2021
Merged

framework: Resource Manager #29

merged 24 commits into from
May 17, 2021

Conversation

mitchellh
Copy link
Contributor

@mitchellh mitchellh commented May 12, 2021

This introduces the resource manager framework to the Waypoint plugin SDK. The resource manager is a higher level package that allows plugins to compose operations using a set of "resources" (i.e. individual security groups, load balancers, etc.). The resource manager creates/destroys these as a unit and performs rollbacks as necessary.

The Waypoint server is unaware of resources. This framework eventually just serializes all the state down to the single operation. In the future, we want to make the Waypoint server aware of resources directly. This will be a building block towards that.

An example of the usage can be seen here: https://github.com/hashicorp/waypoint/compare/docker-resources

@mitchellh mitchellh requested review from briancain and a team May 12, 2021 03:07
@izaaklauer
Copy link
Contributor

Is the idea that all shared resources that are created during a deployment, like the docker network and ecs cluster/execution role, will not implement destroy logic so that they don’t get torn down during a failed deployment?

@mitchellh
Copy link
Contributor Author

Is the idea that all shared resources that are created during a deployment, like the docker network and ecs cluster/execution role, will not implement destroy logic so that they don’t get torn down during a failed deployment?

https://docs.google.com/document/d/14wq7f0NsbrA7wOAk5znE0iKN16lfx8hRRswkyVjcH8E/edit# 😄

Copy link
Contributor

@evanphx evanphx left a comment

Choose a reason for hiding this comment

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

Quite the mighty argmapper flex! Just need to clarify name's optionality or not.

framework/resource/resource.go Show resolved Hide resolved
framework/resource/resource.go Show resolved Hide resolved
r := m.Resource(cs.Order[i])
if r == nil {
// We are missing a resource that we should be destroying.
return fmt.Errorf(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we destroy the resources that we can, and then return the final error at the end saying what was missed? Or is the assumption that once we hit a missing resource, the rest are also probably in a weird state?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nevermind, I see this relates to the Rollback section in the RFC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah honestly this is a weird edge case in this whole thing... I think some experience implementing and iterating on plugins will better inform what our behavior should be here. I could see arguments either way.

@mitchellh mitchellh requested a review from evanphx May 14, 2021 18:53
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.

4 participants