Skip to content

Add common TypeInstance injection #635

@mszostok

Description

@mszostok

Description

Blocked by: #630

To make it easy to define injection of backend storage for TypeInstances with dynamic values, in Global and Action Policies we need to introduce an additional feature—common TypeInstance injection configuration:

interface:
  rules: [] # rules for Interfaces, now nested under `interface`

  default: # properties applied to all rules above
    inject:
      requiredTypeInstances:
        - id: "3ef2e4ac-9070-4093-a3ce-142139fd4a16"
          description: "Helm storage (cap.type.helm.storage:0.1.0)"

          # it works globally, not only for storage backends:
        - id: "c4f66896-c2a1-4031-b847-b55ae6a26c80"
          description: "GCP SA (cap.type.gcp.auth.service-account:0.1.0)"

typeInstance:
  rules: [] # ...

Acceptance Criteria

  • Extends the Policy GraphQL syntax
  • Update Policy GraphQL Go client (ensure that new policy can be saved and retrieved with update capact CLI)
  • Update PolicyEnforceClient
    • Doesn't affect Implementation selection (do not change ListImplementationRevisionsForInterface method)
    • Support injecting arbitrary required TypeInstances
    • Support Storage backends:
      // TODO(https://github.com/capactio/capact/issues/624):
      // 2. Global defaults based on required TypeInstance injection
      // e.mergedPolicy.Interface.Defaults
    • Add unit-tests for all possible merging scenarios.
  • Add integration test
    It("should pick Implementation B", func() {
    • First scenario, ensure that default injection works,
    • Second scenario, ensure that it can be overridden with Interface specific injection rule.
  • Add documentation on website
    • Mention that defaults doesn't affect Implementation resolution

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions