Skip to content

Commit 796c85f

Browse files
fix(docs-447): clarify the use of shared app values from Score workloads (#98)
Co-authored-by: Tobias Babin <[email protected]> Co-authored-by: Tobias Babin <[email protected]>
1 parent 1cdab17 commit 796c85f

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

score/environment-variables/README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,36 @@ Define environment variables for a container. There are two ways to configure th
22

33
1. Via the Score file
44

5-
This definition supports [placeholders](https://developer.humanitec.com/platform-orchestrator/reference/placeholders/). By default, variables will be visible in the Platform Orchestrator UI. Variables will be mapped into the container through a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) or [Secret](https://kubernetes.io/docs/concepts/configuration/secret/).
5+
The Score specification supports [placeholder references](https://docs.score.dev/docs/score-specification/score-spec-reference/#placeholder-references) to the Workload metadata or Resources named in the Score file. The syntax and supported values are different in Score compared to the Platform Orchestrator, and the Platform Orchestrator will automatically convert Score references to native [placeholders](https://developer.humanitec.com/platform-orchestrator/reference/placeholders/) when deploying a Score file. Variables will be mapped into the container through a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) or [Secret](https://kubernetes.io/docs/concepts/configuration/secret/).
66

7-
2. Via the Score extension file
7+
The Platform Orchestrator supports an `environment` resource for accessing the shared values in the application environment:
8+
9+
```yaml
10+
apiVersion: score.dev/v1b1
11+
metadata:
12+
name: example
13+
containers:
14+
main:
15+
image: example
16+
variables:
17+
KEY_ONE: hello-world
18+
KEY_TWO: ${resources.env.VALUE}
19+
resources:
20+
env:
21+
type: environment
22+
```
23+
24+
2. Via the Score extensions file
25+
26+
Score extensions files contain Platform Orchestrator specific content allowing the workload profile or deployment options to be configured along with overrides to the resulting workloads. The Score extensions file supports the use of Score [placeholder references](https://docs.score.dev/docs/score-specification/score-spec-reference/#placeholder-references) and native [placeholders](https://developer.humanitec.com/platform-orchestrator/reference/placeholders/) when escaped with a `$`.
27+
28+
```yaml
29+
apiVersion: humanitec.org/v1b1
30+
spec:
31+
containers:
32+
main:
33+
variables:
34+
KEY_THREE: $${values.VALUE}
35+
KEY_FOUR: goodbye
36+
```
837

9-
This definition does not support [placeholders](https://developer.humanitec.com/platform-orchestrator/reference/placeholders/). By default, variables will not be visible in the Platform Orchestrator UI. Variables will be mapped into the container as part of the container specification.

score/environment-variables/humanitec.score.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ apiVersion: humanitec.org/v1b1
33
spec:
44
containers:
55
demo:
6-
env:
7-
- name: "SOME"
8-
value: "VARIABLE"
6+
variables:
7+
SOME: VARIABLE
8+
SHARED_VALUE: $${values.SOMETHING}

0 commit comments

Comments
 (0)