docker-archive / deploykit

A toolkit for creating and managing declarative, self-healing infrastructure.
Apache License 2.0
2.25k stars 264 forks source link

Support for dependencies in instanceSpec.Init and modifiers in keys #894

Closed chungers closed 6 years ago

chungers commented 6 years ago

This PR adds support for processing config like this:

kind: resource
metadata:
  name: resources
options:
  WaitBeforeProvision: 100
properties:
  A:
    plugin: az1/net
    Properties:
      prop1: A-1
      prop2: A-2
  B:
    plugin: az1/net
    Properties:
      wait: "@depend('A/ID')@"
      prop1: B-1
      prop2: B-2
  C:
    plugin: az1/net
    Properties:
      wait1: "@depend('A/ID')@"
      wait2: "@depend('B/ID')@"
      wait3: "@depend('post-provision:A/data/joinToken')@"
      prop1: C-1
      prop2: C-2
  D:
    plugin: az1/net
    init: |
      cluster join --token @depend('post-provision:A/data/joinToken')@ @depend('A/Properties/address')@
    Properties:
      wait1: "@depend('A/ID')@"
      wait2: "@depend('B/ID')@"
      wait3: "@depend('C/ID')@"
      prop1: D-1
      prop2: D-2

In this example, as soon as A is provisioned (in band or out of band), B will begin to be provisioned.
Once B completes, C starts, then D. The Init of D will have values from A's properties as well as a post-provision step of A (to be implemented).

Signed-off-by: David Chung david.chung@docker.com

codecov[bot] commented 6 years ago

Codecov Report

Merging #894 into master will increase coverage by 0.02%. The diff coverage is 63.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #894      +/-   ##
==========================================
+ Coverage   48.54%   48.56%   +0.02%     
==========================================
  Files          84       84              
  Lines        7814     7837      +23     
==========================================
+ Hits         3793     3806      +13     
- Misses       3714     3721       +7     
- Partials      307      310       +3
Impacted Files Coverage Δ
pkg/types/link.go 91.17% <0%> (-2.77%) :arrow_down:
pkg/types/path.go 85.15% <100%> (+0.23%) :arrow_up:
pkg/types/depend.go 67.03% <64.7%> (-1.09%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a5e01f2...31256cc. Read the comment docs.