Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for component outputs #63

Open
davidthor opened this issue Jun 23, 2023 · 1 comment
Open

Add support for component outputs #63

davidthor opened this issue Jun 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@davidthor
Copy link
Member

davidthor commented Jun 23, 2023

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
@davidthor davidthor added the enhancement New feature or request label Jun 23, 2023
@davidthor davidthor added this to the v0.2 - Lifecycle hooks milestone Jun 23, 2023
@davidthor
Copy link
Member Author

I'm not sold on the stdout being used by the hook author as the way to provide the payload for the output. I feel like that cripples any potential to use stdout for debugging related features. I welcome any other suggestions for how this handshake should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant