Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 2.34 KB

03-60-pass-parameters.md

File metadata and controls

91 lines (72 loc) · 2.34 KB

Pass Parameters

You can set input parameters for your resources.

Procedure

To set input parameters, go to the spec of the ServiceInstance or ServiceBinding resource, and use both or one of the following fields:

  • parameters: Specifies a set of properties sent to the service broker. The specified data is passed to the service broker without any modifications - aside from converting it to the JSON format for transmission to the broker if the spec field is specified as a YAML file. All valid YAML or JSON constructs are supported.

    [!NOTE] Only one parameter field per spec can be specified.

  • parametersFrom: Specifies which Secret, together with the key in it, to include in the set of parameters sent to the service broker. The key contains a string that represents a JSON file. The parametersFrom field is a list that supports multiple sources referenced per spec.

If you specified multiple sources in the parameters and parametersFrom fields, the final payload results from merging all of them at the top level.

If there are any duplicate properties defined at the top level, the specification is considered to be invalid. The further processing of the ServiceInstance or ServiceBinding resource stops with the status Error.

Examples

See the following examples:

  • The spec format in YAML:

    spec:
      ...
      parameters:
        name: value
      parametersFrom:
        - secretKeyRef:
            name: {SECRET_NAME}
            key: secret-parameter
  • The spec format in JSON:

    {
      "spec": {
        "parameters": {
          "name": "value"
        },
        "parametersFrom": {
          "secretKeyRef": {
            "name": "{SECRET_NAME}",
            "key": "secret-parameter"
          }
        }
      } 
    }
  • A Secret with the key named secret-parameter:

    apiVersion: v1
    kind: Secret
    metadata:
      name: {SECRET_NAME}
    type: Opaque
    stringData:
      secret-parameter:
        '{
          "password": "password"
        }'
  • The final JSON payload sent to the service broker:

    {
      "name": "value",
      "password": "password"
    }
  • Multiple parameters in the Secret with key-value pairs separated with commas:

    secret-parameter:
      '{
        "password": "password",
        "key2": "value2",
        "key3": "value3"
      }'