본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Schema (스키마)

원문 보기 위키 갱신

KEDA가 제3자 사용을 위해 제공하는 스케일러 스키마 파일(scalers-schema.yaml/scalers-schema.json)과 그 구조, 그리고 스키마를 생성하는 방법을 설명하는 문서예요. 스키마 파일은 스케일러 리팩터링에 맞춰 계속 갱신돼요.

출처: 문서

본문

스케일러 스키마 (Scaler Schema)

KEDA는 제3자 사용을 위한 별도의 스케일러 스키마(scalers-schema.yaml/scalers-schema.json)를 제공해요. 이 스키마 파일은 스케일러의 리팩터링에 맞춰 계속 갱신돼요.

*참고: 스키마 파일에는 아직 일부 스케일러가 빠져 있어요. 모든 스케일러가 새로운 선언형 스케일러 설정을 사용하도록 리팩터링되면 완성될 예정이에요.

스펙 (Specification)

다음은 스케일러의 스키마예요.

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
        ...

메타데이터 필드 속성의 세부 내용은 다음과 같아요.

| | Property | Description | | name | the name of the field | | type | type is the variable type of the field | | optional | optional is a boolean that indicates if the field is optional | | default | default is the default value of the field | | allowedValue | allowedValue is a list of allowed values for the field | | deprecated | deprecated is a string that indicates if the field is deprecated | | deprecatedAnnounce | deprecatedAnnounce is a string that indicates the deprecation message | | separator | separator is the symbol that separates the value of the field if the value is a list string | | exclusiveSet | exclusiveSet is a list of fields that are exclusive with the field | | rangeSeparator | rangeSeparator is the symbol that indicates the range of the field | | metadataVariableReadable | metadataVariableReadable is a boolean that indicates if the field can be read from the environment | | envVariableReadable | envVariableReadable is a boolean that indicates if the field can be read from the environment | | triggerAuthenticationVariableReadable | triggerAuthenticationVariableReadable is a boolean that indicates if the field can be read from the trigger authentication |

생성 (Generation)

스케일러 스키마를 생성하는 방법은 두 가지예요.

  • schema 폴더의 Go 파일을 직접 실행하기
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.
  • 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/"

더 알아보기 (Learn more)

스키마 파일은 스케일러마다 어떤 메타데이터 필드를 받는지, 각 필드가 선택 값인지·기본값은 무엇인지 등을 표준화된 형태로 알려 주는 구조예요. 타사 도구에서 KEDA 스케일러 구성을 검증하거나 자동 생성할 때 유용하게 활용할 수 있답니다.