基本的なロードバランシング構成を作成するためのStyleBook
ヘッダー
name: basic-lb-config
description: This StyleBook defines a simple load balancing configuration.
display-name: Load Balancing Configuration
namespace: com.example.stylebooks
schema-version: "1.0"
version: "0.1"
StyleBookのインポート
import-stylebooks:
-
namespace: netscaler.nitro.config
prefix: ns
version: "10.5"
パラメーター
parameters:
-
name: name
type: string
label: Application Name
description: Name of the application configuration
required: true
-
name: ip
type: ipaddress
label: Application Virtual IP (VIP)
description: Application VIP that the clients access
required: true
-
name: lb-alg
type: string
label: LoadBalancing Algorithm
description: Choose the load balancing algorithm used for load balancing client requests between the application servers.
allowed-values:
- ROUNDROBIN
- LEASTCONNECTION
default: ROUNDROBIN
-
name: svc-servers
type: ipaddress\[\]
label: Application Server IPs
description: The IP addresses of all the servers of this application
required: true
-
name: svc-port
type: tcp-port
label: Server Port
description: The TCP port open on the application servers to receive requests.
default: 80
コンポーネント
components:
-
name: lbvserver-comp
type: ns::lbvserver
properties:
name: $parameters.name + "-lb"
servicetype: HTTP
ipv46: $parameters.ip
port: 80
lbmethod: $parameters.lb-alg
components:
-
name: svcg-comp
type: ns::servicegroup
properties:
name: $parameters.name + "-svcgrp"
servicetype: HTTP
components:
-
name: lbvserver-svg-binding-comp
type: ns::lbvserver\_servicegroup\_binding
properties:
name: $parent.parent.properties.name
servicegroupname: $parent.properties.name
-
name: members-svcg-comp
type: ns::servicegroup\_servicegroupmember\_binding
repeat: $parameters.svc-servers
repeat-item: srv
properties:
ip: $srv
port: str($parameters.svc-port)
servicegroupname: $parent.properties.name
components:
-
name: members-svcg-comp
type: ns::servicegroup\_servicegroupmember\_binding
repeat: $parameters.svc-servers
repeat-item: srv
properties:
ip: $srv
port: str($parameters.svc-port)
servicegroupname: $components.svcg-comp.properties.name
-
name: lbvserver-svg-binding-comp
type: ns::lbvserver\_servicegroup\_binding
properties:
name: $components.lbvserver-comp.properties.name
servicegroupname: $components.svcg-comp.properties.name
-
name: lbvserver-comp
type: ns::lbvserver
properties:
name: $parameters.name + "-lb"
servicetype: HTTP
ipv46: $parameters.ip
port: 80
lbmethod: $parameters.lb-alg
-
name: svcg-comp
type: ns::servicegroup
properties:
name: $parameters.name + "-svcgrp"
servicetype: HTTP
出力
outputs:
-
name: lbvserver-comp
value: $components.lbvserver-comp
description: The component that builds the Nitro lbvserver configuration object
-
name: servicegroup-comp
value: $components.svcg-comp
description: The component that builds the Nitro servicegroup configuration object
StyleBook を構築する
name: basic-lb-config
namespace: com.example.stylebooks
version: "0.1"
display-name: Load Balancing Configuration
description: This StyleBook defines a simple load balancing configuration.
schema-version: "1.0"
import-stylebooks:
-
namespace: netscaler.nitro.config
version: "10.5"
prefix: ns
parameters:
-
name: name
type: string
label: Application Name
description: Give a name to the application configuration.
required: true
-
name: ip
type: ipaddress
label: Application Virtual IP (VIP)
description: The Application VIP that clients access
required: true
-
name: lb-alg
type: string
label: LoadBalancing Algorithm
description: Choose the loadbalancing algorithm (method) used for loadbalancing client requests between the application servers.
allowed-values:
- ROUNDROBIN
- LEASTCONNECTION
default: ROUNDROBIN
-
name: svc-servers
type: ipaddress[]
label: Application Server IPs
description: The IP addresses of all the servers of this application
required: true
components:
-
name: lbvserver-comp
type: ns::lbvserver
properties:
name: $parameters.name + "-lb"
servicetype: HTTP
ipv46: $parameters.ip
port: 80
lbmethod: $parameters.lb-alg
-
name: svcg-comp
type: ns::servicegroup
properties:
servicegroupname: $parameters.name + "-svcgrp"
servicetype: HTTP
-
name: lbvserver-svg-binding-comp
type: ns::lbvserver_servicegroup_binding
properties:
name: $components.lbvserver-comp.properties.name
servicegroupname: $components.svcg-comp.properties.servicegroupname
-
name: members-svcg-comp
type: ns::servicegroup_servicegroupmember_binding
repeat: $parameters.svc-servers
repeat-item: srv
properties:
ip: $srv
port: 80
servicegroupname: $components.svcg-comp.properties.servicegroupname
outputs:
-
name: lbvserver-comp
value: $components.lbvserver-comp
description: The component that builds the Nitro lbvserver configuration object
-
name: servicegroup-comp
value: $components.svcg-comp
description: The component that builds the Nitro servicegroup configuration object