Chapter 2
What a profile looks like.
A profile is one YAML file with a few fixed fields. The words you put in them, such as cache, redis, and aws.s3, come from extensions.
A complete profile
apiVersion: runtimeconditions.io/v1alpha1
kind: RuntimeConditionsProfile
metadata:
name: request-logger-http
workload:
uri: github.com/runtimeconditions/rc-demos/apps/request-logger-http
version: v0.1.0
extensions:
- https://runtimeconditions.io/extensions/rc/common-integrations:v1alpha2
- https://runtimeconditions.io/extensions/rc/env-configuration:v1alpha2
conditions:
- name: request-cache
kind: cache
interface:
type: key_value
engine: redis
configuration:
alternatives:
- env:
- property: url
name: REDIS_URL
- env:
- property: hostname
name: REDIS_HOST
- property: port
name: REDIS_PORT
This profile says that the request logger needs a Redis cache, and that it reads where to find it from REDIS_URL, or from REDIS_HOST and REDIS_PORT. It does not say where Redis runs or what its password is. The platform decides that. Wondering how a profile like this is generated? See Code to profile. The sections below take it apart.
Envelope
apiVersion: runtimeconditions.io/v1alpha1
kind: RuntimeConditionsProfile
metadata:
name: request-logger-http
workload:
uri: github.com/runtimeconditions/rc-demos/apps/request-logger-http
version: v0.1.0
extensions:
# the words the conditions use, see Extension declaration
conditions:
# the needs, see Condition shape
| Part | What it says |
|---|---|
apiVersion, kind | Which kind of document this is. |
metadata | The profile's name. |
workload | Which app it describes: where it comes from and its version. |
extensions | Where the words used in the conditions come from. |
conditions | The list of needs. |
Condition shape
conditions:
- name: request-cache # an optional name
kind: cache # a core field, with a value from an extension
interface:
type: key_value # a core field, with a value from an extension
engine: redis # a field an extension owns
configuration: # a field an extension owns
alternatives: ... # REDIS_URL, or REDIS_HOST and REDIS_PORT
| Part | What it says |
|---|---|
name | An optional name for the need, such as request-cache. |
kind | What sort of thing is needed, such as a cache. |
interface | How the app talks to it, such as key_value with the engine redis. |
configuration | Which environment variables the app reads. An extension owns this field, not the core. |
Extension declaration
extensions:
- https://runtimeconditions.io/extensions/rc/common-integrations:v1alpha2
- https://runtimeconditions.io/extensions/rc/env-configuration:v1alpha2
The first gives the words cache, key_value and redis, and the second gives configuration. An extension from another company is declared the same way, by its id, as in the AWS Object Store example.
How a profile gets made
There are three ways. However it is made, the same check applies: rc profile validate profile.yaml tests it against the core and the extensions it declares.
| Way | Who writes it | Good for |
|---|---|---|
| From your code | A profiler, from the declarations in your code | Keeping the profile in step with the code, in Go, Java, Python, or TypeScript |
| By hand | You | A quick start, or an app in a language without a profiler yet |
| By an agent | An AI agent or another tool | Drafting a profile for an app that already exists |
Validation order
A validator checks a profile, and it always works in this order. In rc the validator is rc profile validate: see Validate any profile in the rc CLI chapter. The specification gives the order in section 8, Validation, and what a validator must do in section 9.4, Validator conformance.
- 1Structural validationRequired fields, types, nulls, duplicate keys.
- 2Extension resolutionEvery extension the profile declares can be found.
- 3Dependency resolutionThe extensions they depend on are found too, with no cycles.
- 4Vocabulary validationEvery kind, interface type, field, and value is defined by an extension, and no two definitions clash.
- 5Schema validationThe JSON Schemas of the extensions pass.
What never belongs in the profile
- Secret valuesAccess keys, tokens, passwords, and private material stay out.
- Target choicesBucket names, service names, cloud accounts, and cluster topology stay out.
- Provisioning instructionsThe profile declares requirements. Adapters and platforms provision or bind resources.