mirror of
https://github.com/Lore09/Tesi-Magistrale.git
synced 2025-12-19 12:24:31 +00:00
Added producer template
This commit is contained in:
82
src/code_generator/templates/producer_nats/wadm.yaml
Normal file
82
src/code_generator/templates/producer_nats/wadm.yaml
Normal file
@@ -0,0 +1,82 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: {{ component_name }}
|
||||
spec:
|
||||
components:
|
||||
- name: {{ component_name }}
|
||||
type: component
|
||||
properties:
|
||||
image:
|
||||
id: producer
|
||||
# config:
|
||||
# - name: nats-topic
|
||||
# properties:
|
||||
# dest-topic: wasmcloud.echo.reply
|
||||
traits:
|
||||
- type: spreadscaler
|
||||
properties:
|
||||
instances: 1
|
||||
- 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: "{{ registry_url }}/{{ component_name }}:{{ version }}"
|
||||
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 -%}
|
||||
Reference in New Issue
Block a user