mirror of
https://github.com/Lore09/Tesi-Magistrale.git
synced 2025-12-19 04:14:35 +00:00
87 lines
2.6 KiB
YAML
87 lines
2.6 KiB
YAML
apiVersion: core.oam.dev/v1beta1
|
|
kind: Application
|
|
metadata:
|
|
name: {{ component_name }}
|
|
spec:
|
|
components:
|
|
- name: {{ component_name }}
|
|
type: component
|
|
properties:
|
|
image: {{ registry_url }}/{{ component_name }}:{{ version }}
|
|
id: producer
|
|
traits:
|
|
- type: spreadscaler
|
|
properties:
|
|
instances: 1
|
|
spread:
|
|
{%- set weight = (100 / (targets | length)) | int -%}
|
|
{% for target in targets %}
|
|
- name: {{ target }}
|
|
weight: {{ weight }}
|
|
requirements:
|
|
host-type: {{ target }}
|
|
{% endfor %}
|
|
- type: link
|
|
properties:
|
|
target: nats-producer
|
|
namespace: wasmcloud
|
|
package: messaging
|
|
interfaces: [consumer]
|
|
|
|
# Add a capability provider that implements `wasmcloud:messaging` using NATS
|
|
- name: nats-producer
|
|
type: capability
|
|
properties:
|
|
image: ghcr.io/wasmcloud/messaging-nats:0.23.1
|
|
traits:
|
|
- type: link
|
|
properties:
|
|
target: {{ component_name }}
|
|
namespace: wasmcloud
|
|
package: messaging
|
|
interfaces: [handler]
|
|
source_config:
|
|
- name: simple-subscription
|
|
properties:
|
|
subscriptions: {{ source_topic}}
|
|
- type: spreadscaler
|
|
properties:
|
|
instances: 1
|
|
spread:
|
|
{%- set weight = (100 / (targets | length)) | int -%}
|
|
{% for target in targets %}
|
|
- name: {{ target }}
|
|
weight: {{ weight }}
|
|
requirements:
|
|
host-type: {{ target }}
|
|
{% endfor %}
|
|
|
|
- name: httpserver
|
|
type: capability
|
|
properties:
|
|
image: ghcr.io/wasmcloud/http-server:0.23.2
|
|
traits:
|
|
# Link to Echo, and inform it to listen on port 8000
|
|
# on the local machine
|
|
- type: link
|
|
properties:
|
|
target: {{ component_name }}
|
|
namespace: wasmcloud
|
|
package: http
|
|
interfaces: [incoming-handler]
|
|
source_config:
|
|
- name: default-http
|
|
properties:
|
|
address: 0.0.0.0:8000
|
|
- type: spreadscaler
|
|
properties:
|
|
instances: 1
|
|
spread:
|
|
{%- set weight = (100 / (targets | length)) | int -%}
|
|
{% for target in targets %}
|
|
- name: {{ target }}
|
|
weight: {{ weight }}
|
|
requirements:
|
|
host-type: {{ target }}
|
|
{% endfor %}
|