Skip to content

Add support for component outputs #63

@davidthor

Description

@davidthor

Component outputs are a great way for components to provide values to upstream consumers. Sometimes the data will be static (e.g. an event topic), and other times it will be dynamic with a different value provided to each consumer (e.g. credentials).

The component spec

# architect/dependency
version: v2

deployments:
  main:
    image: my-image:latest
    command: npm start

services:
  public:
    deployment: main
    port: 8080
  admin:
    deployment: main
    port: 8081

outputs:
  my-event-topic:
    description: The topic I publish events to
    value: my-topic-name
  credentials:
    description: Unique credentials to access my service
    sensitive: true
    on:
      create:
        image: my-image:latest
        command: ./gen-credentials.sh
        environment:
          ADMIN_ADDR: ${{ services.admin.url }}

---
# architect/consumer
version: v2

dependencies:
  dependency: architect/dependency

deployments:
  main:
    image: test:latest
    environment:
      PUBLIC_ADDR: ${{ dependencies.dependency.services.public.url }}
      TOPIC: ${{ dependencies.dependency.outputs.my-event-topic.value }}
      CREDENTIALS: ${{ dependencies.dependency.outputs.credentials.value }}

Implementation notes

  • The above schema assumes that the outputs.*.on.create will launch a task that has access to the public service. This should operate the same way other tasks and cronjobs work today.
  • The credentials should be the only thing logged to stdout
  • The task we actually create should write the stdout contents to a "secret" resource that gets created for each consumer

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions