Added producer template

This commit is contained in:
Lorenzo Venerandi
2025-01-29 13:27:28 +01:00
parent 0743db516f
commit eabbb07e47
147 changed files with 9996 additions and 0 deletions

View 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 -%}