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

Node Stages and Dependency Manager #1759

Merged
merged 49 commits into from
Feb 12, 2024
Merged

Conversation

steiler
Copy link
Collaborator

@steiler steiler commented Nov 30, 2023

Implementing #1700

This change will first of all execute the Post-Deploy phase as another step in the scheduleNode func.
This will allow for a wider variety of dependencies. e.g. just deploying a node when another is already healthy.
Further the new struct for WaitFor allows to wait for specific states of other nodes, before certain deployment stages are started.
Multiple dependencies for different or the same phase are also possible.

So the structure of the WaitFor field changes as follows:

    NodeC:
      ...
      wait-for:
        create:                    # For NodeB to enter the _create_ stage, the following preconditions must be met
          - node: NodeA            # NodeA
            phase: healthy         # Must have entered the healthy
        configure:                 # For NodeB to enter the _configure_ stage, the following preconditions must be met
          - node: NodeB            # NodeB
            phase: create          # Must have finished the _create_ stage

These phases are used in two means.

  wait-for:
    create:                      # Means 1
      - node: xyz
        phase: healthy           # Means 2

Means 1 defines what needs needs to happen before the node enters the Means 1 phase / stage.
Means 2 on the other hand defined which phase / stage node xyz must have finished for the enclosing node to start the Means 1 phase / stage.

The available phases are:

  • create - Container create and start
  • create-links - Deploy container links
  • configure - Deploy container configuration
  • healthy - Container turns healthy (only viable as a Means 2 statement)
  • exit - Container exists (usefull for init containers, also only viable as Means 2 statement

Taking a look at this example:

name: linux

topology:
  kinds:
    linux:
      image: alpine
      cmd: sleep infinity
  nodes:
    l1:
      kind: linux
    l2:
      kind: linux
      wait-for:
        configure:
          - node: l1
            phase: create
    l3:
      kind: linux
      image: mavatest
      wait-for:
        create:
          - node: l2
            phase: configure
    l4:
      kind: linux
      wait-for:
        create:
          - node: l3
            phase: healthy
        configure:
          - node: l1
            phase: configure

Node l1 starts without any dependency. For l2 to enter the configure/post-deploy stage, l1 is required to have finished the create phase.
Further l3 will start its creation as soon as node l2 finished its configure/post-deploy stage. l4 will get created as soon as l3 turned healthy (make sure healthchecks are enabled*) and node l1 is done with its configure phase.

*We have the healthcheck PR still pending, that enables you to define healthchecks as part of the topology or you rely on healthcheck defined already via the Dockerfile -> Healthcheck

types/types.go Outdated Show resolved Hide resolved
@steiler
Copy link
Collaborator Author

steiler commented Dec 4, 2023

CAREFULL, the structure of the topo file has changed to what is documented in the top.
It now follows the structure @hellt suggested further up.

@steiler steiler marked this pull request as ready for review December 28, 2023 08:59
types/node_definition.go Outdated Show resolved Hide resolved
@steiler steiler added the enhancement New feature or request label Jan 23, 2024
types/node_definition.go Outdated Show resolved Hide resolved
types/types.go Outdated Show resolved Hide resolved
runtime/docker/docker.go Outdated Show resolved Hide resolved
runtime/docker/docker.go Outdated Show resolved Hide resolved
clab/dependency_manager/dependency_manager.go Outdated Show resolved Hide resolved
clab/dependency_manager/dependency_manager.go Outdated Show resolved Hide resolved
clab/clab_test.go Show resolved Hide resolved
clab/clab.go Show resolved Hide resolved
cmd/deploy.go Show resolved Hide resolved
clab/clab.go Outdated Show resolved Hide resolved
clab/clab.go Outdated Show resolved Hide resolved
@hellt hellt changed the title Dependency manager: increase dependecy flexibility Node Stages and Dependency Manager Feb 11, 2024
@hellt
Copy link
Member

hellt commented Feb 11, 2024

@steiler also check out this commit
580e852

I think it makes things clearer, as no extra indirection is involved, no Enter/SignalDone on the depMgr level, these function belong to the dependencyNode

@steiler
Copy link
Collaborator Author

steiler commented Feb 12, 2024

@steiler also check out this commit 580e852

I think it makes things clearer, as no extra indirection is involved, no Enter/SignalDone on the depMgr level, these function belong to the dependencyNode

Yes that is alright. Would be a natural change in the upcoming change, we discussed. But it's fine to do it right now.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 96 lines in your changes are missing coverage. Please review.

Comparison is base (f49b4c8) 53.43% compared to head (6dad097) 53.66%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1759      +/-   ##
==========================================
+ Coverage   53.43%   53.66%   +0.23%     
==========================================
  Files         152      154       +2     
  Lines       11070    11236     +166     
==========================================
+ Hits         5915     6030     +115     
- Misses       4314     4346      +32     
- Partials      841      860      +19     
Files Coverage Δ
nodes/node.go 57.14% <ø> (ø)
runtime/runtime.go 79.41% <ø> (ø)
types/node_definition.go 94.05% <100.00%> (ø)
types/types.go 61.53% <ø> (ø)
clab/config.go 67.00% <33.33%> (-0.46%) ⬇️
clab/dependency_manager/dependency_node.go 95.55% <95.55%> (ø)
clab/exec/exec.go 63.93% <80.00%> (+1.10%) ⬆️
cmd/deploy.go 67.74% <50.00%> (+1.39%) ⬆️
runtime/ignite/ignite.go 0.40% <0.00%> (-0.01%) ⬇️
runtime/docker/docker.go 70.94% <42.85%> (-0.34%) ⬇️
... and 6 more

@hellt hellt merged commit 79b4fa1 into srl-labs:main Feb 12, 2024
60 checks passed
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

Successfully merging this pull request may close these issues.

Integration of Health Checks with wait-for Not Honoring Container 'Healthy' Status
2 participants