Schema Latest

Specification & generation of KEDA scalers' schema

Suggest a change

Scaler Schema

KEDA provides a separate scaler’s schema for third-party usage (scalers-metadata-schema.yaml/scalers-metadata-schema.json). The schema file will keep updating according to the scaler’s refactor.

*Notice: The schema file still lacks some of the scalers. It will be completed once all scalers are refactored to use the new declarative scaler config.

Specification

Here is a the schema of the scalers:

kedaVersion: main 
schemaVersion: 1
scalers:
    - type: activemq
      parameters:
        - name: managementEndpoint
          type: string
          optional: true
          metadataVariableReadable: true
        - name: destinationName
          type: string
          optional: true
          metadataVariableReadable: true
        - name: brokerName
          type: string
          optional: true
          metadataVariableReadable: true
        - name: username
          type: string
          metadataVariableReadable: true
          envVariableReadable: true
          triggerAuthenticationVariableReadable: true
        - name: password
          type: string
          metadataVariableReadable: true
          envVariableReadable: true
          triggerAuthenticationVariableReadable: true
        - name: corsHeader
          type: string
          optional: true
          metadataVariableReadable: true
        - name: restAPITemplate
          type: string
          optional: true
          metadataVariableReadable: true
        - name: targetQueueSize
          type: string
          default: "10"
          metadataVariableReadable: true
        - name: activationTargetQueueSize
          type: string
          default: "0"
          metadataVariableReadable: true
    - type: apache-kafka
      parameters:
        - name: bootstrapServers
        ...

Metadata field’s property detail:

PropertyDescription
namethe name of the field
typetype is the variable type of the field
optionaloptional is a boolean that indicates if the field is optional
defaultdefault is the default value of the field
allowedValueallowedValue is a list of allowed values for the field
deprecateddeprecated is a string that indicates if the field is deprecated
deprecatedAnnouncedeprecatedAnnounce is a string that indicates the deprecation message
separatorseparator is the symbol that separates the value of the field if the value is a list string
exclusiveSetexclusiveSet is a list of fields that are exclusive with the field
rangeSeparatorrangeSeparator is the symbol that indicates the range of the field
metadataVariableReadablemetadataVariableReadable is a boolean that indicates if the field can be read from the environment
envVariableReadableenvVariableReadable is a boolean that indicates if the field can be read from the environment
triggerAuthenticationVariableReadabletriggerAuthenticationVariableReadable is a boolean that indicates if the field can be read from the trigger authentication

Generation

There are two ways to generate scaler schemas:

  1. Run the GO file in the schema folder directly
go run schema/generate_scaler_schema.go
parameters:
  --keda-version string                Set the version of current KEDA in schema. (default "1.0")
  --kubeconfig string                  Paths to a kubeconfig. Only required if out-of-cluster.
  --output-file-path string            scaler-metadata-schemas.yaml output file path. (default "./")
  --scalers-builder-file buildScaler   The file that exists buildScaler func. (default "../pkg/scaling/scalers_builder.go")
  --scalers-files-dir string           The directory that exists all scalers' files. (default "../pkg/scalers")
  --specify-scaler string              Specify scaler name.
  1. Use makefile
make  generate-scaler-schemas
env variables:
    OUTPUT_FILE_PATH          scaler-metadata-schemas.yaml output file path. (default "./")
    SCALERS_BUILDER_FILE   The file that exists buildScaler func. (default "../pkg/scaling/scalers_builder.go")
    SCALERS_FILES_DIR           The directory that exists all scalers' files. (default "../pkg/scalers")

SCALERS_BUILDER_FILE ?= “pkg/scaling/scalers_builder.go” SCALERS_FILES_DIR ?= “pkg/scalers” OUTPUT_FILE_PATH ?= “schema/”