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

Add common TypeInstance injection #635

Closed
Tracked by #604
mszostok opened this issue Feb 15, 2022 · 1 comment
Closed
Tracked by #604

Add common TypeInstance injection #635

mszostok opened this issue Feb 15, 2022 · 1 comment
Assignees
Labels
area/engine Relates to Engine area/hub Relates to Hub enhancement New feature or request
Milestone

Comments

@mszostok
Copy link
Member

mszostok commented Feb 15, 2022

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
@mkuziemko
Copy link

Here is a list of PR to review:

During testing, I also spotted a potential issue with one of the manifests from hub-manifest, I added a note in the PR and I will create a PR if it will be verified that is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Relates to Engine area/hub Relates to Hub enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants