1.2.2.2. 确定 Kamelet 的配置参数

在 Kamelet Binding 中,当您为 Kamelet 添加引用时,您可以指定 Kamelet 的名称,并配置 Kamelet 的参数。

前提条件

  • 您在工作命名空间中或集群安装了 Camel K Operator。

流程

要确定 Kamelet 的名称和参数:

  1. 在终端窗口中,登录您的 OpenShift 集群。
  2. 打开 Kamelet 的 YAML 文件:

    oc describe kamelets/<kamelet-name>

    例如,查看 ftp-source Kamelet 的代码(如果已在当前命名空间中安装了 Camel K operator),请使用以下命令:

    oc describe kamelets/ftp-source

    如果 Camel K Operator 以 cluster-mode 的形式安装,则使用以下命令:

    oc describe -n openshift-operators kamelets/ftp-source

  3. 在 YAML 文件中,向下滚动到 spec.definition 部分(使用 JSON-schema 格式写入),以查看 Kamelet 的属性列表。在部分末尾,required 字段列出了在引用 Kamelet 时必须配置的属性。

    例如,以下代码是 ftp-source Kamelet 的 spec.definition 部分的摘录。本节详细介绍了 Kamelet 的所有配置属性。此 Kamelet 的必要属性是 connectionHostconnectionPortusernamepassworddirectoryName

    spec:
      definition:
        title: "FTP Source"
        description: |-
          Receive data from an FTP Server.
        required:
          - connectionHost
          - connectionPort
          - username
          - password
          - directoryName
        type: object
        properties:
          connectionHost:
            title: Connection Host
            description: Hostname of the FTP server
            type: string
          connectionPort:
            title: Connection Port
            description: Port of the FTP server
            type: string
            default: 21
          username:
            title: Username
            description: The username to access the FTP server
            type: string
          password:
            title: Password
            description: The password to access the FTP server
            type: string
            format: password
            x-descriptors:
            - urn:alm:descriptor:com.tectonic.ui:password
          directoryName:
            title: Directory Name
            description: The starting directory
            type: string
          passiveMode:
            title: Passive Mode
            description: Sets passive mode connection
            type: boolean
            default: false
            x-descriptors:
            - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
          recursive:
            title: Recursive
            description: If a directory, will look for files in all the sub-directories as well.
            type: boolean
            default: false
            x-descriptors:
            - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
          idempotent:
            title: Idempotency
            description: Skip already processed files.
            type: boolean
            default: true
            x-descriptors:
            - 'urn:alm:descriptor:com.tectonic.ui:checkbox'