wasmCloud / wadm

wasmCloud Application Deployment Manager (wadm): Declarative application deployments for wasmCloud applications.
https://wasmcloud.com
Apache License 2.0
95 stars 22 forks source link

[BUG] Wadm does not allow me to use the same provider with another component. #296

Closed ritesh089 closed 2 weeks ago

ritesh089 commented 1 month ago

Affected project(s)

Describe the bug

wash does not allow me to deploy the same provider with a second component that has its own wadm. returns the error :

Provider file:///Users/****/Documents/wasm-dependencies/http-server-provider.par.gz is already deployed with a different version in http-component.

wash app status for the second component is undeployed .

Name               Latest Version   Deployed Version   Deploy Status   Description
  http-component     v0.0.1           v0.0.1                  Deployed   HTTP hello world demo in Rust, showing use of the server and client providers
  rust-hello-world   v0.0.1           N/A                   Undeployed   HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)

Note : I did use a different port for the second component , but the same provider.

Steps to reproduce

  1. wash up --wadm-version 0.11.2

  2. wash app deploy wadm.yaml (for component1)

  3. build component 2 : wash build

  4. wash app deploy wadm.yaml (for component 2)

Wadm file : component 1

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: http-component
  annotations:
    version: v0.0.1
    description: 'HTTP hello world demo in Rust, showing use of the server and client providers'
spec:
  components:
    - name: http-component
      type: component
      properties:
        image: file://./build/http_component_s.wasm
      traits:
        # Govern the spread/scheduling of the component
        - type: spreadscaler
          properties:
            replicas: 1
        - type: link
          properties:
            target: httpclient
            namespace: wasi
            package: http
            interfaces: [outgoing-handler]

    # Add a capability provider that enables HTTP access
    - name: httpserver
      type: capability
      properties:
        image: file:///Users/****/Documents/wasm-dependencies/http-server-provider.par.gz
      traits:
        # Link the httpserver to the component, and configure the HTTP server
        # to listen on port 8080 for incoming requests
        - type: link
          properties:
            target: http-component
            namespace: wasi
            package: http
            interfaces: [incoming-handler]
            source_config:
              - name: default-http
                properties:
                  address: 127.0.0.1:8080

    - name: httpclient
      type: capability
      properties:
        image: file:///Users/****/Documents/wasm-dependencies/http-client-provider.par.gz

Wadm (component-2)

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: rust-hello-world
  annotations:
    version: v0.0.1
    description: "HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)"
spec:
  components:
    - name: http-component
      type: component
      properties:
        image: file://./build/http_hello_world_s.wasm
      traits:
        - type: link
          properties:
            target: custom-provider
            namespace: wasmcloud
            package: example
            interfaces: [system-info]
        # Govern the spread/scheduling of the component
        - type: spreadscaler
          properties:
            replicas: 1

    # Add a capability provider that enables HTTP access
    - name: httpserver
      type: capability
      properties:
        image: file:///Users/****/Documents/wasm-dependencies/http-server-provider.par.gz
      traits:
        # Link the httpserver to the component, and configure the HTTP server
        # to listen on port 8085 for incoming requests
        - type: link
          properties:
            target: http-component
            namespace: wasi
            package: http
            interfaces: [incoming-handler]
            source_config:
              - name: default-http
                properties:
                  address: 127.0.0.1:8085

    - name: custom-provider
      type: capability
      properties:
        image: file://../mycustom-provider/build/wasmcloud-provider-custom-template.par.gz
        id: custom-provider
        config:
          - name: provider-config
            properties:
              foo: bar

Expected behavior

I expect both components to be deployed with the http-server capability provider.

Environment

Screenshots / Logs / Additional context

No response

brooksmtownsend commented 1 month ago

Transferring issue over to the wadm repository, let me see if I can reproduce here...

brooksmtownsend commented 1 month ago

I can reproduce with two different versions of the same provider.

/dog-fetcher ➜ cat wadm.yaml|grep http-server
        image: ghcr.io/wasmcloud/http-server:0.20.1
/http-hello-world ➜ cat wadm.yaml|grep http-server
        image: ghcr.io/wasmcloud/http-server:0.20.0

➜ wash app deploy ./wadm.yaml

Provider ghcr.io/wasmcloud/http-server:0.20.1 is already deployed with a different version in rust-hello-world.

This is an unintended leftover bit of validation.