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

feat: support shared components and providers #381

Merged
merged 9 commits into from
Oct 18, 2024

Conversation

brooksmtownsend
Copy link
Member

@brooksmtownsend brooksmtownsend commented Aug 9, 2024

Feature or Problem

This PR adds support to wadm for two major changes:

  1. Allow applications to attach a special wasmcloud.dev/shared: 'true' annotation, which marks an application as shared to the entire lattice
  2. Allow applications to link components and providers to/from components in a different deployed application that is shared

Components and capability providers can now specify a shared application in their properties rather than supplying an image reference. When an application is deployed that references a component in a different application, wadm will validate that the application is deployed and that the referenced component exists.

You cannot use the shared component feature to alter configuration, identifiers, or scaling properties of a shared component. I could see a feature in the future to add additional scalers, but it might cause undesirable behavior and it would be generally just better to supply your own component instead of using a shared one at this point.

This PR is getting really large, so I'm going to push off additional validation in the handlers to a separate PR that can be reviewed independently.

Here are things that should be done before this feature lands, but based on their checked status aren't completed in this PR:

(Captured these in #451)

  • Ensure applications that have dependents can't undeploy or delete
  • Ensure applications that are shared can't change to be unshared if there are dependents
  • Ensure applications that are shared can't remove the shared components if there are dependents of a component
  • Surface shared component status in applications that depend on that component (this is hard and I'm currently thinking of the best way to do this)
  • Double check that applications can't be deployed with both image/application reference or neither
  • Update WIT representation of the component/capability properties

Related Issues

Fixes #277

Release Information

wadm 0.18

This feature will be released with 0.18.0 and denoted an experimental feature for wadm. The cross-manifest linking works well and is e2e tested. There are additional guardrails we may want to introduce here, or change the way the feature works.

Consumer Impact

This doesn't include any breaking changes for existing manifests

Testing

Unit Test(s)

I'd like to include additional unit tests in the convert.rs file that prove that the conversion between a manifest + scalers is properly handled, given how critical and complex that code is. This is made harder by the need for a bunch of generics

Acceptance or Integration

Added the e2e_shared integration test suite that tests sharing components, providers, and multiple aspects of linking to/from shared components.

  • I'd also like to include some failure scenarios in this integration test suite.

Manual Verification

@brooksmtownsend brooksmtownsend force-pushed the feat/shared-components branch 2 times, most recently from a174d66 to b64dca9 Compare September 12, 2024 17:07
@brooksmtownsend brooksmtownsend force-pushed the feat/shared-components branch 4 times, most recently from acac964 to 4612b53 Compare September 23, 2024 20:28
@brooksmtownsend brooksmtownsend changed the title wip: feat: support shared components feat: support shared components Sep 23, 2024
@brooksmtownsend brooksmtownsend changed the title feat: support shared components feat: support shared components and providers Sep 23, 2024
@brooksmtownsend brooksmtownsend force-pushed the feat/shared-components branch 3 times, most recently from 9ff14d5 to 78702c1 Compare September 25, 2024 16:01
@brooksmtownsend brooksmtownsend marked this pull request as ready for review September 25, 2024 16:01
@brooksmtownsend brooksmtownsend requested a review from a team as a code owner September 25, 2024 16:01
@joonas
Copy link
Member

joonas commented Sep 25, 2024

I'm not sure that it necessarily makes sense to address in this PR, but something that I think needs to be addressed before this feature makes it into a release / becomes available for use is the reporting from a shared application/component's perspective.

If I'm providing a shared component to the lattice, I would like to be able to query what all applications are linking against my shared component so that I can have a conversation with the teams responsible for those applications about the changes I may need to make.

As I currently understand things, this change works well from the perspective of establishing a link to a shared component, but as of right now there is nothing to help the teams providing these shared components understand their "dependents", which is (imo) an absolute necessity for any platform-ish teams to be able to successfully operate.

The other thing that I'm not quite clear on is how would an upgrade to/of a shared component be facilitated, would you be forced to spin up a new application (or perhaps add a new shared component to your existing application) with a different/newer version and then encourage the internal teams to upgrade?

Signed-off-by: Brooks Townsend <[email protected]>

fix: shared components id generation

Signed-off-by: Brooks Townsend <[email protected]>
Signed-off-by: Brooks Townsend <[email protected]>
Signed-off-by: Brooks Townsend <[email protected]>
@brooksmtownsend
Copy link
Member Author

As I currently understand things, this change works well from the perspective of establishing a link to a shared component, but as of right now there is nothing to help the teams providing these shared components understand their "dependents", which is (imo) an absolute necessity for any platform-ish teams to be able to successfully operate.

Yeah I agree, I captured that in #451 as a followup since this is too hard (imo) to find out just by querying NATS

The other thing that I'm not quite clear on is how would an upgrade to/of a shared component be facilitated, would you be forced to spin up a new application (or perhaps add a new shared component to your existing application) with a different/newer version and then encourage the internal teams to upgrade?

Yeah so here, right now, there's no validation rules and the expectation is you could updated a shared component to a newer version just fine. It will be up to the deployer to make sure they aren't breaking dependents. I don't think that this is ideal, but I worry that overprescribing deployment rules will make using this feature harder.

Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

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

Approved with some nits

crates/wadm-types/src/bindings.rs Outdated Show resolved Hide resolved
crates/wadm-types/src/lib.rs Outdated Show resolved Hide resolved
crates/wadm/src/scaler/convert.rs Outdated Show resolved Hide resolved
crates/wadm/src/scaler/convert.rs Outdated Show resolved Hide resolved
crates/wadm/src/scaler/convert.rs Outdated Show resolved Hide resolved
crates/wadm/src/scaler/statusscaler.rs Show resolved Hide resolved
tests/e2e_shared.rs Show resolved Hide resolved
@brooksmtownsend brooksmtownsend enabled auto-merge (rebase) October 18, 2024 16:44
@brooksmtownsend brooksmtownsend merged commit 9972d4d into main Oct 18, 2024
5 checks passed
@brooksmtownsend brooksmtownsend deleted the feat/shared-components branch October 18, 2024 16:49
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.

[FEAT] Support sharing components/providers between manifests
3 participants