Skip to content

Latest commit

 

History

History
140 lines (109 loc) · 4.89 KB

CONTRIBUTING.md

File metadata and controls

140 lines (109 loc) · 4.89 KB

Contributing to Nuclio Templates

Values file

The values file consists of a collection of "field descriptors" to be rendered in Nuclio UI in the "Template parameters" dialog.

The root of the file is a dictionary.
For each parameter defined in the template YAML, i.e. {{ .paramName }}, there should be a key in the root dictionary, i.e. paramName.

For example, for the following template:

metadata:
  name: my-function-template
spec:
  minReplicas: {{ .ParamName1 }}
  maxReplicas: {{ .ParamName2 }}

the values should look like:

ParamName1:
    # field descriptor for paramName1
ParamName2:
    # field descriptor for paramName2

Note: having duplicate keys in the dictionary implies invalid YAML, but nevertheless if somehow the Nuclio UI receives such duplicates it will consider the first one only and skip the rest.

Field descriptor

The field descriptor is a dictionary that consists of:

So the basic structure is as follows:

SomeParamName:
  commonProperty1: value1
  commonProperty2: value2
  attribtues:
    kindSpecificProperty1: value3
    kindSpecificProperty2: value4

Common properties

Property Type Required? Defaults to Description
kind string Yes - The type of UI component to render. See table below with available values.
displayName string Yes - The label of the field.
description string No '' Concise explanation to the user on the meaning of this field, how to use it, its effects, etc.
In case it is provided and not empty, a question mark icon will be displayed to the right of the field's label and on hovering it a tooltip will be displayed with this property's value.
required boolean No false Set to true to prevent the form from submitting while this field is empty.
order number No - Determine the order by which the fields should be listed. All fields that has no or empty order will be displayed together in some indeterminate order after the rest of the (ordered) fields.

All other properties at root level will be ignored.

Kinds

Kind UI component
'string' single-line text-box
'number' number input box (with increment/decrement arrows)
'choice' drop-down menu (choose one of many)

Kind-specific properties

The set of properties nested in attributes is determined by the kind value.
Below are lists of the relevant properties to each of the different kinds of fields.
All other properties nested in attribtues will be ignored.

string
Property Type Required? Defaults to Description
defaultValue string No '' The initial value.
maxLength number No - The maximum number of characters to allow.
password boolean No false Set to true to obscure the entered characters.

Example:

Table:
  displayName: Table name
  kind: string
  description: "Name of target table"
  required: true
  attributes:
    defaultValue: table
    maxLength: 128

image

number
Property Type Required? Defaults to Description
defaultValue number No '' The initial value.
minValue number No - The minimal valid value.
maxValue number No - The maximum valid value.
step number No 1 The number to add to/subtract from the current value when clicking on the up/down arrows, respectively.
allowNegative boolean No false Set to true to allow entering negative values. If not true and minValue is set to a negative value, then minValue will automatically be set to 0 instead.

Example:

IgzV3fPort:
  displayName: v3io-frames port
  kind: number
  description: "v3io-frames endpoint port"
  required: true
  attributes:
    defaultValue: 8081
    minValue: 5000
    maxValue: 99999

image

choice
Property Type Required? Defaults to Description
choices list of strings Yes - The options in the drop-down menu.
defaultValue string No '' The initial value of the field. Should match one of the strings in choices list. If not, a "Please select…" placeholder will be displayed.

Example:

TargetLang:
  displayName: Target language
  kind: choice
  description: "Target language for translation (e.g. he, fr)"
  required: true
  attributes:
    choices: [fr, he, es, it, ru]
    defaultValue: fr

image