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

One app, one cache Condition
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

The top-level fields of the profile above full draft
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
PartWhat it says
apiVersion, kindWhich kind of document this is.
metadataThe profile's name.
workloadWhich app it describes: where it comes from and its version.
extensionsWhere the words used in the conditions come from.
conditionsThe list of needs.

Condition shape

Core owns structure; extensions own values
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
PartWhat it says
nameAn optional name for the need, such as request-cache.
kindWhat sort of thing is needed, such as a cache.
interfaceHow the app talks to it, such as key_value with the engine redis.
configurationWhich environment variables the app reads. An extension owns this field, not the core.

Extension declaration

A profile declares every vocabulary source it uses
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.

WayWho writes itGood for
From your codeA profiler, from the declarations in your codeKeeping the profile in step with the code, in Go, Java, Python, or TypeScript
By handYouA quick start, or an app in a language without a profiler yet
By an agentAn AI agent or another toolDrafting 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.

  1. 1
    Structural validationRequired fields, types, nulls, duplicate keys.
  2. 2
    Extension resolutionEvery extension the profile declares can be found.
  3. 3
    Dependency resolutionThe extensions they depend on are found too, with no cycles.
  4. 4
    Vocabulary validationEvery kind, interface type, field, and value is defined by an extension, and no two definitions clash.
  5. 5
    Schema 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.