The following document describes the options for questions in .banzaicloud/spotguide.yaml. Based on the questions specified in this description a form will be rendered on the UI to ask for input from the users.

Types

The question specification is slightly different based on the type of it. The type can be pipeline, secret or bucket.

Pipeline

In this case the targets will be merged into the pipeline.yaml file.

Variable Type Required Default Description
label string true The label of the input
type 'pipeline' true The type of the input
required boolean false false The input is required or not
dataType 'string' or 'boolean' or 'number' or 'enum' true Data type of the data
controlType 'code' when type is string false Specific control type for the data, to customize UI element
placeholder string false Placeholder text
description string false Input description, hint
default string or boolean or number false Default value
options string[] or boolean[] or number[] true when dataType is 'enum' Available options when dataType is 'enum'
minLength number false Minimum length of the value
maxLength number false Maximum length of the value
min number false Minimum value
max number false Maximum value
pattern string false Regular expression to validate the value
disabled string false false Disable the input
hidden string false false Hide the input
showIf object false JSON schema to conditionally show or hide the input
group string false The group name of the input
targets string[] false Path of object in pipeline.yaml (see lodash.set)

Examples

Annotation:

# spotguide.yaml
questions:
- type: pipeline
  dataType: enum
  group: Ingress annotations
  label: Enable CORS
  default: "false"
  options:
    - "true"
    - "false"
  targets:
    - deploy_application.deployment.values.ingress.annotations["nginx.ingress.kubernetes.io/enable-cors"]

# pipeline.yaml
deploy_application:
  # ...
  image: banzaicloud/ci-pipeline-client:0.7
  action: EnsureDeployment
  deployment:
    # ...
    values:
      ingress:
        annotations: {}

annotation

annotation

Optionally customize application resources:

# spotguide.yaml
questions:
- type: pipeline
  key: application_resources
  group: Resources
  dataType: boolean
  label: Customize application resources
  default: false
  order: 1
- type: pipeline
  dataType: string
  label: Memory request
  default: 256Mi
  group: Resources
  pattern: ^\d+(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)?$
  description: Minimum amount of memory the Node.js container needs
  required: true
  order: 2
  targets:
    - deploy_application.deployment.values.application.deployment.resources.requests.memory
  showIf:
    properties:
      application_resources:
        const: true
- type: pipeline
  dataType: string
  label: Memory limit
  default: 512Mi
  group: Resources
  pattern: ^\d+(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)?$
  description: Maximum amount of memory the Node.js container can use
  required: true
  order: 3
  targets:
    - deploy_application.deployment.values.application.deployment.resources.limits.memory
  showIf:
    properties:
      application_resources:
        const: true
- type: pipeline
  dataType: string
  label: CPU request
  default: 500m
  group: Resources
  pattern: ^\d+(\.?\d+|m)?$
  description: Minimum amount of CPU the Node.js container needs
  required: true
  order: 4
  targets:
    - deploy_application.deployment.values.application.deployment.resources.requests.cpu
  showIf:
    properties:
      application_resources:
        const: true
- type: pipeline
  dataType: string
  label: CPU limit
  default: 1000m
  group: Resources
  pattern: ^\d+m$
  description: Maximum amount of CPU the Node.js container can use
  required: true
  order: 5
  targets:
    - deploy_application.deployment.values.application.deployment.resources.limits.cpu
  showIf:
    properties:
      application_resources:
        const: true

# pipeline.yaml
deploy_application:
  # ...
  image: banzaicloud/ci-pipeline-client:0.7
  action: EnsureDeployment
  deployment:
    # ...
    values:
      application:
        deployment: {}

resources

resources

Secret

In this case a secret selector is shown, existing secret can be selected or a new one created.

Variable Type Required Default Description
label string true The label of the input
type 'secret' true The type of the input
name string true Default name of the secret when creating a new one
required boolean or object false false The input is required or not
dataType 'password' or 'htpasswd' or 'tls' true Data type of the data
placeholder string or object false Placeholder text
description string or object false Input description, hint
default object false Default value
tags string[] false Secret tags
disabled object false false Disable the input
showIf object false JSON schema to conditionally show or hide the input
group string false The group name of the input
targets object[] false Path of object in pipeline.yaml (see lodash.set)

Examples

Username and password secret & reference in Helm values:

# spotguide.yaml
questions:
- type: secret
  dataType: password
  name: mongodb
  group: MongoDB
  required:
    username: true # set the username required
    # password defaults to false, will be generated when empty
  default:
    username: username # set a default for username
  tags:
    - app:mongodb
  targets:
    # - source: target is the format; source can be username, password or name
    - name: install_mongodb_user_secret.clusterSecret.sourceSecretName

# pipeline.yaml
install_mongodb_user_secret:
  # ...
  image: banzaicloud/ci-pipeline-client:0.7
  action: InstallSecret
  clusterSecret:
    # sourceSecretName:
    name: "{{ .CICD_REPO }}-mongodb"
    namespace: default
    merge: true
    spec:
      - name: mongodb-username
        source: username
      - name: mongodb-password
        source: password

password

Bucket

In this case a secret selector is shown, existing bucket can be selected or a new one created.

Variable Type Required Default Description
label string true The label of the input
type 'bucket' true The type of the input
name string true Default name of the bucket when creating a new one
required boolean or object false false The input is required or not
placeholder string or object false Placeholder text
description string or object false Input description, hint
default object false Default value
disabled string or object false false Disable the input
hidden string or object false false Hide the input
showIf object false JSON schema to conditionally show or hide the input
group string false The group name of the input
targets or object[] false Path of object in pipeline.yaml (see lodash.set)

Examples

Bucket information in Helm values:

# spotguide.yaml
questions:
- type: bucket
  name: artifact-store
  targets:
    # - source: target is the format; source can be name, secret.id, secret.name, cloud
    - name: deploy_application.deployment.values.artifacts.bucket
    - cloud: deploy_application.deployment.values.artifacts.cloud
    - secret.name: deploy_application.deployment.values.artifacts.secret

# pipeline.yaml
deploy_application:
  # ...
  image: banzaicloud/ci-pipeline-client:0.7
  action: EnsureDeployment
  deployment:
    # ...
    values:
      artifacts: {}

bucket

bucket

If Create new is selected, a bucket creation modal will be shown:

bucket