This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已经过机器动态翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
이 콘텐츠는 동적으로 기계 번역되었습니다. 책임 부인
Este texto foi traduzido automaticamente. (Aviso legal)
Questo contenuto è stato tradotto dinamicamente con traduzione automatica.(Esclusione di responsabilità))
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.책임 부인
Este artigo foi traduzido automaticamente.(Aviso legal)
这篇文章已经过机器翻译.放弃
Questo articolo è stato tradotto automaticamente.(Esclusione di responsabilità))
Translation failed!
创建复合 StyleBook
StyleBook 的一个重要且强大的功能是,它们可以作为其他 StyleBook 的构建块。StyleBook 可以导入到另一个 StyleBook 中,并且可以作为类型被第二个 StyleBook 的组件使用,类似于 Nitro 内置 StyleBook。
例如,您可以使用在上一节中构建的 basic-lb-config StyleBook 来构建另一个名为 composite-example 的 StyleBook。要使用 “basic-lb-config” StyleBook,您必须在新 StyleBook 的 import-stylebooks 部分中导入它。
构建您的 StyleBook
新的 StyleBook 如下所示:
name: composite-example
namespace: com.example.stylebooks
version: "0.1"
display-name: 负载均衡虚拟服务器 (HTTP/轮询)
description: 此 StyleBook 定义了一个带有监视器的轮询负载均衡配置。
schema-version: "1.0"
import-stylebooks:
-
namespace: netscaler.nitro.config
version: "10.5"
prefix: ns
-
namespace: com.example.stylebooks
version: "0.1"
prefix: stlb
parameters:
-
name: name
type: string
label: 应用程序名称
description: 为应用程序配置指定一个名称。
required: true
-
name: ip
type: ipaddress
label: 应用程序虚拟 IP (VIP)
description: 客户端访问的应用程序 VIP
required: true
-
name: svc-servers
type: ipaddress[]
label: 应用程序服务器 IP
description: 此应用程序所有服务器的 IP 地址
required: true
-
name: response-code
type: string[]
label: 响应代码列表
description: 响应代码列表 - 提供整数形式的响应代码列表。
components:
-
name: basic-lb-comp
type: stlb::basic-lb-config
description: 此组件的类型是另一个 StyleBook,它构建 NetScaler lbvserver、服务组和服务配置对象。
properties:
name: $parameters.name
ip: $parameters.ip
svc-servers: $parameters.svc-servers
-
name: monit-comp
type: ns::lbmonitor
description: 此组件是一个基本的 Nitro 类型(内置 StyleBook),它构建 NetScaler 监视器配置对象。
properties:
monitorname: $parameters.name + "-mon"
type: HTTP
respcode: $parameters.response-code
httprequest: "'GET /'"
lrtm: ENABLED
secure: "YES"
components:
-
name: monit-svcgrp-bind-comp
type: ns::servicegroup_lbmonitor_binding
properties:
servicegroupname: $components.basic-lb-comp.outputs.servicegroup-comp.properties.servicegroupname
monitor_name: $parent.properties.monitorname
<!--NeedCopy-->
在 import-stylebooks 部分中,您通过使用其命名空间和版本导入 basic-lb-config StyleBook,并使用前缀 “stlb” 进行引用。
在 components 部分中,定义了两个组件。第一个组件的类型是 stlb::basic-lb-config,其中 “basic-lb-config” 是您在创建基本负载均衡配置的 StyleBook 中创建的 StyleBook 的名称。为此组件定义的属性对应于 basic-lb-config StyleBook 中声明的强制参数。但是,您可以使用 StyleBook 的任何参数(包括必需参数和可选参数)。您无需重新构建 lbvserver、服务组以及服务和服务组绑定,而是将执行所有这些操作的 StyleBook 作为组件导入,并使用它在新 StyleBook 中创建这些配置对象。
StyleBook 添加了第二个组件 “monit-comp”,它使用 Nitro 资源“lbmonitor”(一个内置 StyleBook)的属性来创建监视器配置对象。它还有一个子组件 “monit-svcgrp-bind-comp”,用于创建绑定配置对象,该对象将监视器绑定到在第一个组件中创建的服务组。由于在 “basic-lb-config” StyleBook 中创建的服务组组件作为输出公开,因此此 StyleBook 可以使用表达式 $components.basic-lb-comp.outputs.servicegroup-comp 访问它。这是一个示例,说明导入 StyleBook 如何使用 outputs 部分来访问导入 StyleBook 中的组件,否则它们将无法访问这些组件。
接下来,将 StyleBook 内容复制并粘贴到文本编辑器中,然后将文件保存为 composite-example.yaml。在将文件导入 NetScaler ADM 之前,请务必验证 YAML 内容。然后,将其导入 NetScaler ADM 并使用此 StyleBook 创建一个或多个配置。
Citrix 建议您使用 StyleBook 中内置的 YAML 验证器来验证和导入 YAML 内容。
共享
共享
This Preview product documentation is Cloud Software Group Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Cloud Software Group Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Cloud Software Group product purchase decisions.
If you do not agree, select I DO NOT AGREE to exit.