115 lines
3.2 KiB
YAML
115 lines
3.2 KiB
YAML
tosca_definitions_version: tosca_simple_yaml_1_0
|
|
|
|
description: >
|
|
Template for deploying servers based on policies.
|
|
|
|
imports:
|
|
- custom_definitions.yaml
|
|
|
|
topology_template:
|
|
node_templates:
|
|
my_server_1:
|
|
type: tosca.nodes.Compute
|
|
capabilities:
|
|
# Host container properties
|
|
host:
|
|
properties:
|
|
num_cpus: 2
|
|
disk_size: 10 GB
|
|
mem_size: 512 MB
|
|
# Guest Operating System properties
|
|
os:
|
|
properties:
|
|
# host Operating System image properties
|
|
architecture: x86_64
|
|
type: Linux
|
|
distribution: RHEL
|
|
version: 6.5
|
|
|
|
my_server_2:
|
|
type: tosca.nodes.Compute
|
|
capabilities:
|
|
host:
|
|
properties:
|
|
disk_size: 10 GB
|
|
num_cpus: 2
|
|
mem_size: 4096 MB
|
|
os:
|
|
properties:
|
|
architecture: x86_64
|
|
type: Linux
|
|
distribution: Ubuntu
|
|
version: 14.04
|
|
|
|
groups:
|
|
webserver_group:
|
|
members: [ my_server_1, my_server_2 ]
|
|
type: tosca.groups.Root
|
|
metadata: { user1: 1008, user2: 1002 }
|
|
|
|
|
|
policies:
|
|
- my_compute_placement_policy:
|
|
type: tosca.policies.Placement
|
|
description: Apply placement policy to servers
|
|
metadata: { user1: 1001, user2: 1002 }
|
|
targets: [ my_server_1, my_server_2 ]
|
|
triggers:
|
|
resize_compute:
|
|
description: trigger
|
|
event_type: tosca.events.resource.utilization
|
|
schedule:
|
|
start_time: "2015-05-07T07:00:00Z"
|
|
end_time: "2015-06-07T07:00:00Z"
|
|
target_filter:
|
|
node: master-container
|
|
requirement: host
|
|
capability: Container
|
|
condition:
|
|
constraint: { greater_than: 50 }
|
|
granularity: 60
|
|
evaluations: 1
|
|
aggregation_method: mean
|
|
resource_type: instance
|
|
action:
|
|
resize: # Operation name
|
|
inputs:
|
|
strategy: LEAST_USED
|
|
implementation: Senlin.webhook()
|
|
high_cpu_usage:
|
|
description: trigger
|
|
metric: cpu_util
|
|
condition:
|
|
constraint: utilization greater_than 60%
|
|
threshold: 60
|
|
granularity: 600
|
|
evaluations: 1
|
|
aggregation_method: mean
|
|
resource_type: instance
|
|
comparison_operator: gt
|
|
metadata: SG1
|
|
action: [SP1]
|
|
|
|
low_cpu_usage:
|
|
description: trigger
|
|
metric: cpu_util
|
|
condition:
|
|
constraint: utilization less_than 20%
|
|
threshold: 20
|
|
granularity: 600
|
|
evaluations: 1
|
|
aggregation_method: mean
|
|
resource_type: instance
|
|
comparison_operator: gt
|
|
metadata: SG1
|
|
action: [SP1]
|
|
|
|
- my_groups_placement:
|
|
type: mycompany.mytypes.myScalingPolicy
|
|
targets: [ webserver_group ]
|
|
description: my company scaling policy
|
|
metadata:
|
|
user1: 1001
|
|
user2: 1003
|
|
|