-
Notifications
You must be signed in to change notification settings - Fork 28
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 sharing components/providers between manifests #277
Comments
This could be a real can of worms, but it's definitely worth it.
|
Here is what @thomastaylor312 and I brainstormed here:
To change an example manifest from an HTTP server to a shared HTTP server: Before apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: dog-fetcher
annotations:
description: 'An app that gets dog pics'
spec:
components:
- name: dog-fetcher
type: component
properties:
image: ghcr.io/wasmcloud/components/dog-fetcher-rust:0.1.0
traits:
- type: spreadscaler
properties:
instances: 5
- name: httpserver
type: capability
properties:
image: ghcr.io/wasmcloud/http-server:0.21.0
traits:
- type: link
properties:
target: dog-fetcher
namespace: wasi
package: http
interfaces:
- incoming-handler
source_config:
- name: dog-fetcher-address
properties:
address: 0.0.0.0:8081 After, shared manifest: apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: network
annotations:
description: 'Shared platform network capability providers'
wasmcloud.dev/shared: 'true'
spec:
components:
- name: httpserver
type: capability
properties:
image: ghcr.io/wasmcloud/http-server:0.21.0 App manifest: apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: dog-fetcher
annotations:
description: 'An app that gets dog pics'
spec:
components:
- name: dog-fetcher
type: component
properties:
image: ghcr.io/wasmcloud/components/dog-fetcher-rust:0.1.0
traits:
- type: spreadscaler
properties:
instances: 5
- name: httpserver
type: capability
properties:
# This references a component `httpserver` in manifest `network`
# Other manifest must be annotated with `wasmcloud.dev/shared=true`
# or this will be rejected at put time.
manifest:
name: network
component: httpserver
traits:
- type: link
properties:
target: dog-fetcher
namespace: wasi
package: http
interfaces:
- incoming-handler
source_config:
- name: dog-fetcher-address
properties:
address: 0.0.0.0:8081 As a part of putting the manifest we would resolve any We would do a similar lookup at deploy time to properly link from/to the component in the other manifest based on its actual component ID in the lattice. The "weakchildof" concept that @cdmurph32 sounds great IMO, what we should absolutely do for this feature is prevent undeploying resources that other apps depend on (perhaps without a force). We may be able to detail a couple of strategies for the undeploy / delete such that the delete can be non_destructive, destructive, or a weakchild strategy where resources stick around if they are depended on |
Supercedes #120 |
I like the option of shared manifests . Isn't the naming confusing though ?
Do you think it would be better to call this provider itself ? |
It is somewhat, what we're really referring to is the component keyword in the manifest, not webassembly component. We're overloading the term here, but happy to take suggestions spec:
components:
- name: dog-fetcher
type: component
...
- name: httpserver
type: capability |
Still thinking through the ramifications of this change, but I think naming is a bit off in the shared application reference. Instead of # This references a component `httpserver` in manifest `network`
# Other manifest must be annotated with `wasmcloud.dev/shared=true`
# or this will be rejected at put time.
manifest:
name: network
component: httpserver it should probably be # This references a component `httpserver` in manifest `network`
# Other manifest must be annotated with `wasmcloud.dev/shared=true`
# or this will be rejected at put time.
application:
name: network
component: httpserver Applications are what we're all working with, manifests are just the YAML version of them |
@protochron I think this makes sense, and it likely means that we can fail a bit earlier in the deployment process if it's obvious you should be looking for a running application 🤔 I'll make this change in my WIP PR |
Just wanted to add use cases here to further motivate this work... There is a whole class of problems this would solve, where instead of having providers as proxies to singleton non-wasmCloud deployments of supporting software (reverse proxy, database, cache), the wasmCloud providers would become the singleton deployments. Eliminating the need for supporting software outside of wasmCloud means I can get rid of k8s or other managed services. Example 1: a singleton HTTP server provider that multiple components can contribute endpoint handlers to (reverse proxy extensibility) |
@atifsyedali thank you for the additional use cases, these will be helpful when setting up tests & edge cases in #381 ! |
Just like named configuration can be specified solely by name, without specifying the properties, and sourced from outside of an application, it would be great to be able to share a component or capability provider between different applications to cut down on duplication of compute.
For example, a minimal HTTP component manifest:
If you imagine we have two of these basic HTTP component YAMLs, most of the configuration will look the same but we'll end up using two HTTP servers to facilitate communication.
To throw out a strawman, one possible solution to this would be to reference a provider by name and, optionally, manifest:
Then, in our updated application manifest:
The benefit of only allowing references to other applications is validation, which would let us look up dependent providers before deploying an application (and to warn when undeploying the
managed
application)The text was updated successfully, but these errors were encountered: