Skip to content

Validate Resource Graphs #20

@srohatgi

Description

@srohatgi

Currently, the graph lib synchronizes resource graphs based on a correct dependency order. Following validation is performed:

  • dependencies within resources should always resolve correctly

Missing dependencies on a resource graph is not validated. This enhancement proposes adding validation capability for a given graph kind.

Proposed api changes:

// Opts captures customizable functionality like logging
type Opts struct {
  CustomLogger func(args ...interface{})
  Decorator    func(r Resource) Resource

  // Validator captures constrained dependency graph kinds
  Validator    map[string][]Resource
}

// Sync method uses the Resource slice to generate a DAG. The DAG is verified by comparing it to the 
// `kind` parameter. The DAG is processed based on the value of toDelete flag. Resources may be 
// processed concurrently. Processed resources may return a status string and or an error. The function 
// collects these and aggregates them in respective maps keyed by resource names.
func (lib *Lib) Sync(ctxt context.Context, kind string, resources []Resource, toDelete bool) (map[string]string, error)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions