Skip to content

Commit

Permalink
add app-scope config
Browse files Browse the repository at this point in the history
  • Loading branch information
hongchaodeng committed Sep 16, 2019
1 parent 5060434 commit b644981
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions appscope_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# AppScope Configuration

This section describes how application scope can be set up using app-scope configuration.

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.

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.

## Defining an AppScope Configuration

### Top-Level Attributes

The top-level attributes of an app-scope config define its apiVersion, kind, metadata, and spec.

| Attribute | Type | Required | Default Value | Description |
|-----------|------|----------|---------------|-------------|
| `apiVersion` | `string` | Y || The API version of the specification in use. At present only `core.hydra.io/v1alpha1` is defined. |
| `kind` | `string` | Y || The string `AppScopeConfiguration` |
| `metadata` | [`Metadata`](#metadata) | Y | | AppScope configuration metadata. |
| `spec`| [`Spec`](#spec) | Y || A container for exposing configuration attributes. |

### Metadata

Metadata describes this trait. The metadata section is defined in [Section 3](3.component_model.md#metadata).


### Spec
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.

| Attribute | Type | Required | Default Value | Description |
|-----------|------|----------|---------------|-------------|
| `appScopeType` | `string` | Y | | The type of the app-scope to create an instance of. |
| `properties` | [`Properties`](#properties) | N | | The properties attached to this scope. |

### Properties

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.

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.

## Example
The following is an example of a complete YAML file that illustrates the configurational elements above:

```yaml
apiVersion: core.hydra.io/v1alpha1
kind: AppScopeConfiguration
metadata:
name: public-vpc
spec:
appScopeType: core.hydra.io/v1alpha1.Network
properties:
- name: network-id
value: myNetwork
- name: subnet-id
value: public-subnet
- name: gateway-type
value: public

---
apiVersion: core.hydra.io/v1alpha1
kind: AppScopeConfiguration
metadata:
name: private-vpc
spec:
appScopeType: core.hydra.io/v1alpha1.Network
properties:
- name: network-id
value: myNetwork
- name: subnet-id
value: private-subnet
- name: gateway-type
value: nat
```

0 comments on commit b644981

Please sign in to comment.