Chapter 5
Adapters are where profile demand becomes platform action.
A valid profile is still just a requirements document. The adapter is the platform-specific component that decides how those requirements are satisfied and wired into the workload.
Adapter responsibility
- 1Read a valid profile.The adapter starts from Conditions and their declared `configuration.env` inputs.
- 2Validate against platform context.In the demo, API Conditions are checked against a catalog OpenAPI document.
- 3Invoke provider interfaces.For Redis, the adapter emits a platform-owned resource request with resolved inputs.
- 4Bind platform values.The adapter maps profile env names to service URLs and generated resource addresses.
- 5Render workload deployment.The final Deployment contains target-specific references, but the profile remains target-neutral.
Adapter input: a profile Condition
The adapter is not guessing from the application source. It receives the generated profile and interprets Conditions that have already passed validation.
- 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
Adapter step: choose platform values for profile properties
The Redis Promise owns Redis provisioning. The adapter emits a Redis request and satisfies profile properties from the generated service address.
emitted.append(redis_request(redis_name, namespace, name))
redis_host = f"{redis_name}.{namespace}.svc.cluster.local"
env.extend(
[
{"name": "REDIS_URL", "value": f"redis://{redis_host}:6379"},
{"name": "REDIS_HOST", "value": redis_host},
{"name": "REDIS_PORT", "value": "6379"},
]
)
Adapter step: validate API compatibility before deployment
The API Condition declares `GET /todos/{id}` and an expected response shape. The adapter compares that requirement with the catalog OpenAPI document before creating the workload.
for condition in conditions:
if condition.get("kind") != "api":
continue
api = validate_api_condition(condition, apis)
env_name = api_url_env_name(condition.get("name") or api.name)
base_url = api.base_url or f"http://{api.name}.{namespace}.svc.cluster.local:{port}"
env.append({"name": env_name, "value": base_url})
Adapter step: call platform interfaces, not invent a second profile
The adapter should trigger existing provider interfaces directly. In this demo those interfaces are Kratix Promises. The important boundary is that the adapter is not creating another Runtime Conditions document between itself and the Promise.
| Profile Requirement | Adapter Calls | Provider Owns |
|---|---|---|
| `kind: cache`, `engine: redis` | Redis Promise interface | Redis Deployment and Service |
| `kind: api`, `interface.type: http` | API catalog validation | Catalog-owned OpenAPI document and base URL |
| `ApplicationRelease` request | Kubernetes workload renderer | Deployment and Service for the application |
Provider request: Redis custom resource
The adapter asks the platform for Redis by emitting the provider-owned resource. The profile declares `kind: cache`; the platform decides what Redis means in the cluster.
apiVersion: platform.demoteam.io/v1alpha1
kind: Redis
metadata:
name: request-logger-cache
namespace: demo
labels:
kratix.io/component-of-promise-name: application-release
spec:
size: small
Final workload binding
This is where the profile's environment variable names meet platform-provided values. The application still reads the same env vars it declared in source.
env:
- name: TODOS_API_URL
value: http://todos-api.demo.svc.cluster.local:8080
- name: REDIS_URL
value: redis://request-logger-cache.demo.svc.cluster.local:6379
- name: REDIS_HOST
value: request-logger-cache.demo.svc.cluster.local
- name: REDIS_PORT
value: "6379"
Boundary summary
| Component | Owns | Does Not Own |
|---|---|---|
| Generator | Source-to-profile extraction. | Provisioning, deployment, target values. |
| Adapter | Profile interpretation for one platform. | Extension vocabulary or provider internals. |
| Promise | Concrete provider implementation. | Application source analysis or profile generation. |