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

Update documentation after required TypeInstance syntax change in Policy #50

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content-development/terraform-manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ To make sure the Terraform-based Implementation is selected, you may use additio
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
# (...)
```
6 changes: 2 additions & 4 deletions docs/example/mattermost-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ To change the Mattermost installation, we need to adjust our Global policy to pr
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
- id: ${TI_ID}
typeRef:
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account"
- interface:
path: cap.*
oneOf:
Expand Down
10 changes: 5 additions & 5 deletions docs/feature/policies/global-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ rules: # Configures the following behavior for Engine during rendering Action
- path: "cap.type.gcp.auth.service-account"
# in any revision
inject:
typeInstances: # For such Implementation, inject the following TypeInstances:
requiredTypeInstances: # For such Implementation, inject the following TypeInstances if matching Type Reference is used in `Implementation.spec.requires` property along with `alias`:

# Find Type Reference for the given TypeInstance ID. Then, find the alias of the Type reference in `spec.requires` property.
# If it is defined, inject the TypeInstance with ID `9038dcdc-e959-41c4-a690-d8ebf929ac0c` under this alias.
- id: 9038dcdc-e959-41c4-a690-d8ebf929ac0c
typeRef: # Find the alias of the Type reference in `spec.requires` property.
# If it is defined, inject the TypeInstance with ID `9038dcdc-e959-41c4-a690-d8ebf929ac0c` under this alias.
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account" # optional

- implementationConstraints: # In second place find and select Implementation which:
attributes: # contains the following attributes
Expand Down
16 changes: 8 additions & 8 deletions docs/feature/policies/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ You can also deny all Implementations for a given Interface with the following s
oneOf: [] # deny all Implementations for a given Interface
```

### TypeInstance injection
### Required TypeInstance injection

Along with Implementation constraints, Cluster Admin may configure TypeInstances, which are downloaded and injected in the Implementation workflow. This can be helpful for example, in case you are using Implementations, which are deploying infrastructure on a public cloud (like AWS or GCP) and you want to ensure that everything is deployed in the same account. For example:
Along with Implementation constraints, Cluster Admin may configure TypeInstances, which are downloaded and injected in the Implementation workflow. The prerequisite is that the Implementation must contain matching Type Reference in `spec.requires` property, along with defined `alias` for such requirement.

This can be helpful, for example, in case you are using Implementations, which are deploying infrastructure on a public cloud (like AWS or GCP) and you want to ensure that everything is deployed in the same account. For example:

```yaml
rules:
Expand All @@ -135,11 +137,9 @@ rules:
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
- id: 9038dcdc-e959-41c4-a690-d8ebf929ac0c
typeRef:
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account" # optional
```

> **NOTE:** Instructions how to create a TypeInstance using the Capact CLI can be found [here](./../../cli/commands/capact_typeinstance_create.md).
Expand All @@ -161,7 +161,7 @@ Even if the Implementation satisfies the constraints, and the `alias` is not def

### Additional parameter injection

You can also provide additional parameters to tweak the Implementation. The Implementation parameters Type is specified in the Implementation manifest in `.spec.additionalInput.parameters`. For example, for AWS RDS for Postgresql Implementation you can provide additional parameters of Type `cap.type.aws.rds.postgresql.install-input`:
You can also provide additional parameters to tweak the Implementation. The Implementation parameters Type is specified in the Implementation manifest in `.spec.additionalInput.parameters`. For example, for AWS RDS for PostgreSQL Implementation you can provide additional parameters of Type `cap.type.aws.rds.postgresql.install-input`:

```yaml
metadata:
Expand Down Expand Up @@ -191,7 +191,7 @@ rules:

## Merging of different policies

There are three different policies, which are merged together, when rendering the Action: Global, Action and Workflow step policies. Merging is necessary to calculate the final policy, which is used to select an Implementation and inject TypeInstaces and parameters. The priority order of the policies is configurable by the Capact Admin. The default order is (highest to lowest):
There are three different policies, which are merged together, when rendering the Action: Global, Action and Workflow step policies. Merging is necessary to calculate the final policy, which is used to select an Implementation and inject TypeInstances and parameters. The priority order of the policies is configurable by the Capact Admin. The default order is (highest to lowest):
1. Action policy
2. Global policy
3. Workflow step policy
Expand Down