跳转到: 导航, 搜索

Murano/Documentation/DynamicUI

< Murano‎ | 文档

动态 UI 定义规范

Version: 3

Templates:
  primaryController:
    ?:
      type: io.murano.windows.activeDirectory.PrimaryController
    host:
      ?:
        type: io.murano.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage
      assignFloatingIp: $.serviceConfiguration.assignFloatingIP

  secondaryController:
    ?:
      type: io.murano.windows.activeDirectory.SecondaryController
    host:
      ?:
        type: io.murano.services.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, $index + 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage

  secondaryControllerOutput:
    - label: concat('#', $index)
      value:
        - label: Host Name
          value: $.secondaryControllers[$index].host.name
        - label: Flavor
          value: $.secondaryControllers[$index].host.flavor
        - label: Image
          value: $.secondaryControllers[$index].host.image
        - label: Floating IP
          value: $.secondaryControllers[$index].host.floatingIp
    

Application:
  ?:
    type: io.murano.windows.activeDirectory.ActiveDirectory
  name: $.serviceConfiguration.name
  primaryController: $primaryController
  secondaryControllers: repeat($secondaryController, $.serviceConfiguration.dcInstances - 1)

Output:
  - label: Domain Name
    value: $.name
  - label: Primary Controller
    value:
      - label: Host Name
        value: $.primaryController.host.name
      - label: Flavor
        value: $.primaryController.host.flavor
      - label: Image
        value: $.primaryController.host.image
      - label: Floating IP
        value: $.primaryController.host.floatingIp
  - label: Secondary Controllers
    value: repeat($.secondaryControllerOutput, len($.secondaryControllers))
  
Input:
  - serviceConfiguration:
      fields:
        - name: name
          type: string
          label: Domain Name
          description: >-
            Enter a desired name for a new domain. This name should fit to
            DNS Domain Name requirements: it should contain
            only A-Z, a-z, 0-9, (.) and (-) and should not end with a dash.
            DNS server will be automatically set up on each of the Domain
            Controller instances. Note: Only first 15 characters or characters
            before first period is used as NetBIOS name.
          validators:
            - expr:
                minLength: 2
                maxLength: 255
            - expr:
                regexp: '^([0-9A-Za-z]|[0-9A-Za-z][0-9A-Za-z-]*[0-9A-Za-z])\.[0-9A-Za-z][0-9A-Za-z-]*[0-9A-Za-z]$'
              message: >-
                Only letters, numbers and dashes in the middle are
                allowed. Period characters are allowed only when they
                are used to delimit the components of domain style
                names. Single-level domain is not
                appropriate. Subdomains are not allowed.
            - expr:
                regexp: '(^[^.]+$|^[^.]{1,15}\..*$)'
              message: >-
                NetBIOS name cannot be shorter than 1 symbol and
                longer than 15 symbols.
            - expr:
                regexp: '(^[^.]+$|^[^.]*\.[^.]{2,63}.*$)'
              message: >-
                DNS host name cannot be shorter than 2 symbols and
                longer than 63 symbols.
          helpText: >-
            Just letters, numbers and dashes are allowed.
            A dot can be used to create subdomains
        - name: dcInstances
          type: integer
          label: Instance Count
          description: >-
            You can create several Active Directory instances by setting
            instance number larger than one. One primary Domain Controller
            and a few secondary DCs will be created.
          initial: 1
          helpText: Enter an integer value between 1 and 100
          validators:
            - expr:
                minValue: 1
                maxValue: 100
        - name: adminAccountName
          type: string
          label: Account Name
          initial: Administrator
          validators:
            - expr:
                regexp: '^[-\w]+$'
              message: Just letters, numbers, underscores and hyphens are allowed.
        - name: adminPassword
          type: password
          label: Administrator password
          descriptionTitle: Passwords
          description: >-
            Windows requires strong password for service administration.
            Your password should have at least one letter in each
            register, a number and a special character. Password length should be
            a minimum of 7 characters.

            Once you forget your password you won't be able to
            operate  the service until recovery password would be entered. So it's
            better for Recovery and Administrator password to be different.
        - name: recoveryPassword
          type: password
          label: Recovery password
        - name: assignFloatingIP
          required: false
          type: boolean
          label: Assign Floating IP
          description: >-
             Select to true to assign floating IP automatically to Primary DC
          initial: false
          required: false
        - name: disableNamingPattern
          required: false
          type: boolean
          label: Disable naming pattern
        - name: hideNamingPattern
          required: false
          type: boolean
          label: Hide naming pattern
        - name: unitNamingPattern
          type: string
          label: Hostname template
          description: >-
            For your convenience all instance hostnames can be named
            in the same way. Enter a name and use # character for incrementation.
            For example, host# turns into host1, host2, etc. Please follow Windows
            hostname restrictions.
          enabled: not $.serviceConfiguration.disableNamingPattern
          hidden: $.serviceConfiguration.hideNamingPattern
          required: false
          validators:
            - expr:
                # FIXME: does not work for # turning into 2-digit numbers
                regexp: '^(([a-zA-Z0-9#][a-zA-Z0-9-#]*[a-zA-Z0-9#])\.)*([A-Za-z0-9#]|[A-Za-z0-9#][A-Za-z0-9-#]*[A-Za-z0-9#])$'
            - expr:
                maxLength: 15
          helpText: Optional field for a machine hostname template
      validators:
        # if unitNamingPattern is given and dcInstances > 1, then '#' should occur in unitNamingPattern
        - expr: $.serviceConfiguration.dcInstances < 2 or not $.serviceConfiguration.unitNamingPattern.bool() or '#' in $.serviceConfiguration.unitNamingPattern
          message: Incrementation symbol "#" is required in the Hostname template
  - instanceConfiguration:
      fields:
        - name: flavor
          type: flavor
          label: Instance flavor
          description: >-
            Select registered in Openstack flavor. Consider that service performance
            depends on this parameter.
          required: false
        - name: osImage
          type: image
          imageType: windows
          label: Instance image
          description: >-
            Select valid image for a service. Image should already be prepared and
            registered in glance.
        - name: availabilityZone
          type: azone
          label: Availability zone
          description: Select availability zone where service would be installed.
          required: false
      title:
        label: Instance Configuration
        description: Specify some instance parameters on which service would be created.
Version: 3

Templates:
  primaryController:
    ?:
      type: io.murano.windows.activeDirectory.PrimaryController
    host:
      ?:
        type: io.murano.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage
      assignFloatingIp: $.serviceConfiguration.assignFloatingIP

  secondaryController:
    ?:
      type: io.murano.windows.activeDirectory.SecondaryController
    host:
      ?:
        type: io.murano.services.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, $index + 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage

  secondaryControllerOutput:
    - label: concat('#', $index)
      value:
        - label: Host Name
          value: $.secondaryControllers[$index].host.name
        - label: Flavor
          value: $.secondaryControllers[$index].host.flavor
        - label: Image
          value: $.secondaryControllers[$index].host.image
        - label: Floating IP
          value: $.secondaryControllers[$index].host.floatingIp
    

Application:
  ?:
    type: io.murano.windows.activeDirectory.ActiveDirectory
  name: $.serviceConfiguration.name
  primaryController: $primaryController
  secondaryControllers: repeat($secondaryController, $.serviceConfiguration.dcInstances - 1)

Output:
  - label: Domain Name
    value: $.name
  - label: Primary Controller
    value:
      - label: Host Name
        value: $.primaryController.host.name
      - label: Flavor
        value: $.primaryController.host.flavor
      - label: Image
        value: $.primaryController.host.image
      - label: Floating IP
        value: $.primaryController.host.floatingIp
  - label: Secondary Controllers
    value: repeat($.secondaryControllerOutput, len($.secondaryControllers))
  
Input:
  - serviceConfiguration:
      fields:
        - name: name
          type: string
          label: Domain Name
          description: >-
            Enter a desired name for a new domain. This name should fit to
            DNS Domain Name requirements: it should contain
            only A-Z, a-z, 0-9, (.) and (-) and should not end with a dash.
            DNS server will be automatically set up on each of the Domain
            Controller instances. Note: Only first 15 characters or characters
            before first period is used as NetBIOS name.
          validators:
            - expr:
                minLength: 2
                maxLength: 255
            - expr:
                regexp: '^([0-9A-Za-z]|[0-9A-Za-z][0-9A-Za-z-]*[0-9A-Za-z])\.[0-9A-Za-z][0-9A-Za-z-]*[0-9A-Za-z]$'
              message: >-
                Only letters, numbers and dashes in the middle are
                allowed. Period characters are allowed only when they
                are used to delimit the components of domain style
                names. Single-level domain is not
                appropriate. Subdomains are not allowed.
            - expr:
                regexp: '(^[^.]+$|^[^.]{1,15}\..*$)'
              message: >-
                NetBIOS name cannot be shorter than 1 symbol and
                longer than 15 symbols.
            - expr:
                regexp: '(^[^.]+$|^[^.]*\.[^.]{2,63}.*$)'
              message: >-
                DNS host name cannot be shorter than 2 symbols and
                longer than 63 symbols.
          helpText: >-
            Just letters, numbers and dashes are allowed.
            A dot can be used to create subdomains
        - name: dcInstances
          type: integer
          label: Instance Count
          description: >-
            You can create several Active Directory instances by setting
            instance number larger than one. One primary Domain Controller
            and a few secondary DCs will be created.
          initial: 1
          helpText: Enter an integer value between 1 and 100
          validators:
            - expr:
                minValue: 1
                maxValue: 100
        - name: adminAccountName
          type: string
          label: Account Name
          initial: Administrator
          validators:
            - expr:
                regexp: '^[-\w]+$'
              message: Just letters, numbers, underscores and hyphens are allowed.
        - name: adminPassword
          type: password
          label: Administrator password
          descriptionTitle: Passwords
          description: >-
            Windows requires strong password for service administration.
            Your password should have at least one letter in each
            register, a number and a special character. Password length should be
            a minimum of 7 characters.

            Once you forget your password you won't be able to
            operate  the service until recovery password would be entered. So it's
            better for Recovery and Administrator password to be different.
        - name: recoveryPassword
          type: password
          label: Recovery password
        - name: assignFloatingIP
          required: false
          type: boolean
          label: Assign Floating IP
          description: >-
             Select to true to assign floating IP automatically to Primary DC
          initial: false
          required: false
        - name: disableNamingPattern
          required: false
          type: boolean
          label: Disable naming pattern
        - name: hideNamingPattern
          required: false
          type: boolean
          label: Hide naming pattern
        - name: unitNamingPattern
          type: string
          label: Hostname template
          description: >-
            For your convenience all instance hostnames can be named
            in the same way. Enter a name and use # character for incrementation.
            For example, host# turns into host1, host2, etc. Please follow Windows
            hostname restrictions.
          enabled: not $.serviceConfiguration.disableNamingPattern
          hidden: $.serviceConfiguration.hideNamingPattern
          required: false
          validators:
            - expr:
                # FIXME: does not work for # turning into 2-digit numbers
                regexp: '^(([a-zA-Z0-9#][a-zA-Z0-9-#]*[a-zA-Z0-9#])\.)*([A-Za-z0-9#]|[A-Za-z0-9#][A-Za-z0-9-#]*[A-Za-z0-9#])$'
            - expr:
                maxLength: 15
          helpText: Optional field for a machine hostname template
      validators:
        # if unitNamingPattern is given and dcInstances > 1, then '#' should occur in unitNamingPattern
        - expr: $.serviceConfiguration.dcInstances < 2 or not $.serviceConfiguration.unitNamingPattern.bool() or '#' in $.serviceConfiguration.unitNamingPattern
          message: Incrementation symbol "#" is required in the Hostname template
  - instanceConfiguration:
      fields:
        - name: flavor
          type: flavor
          label: Instance flavor
          description: >-
            Select registered in Openstack flavor. Consider that service performance
            depends on this parameter.
          required: false
        - name: osImage
          type: image
          imageType: windows
          label: Instance image
          description: >-
            Select valid image for a service. Image should already be prepared and
            registered in glance.
        - name: availabilityZone
          type: azone
          label: Availability zone
          description: Select availability zone where service would be installed.
          required: false
      title:
        label: Instance Configuration
        description: Specify some instance parameters on which service would be created.

动态 UI 的主要目的是“即时”生成应用创建表单。Murano 控制面板不了解可以部署哪些应用,以及创建应用实例需要使用哪个 Web 表单。因此,所有应用定义都应包含一个 YAML 文件,该文件将告知控制面板如何创建应用以及应用哪些验证规则。本文档将帮助您为应用编写有效的 UI 定义。

结构

UI 定义应为有效的 YAML 文件,并应包含以下部分(适用于版本 2)

  • 版本 - 指示使用的语法版本,可选
  • 模板 - 可选,辅助部分,与应用部分一起使用,可选
  • 应用 - 用于应用部署的对象模型描述,必需
  • 表单 - Web 表单定义,必需

版本

支持的动态 UI 语法的版本。最新版本是 2。版本映射:Murano 0.4 - 版本 1 Murano 0.5 - 版本 2

应用和模板

在“应用”部分中描述了“应用对象模型”。该模型将被转换为 JSON,并且根据该 JSON 将部署应用。应用部分应包含 murano-engine 部署应用所需的所有必要键。请注意,在 ? 部分是模型的系统部分。您可以选择从用户处获取的参数(应在“表单”部分中描述),并选择应设置它们的正确位置。为此使用 YAQL。所有行都将检查 YAQL 表达式。因此,generateHostname 将被识别为 YAQL 函数,并生成机器主机名。

示例

 primaryController:
    ?:
      type: io.murano.windows.activeDirectory.PrimaryController
    host:
      ?:
        type: io.murano.services.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage

  secondaryController:
    ?:
      type: io.murano.windows.activeDirectory.SecondaryController
    host:
      ?:
        type: io.murano.services.windows.Host
      adminPassword: $.serviceConfiguration.adminPassword
      name: generateHostname($.serviceConfiguration.unitNamingPattern, $index + 1)
      flavor: $.instanceConfiguration.flavor
      image: $.instanceConfiguration.osImage

表单

本节描述 Django 表单。为您的表单设置名称,并提供字段和验证器。每个字段应包含

  • name - 系统字段名称,可以是任意名称
  • label - 将在表单中显示的名称
  • description - 将在表单描述区域中显示的描述。使用 YAML 行折叠字符 >- 以在数据传输期间保持正确的格式。
  • type - 系统字段类型
  • string - Django 字符串字段
  • boolean - Django 布尔字段
  • text - Django 文本字段
  • integer - Django 整数字段
  • password - 具有强密码验证的特定字段
  • clusterip - 特定字段,用于在部署期间使用集群 IP
  • floatingip - 特定字段,用于在部署期间启用浮动 IP
  • domain - 特定字段,用于 Active Directory 域
  • databaselist - 特定字段,数据库列表(逗号分隔的数据库名称列表,每个名称的语法如下:第一个符号应为拉丁字母或下划线;后续符号可以是拉丁字母、数字、下划线、@ 符号、# 符号或 $ 符号)
  • table - 特定字段,用于在表单中定义表
  • flavor - 特定字段,用于在表单中定义 flavor
  • keypair - 特定字段,用于在表单中定义 KeyPair
  • image- 特定字段,用于在表单中定义镜像
  • azone - 特定字段,用于在表单中定义可用区
  • psqlDatabase - 特定字段,用于浏览已部署的 PostgreSQL 数据库
  • imageType - 仅适用于 image 类型的字段。通过镜像类型名称过滤所有 murano 镜像,在将元数据添加到镜像时注册。

示例

Forms:
  - serviceConfiguration:
      fields:
        - name: name
          type: string
          label: Service Name
          description: >-
            To identify your service in logs please specify a service name
        - name: dcInstances
          type: integer
          hidden: true
          initial: 1
          required: false
          maxLength: 15
          helpText: Optional field for a machine hostname template
  - instanceConfiguration:
          fields:
            - name: flavor
              type: flavor
              label: Instance flavor
              description: >-
                Select registered in Openstack flavor. Consider that service performance
                depends on this parameter.
              required: false
            - name: osImage
              type: image
              imageType: linux
              label: Instance image
              description: >-
                Select valid image for a service. Image should already be prepared and
                registered in glance.
            - name: availabilityZone
              type: azone
              label: Availability zone
              description: Select availability zone where service would be installed.
              required: false