BOSH Variables

How Quarks Operator interpolates BOSH variables.

BOSH releases consume two types of variables, explicit and implicit ones.

Implicit Variables

Implicit variables have to be created before creating a BOSH deployment resource. The example creates a secret named var-custom-password. That value will be used to fill ((custom-password)) place holders in the BOSH manifest.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
apiVersion: v1
kind: Secret
metadata:
  name: var-custom-password
type: Opaque
stringData:
  password: a-custom-password
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: nats-manifest
data:
  manifest: |
    ---
    name: nats-deployment
    releases:
    - name: nats
      version: "33"
      url: docker.io/cfcontainerization
      stemcell:
        os: SLE_15_SP1
        version: 26.1-7.0.0_374.gb8e8e6af
    instance_groups:
    - name: nats
      instances: 1
      jobs:
      - name: nats
        release: nats
        properties:
          nats:
            user: admin
            password: ((custom_password))
    variables:
    - name: custom_password
      type: password
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: ops-scale
data:
  ops: |
    - type: replace
      path: /instance_groups/name=nats?/instances
      value: 2
---
apiVersion: quarks.cloudfoundry.org/v1alpha1
kind: BOSHDeployment
metadata:
  name: nats-deployment
spec:
  manifest:
    name: nats-manifest
    type: configmap
  ops:
  - name: ops-scale
    type: configmap
Complete source code: https://github.com/cloudfoundry-incubator/quarks-operator/blob/master/docs/examples/bosh-deployment/boshdeployment-with-custom-variable.yaml

The name of the secret has to follow this scheme: ‘var-

Missing implicit variables are treated as an error.

Explicit Variables

Explicit variables are explicitly defined in the BOSH manifest. They are generated automatically upon deployment and stored in secrets.

The naming scheme is the same as for implicit variables.

If an explicit variable secret already exists, it will not be generated. This allows users to set their own passwords, etc.