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

feat(compose): Support depends_on property #1634

Merged
merged 2 commits into from
May 9, 2024

Conversation

LucaSeri
Copy link
Contributor

@LucaSeri LucaSeri commented May 7, 2024

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran make fmt on your commit series before opening this PR;
  • Updated relevant documentation.

Description of changes

The depends_on property allows specifying dependencies between services. The services will always be started in the order of the dependencies and always be stopped in the opposite order. At the moment we cannot do healthchecks in krafkit, so the condition of the dependency is ignored.

E.g.

services:
  a:   
    image: nginx:1.15
    depends_on:
      - b
  b:
    image: nginx:1.15

kraft compose up -d

 i  creating network test_default...
 i  creating service b...
 i  creating service a..

kraft compose down

 i  removing service a...
 i  removing service b...
 i  removing network test_default..

@LucaSeri LucaSeri marked this pull request as draft May 7, 2024 10:49
@LucaSeri LucaSeri marked this pull request as ready for review May 7, 2024 10:53
@LucaSeri LucaSeri requested a review from nderjung May 7, 2024 10:53
@nderjung
Copy link
Member

nderjung commented May 9, 2024

Nice! Can you split this into two commits, one which introduces ServicesOrderedByDependencies and ServicesOrderedByDependencies into the compose package and another which utilizes these new methods across the internal/cli/kraft/compose subcommands? Thanks!

The two newly introduced methods help with fetching dependencies
and ordering services either by dependency order or reverse
dependency order.

Signed-off-by: Luca Seritan <luca.seritan@gmail.com>
The depends_on property allows specifying dependencies
between services. The services will always be started
in the order of the dependencies and always be stopped
in the opposite order. At the moment we cannot do healthchecks
in krafkit, so the condition of the dependency is ignored.

Signed-off-by: Luca Seritan <luca.seritan@gmail.com>
Copy link
Member

@nderjung nderjung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@nderjung nderjung merged commit e95202f into unikraft:staging May 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants