|
| 1 | +# AppScope Configuration |
| 2 | + |
| 3 | +This section describes how application scope can be set up using app-scope configuration. |
| 4 | + |
| 5 | +An app scope needs to be set up before referenced/used by each deployment of components. To set up an app scope, we deploy an app-scope configuration. |
| 6 | + |
| 7 | +An app-scope configuration (abbr. `scope config`) is managed by the _app operator_ role, and provides information specific to the current set-up of an app scope. |
| 8 | + |
| 9 | +## Defining an AppScope Configuration |
| 10 | + |
| 11 | +### Top-Level Attributes |
| 12 | + |
| 13 | +The top-level attributes of an app-scope config define its apiVersion, kind, metadata, and spec. |
| 14 | + |
| 15 | +| Attribute | Type | Required | Default Value | Description | |
| 16 | +|-----------|------|----------|---------------|-------------| |
| 17 | +| `apiVersion` | `string` | Y || The API version of the specification in use. At present only `core.hydra.io/v1alpha1` is defined. | |
| 18 | +| `kind` | `string` | Y || The string `AppScopeConfiguration` | |
| 19 | +| `metadata` | [`Metadata`](#metadata) | Y | | AppScope configuration metadata. | |
| 20 | +| `spec`| [`Spec`](#spec) | Y || A container for exposing configuration attributes. | |
| 21 | + |
| 22 | +### Metadata |
| 23 | + |
| 24 | +Metadata describes this trait. The metadata section is defined in [Section 3](3.component_model.md#metadata). |
| 25 | + |
| 26 | + |
| 27 | +### Spec |
| 28 | +The specification defines three major things: Parameters that can be overridden at deployment time, a set of scopes to create, and component instances to create. |
| 29 | + |
| 30 | +| Attribute | Type | Required | Default Value | Description | |
| 31 | +|-----------|------|----------|---------------|-------------| |
| 32 | +| `appScopeType` | `string` | Y | | The type of the app-scope to create an instance of. | |
| 33 | +| `properties` | [`Properties`](#properties) | N | | The properties attached to this scope. | |
| 34 | + |
| 35 | +### Properties |
| 36 | + |
| 37 | +A properties object is an object whose structure is determined by the scope property schema. It may be a simple value, or it may be a complex object. Properties are validated against the schema appropriate for the trait or scope. For example, if a trait defines a schema for properties that requires an array of integers with at least one member, the `properties` object is expected to be an array of integers with at least one member. During validation of the `properties` object, the trait's property schema will be applied. |
| 38 | + |
| 39 | +If no schema is supplied, a property will be passed to the trait runtime without structural validation. As long as it parses as YAML or JSON, it will be considered valid. |
| 40 | + |
| 41 | +## Example |
| 42 | +The following is an example of a complete YAML file that illustrates the configurational elements above: |
| 43 | + |
| 44 | +```yaml |
| 45 | +apiVersion: core.hydra.io/v1alpha1 |
| 46 | +kind: AppScopeConfiguration |
| 47 | +metadata: |
| 48 | + name: public-vpc |
| 49 | +spec: |
| 50 | + appScopeType: core.hydra.io/v1alpha1.Network |
| 51 | + properties: |
| 52 | + - name: network-id |
| 53 | + value: myNetwork |
| 54 | + - name: subnet-id |
| 55 | + value: public-subnet |
| 56 | + - name: gateway-type |
| 57 | + value: public |
| 58 | + |
| 59 | +--- |
| 60 | +apiVersion: core.hydra.io/v1alpha1 |
| 61 | +kind: AppScopeConfiguration |
| 62 | +metadata: |
| 63 | + name: private-vpc |
| 64 | +spec: |
| 65 | + appScopeType: core.hydra.io/v1alpha1.Network |
| 66 | + properties: |
| 67 | + - name: network-id |
| 68 | + value: myNetwork |
| 69 | + - name: subnet-id |
| 70 | + value: private-subnet |
| 71 | + - name: gateway-type |
| 72 | + value: nat |
| 73 | +``` |
0 commit comments