blob: 4467fc475d1387aba86982b253182dde8c1eb1c2 [file] [log] [blame]
Jun Hu9e45abc2018-01-17 17:07:36 -05001# ============LICENSE_START==========================================
2# ===================================================================
3# Copyright © 2017 AT&T
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#============LICENSE_END============================================
17
18inputs:
19
20 labels:
21 default: {}
22
23node_types:
24
25 cloudify.nodes.Kubernetes:
26 derived_from: cloudify.nodes.Root
27 interfaces:
28 cloudify.interfaces.lifecycle:
29 create:
30 implementation: scripts/create.py
31
32 cloudify.nodes.Kubernetes.Master:
33 derived_from: cloudify.nodes.Root
34 interfaces:
35 cloudify.interfaces.lifecycle:
36 create:
37 implementation: scripts/create.py
38 configure:
39 implementation: scripts/kubernetes_master/configure.py
40 start:
41 implementation: scripts/kubernetes_master/start.py
42
43 cloudify.nodes.Kubernetes.Node:
44 derived_from: cloudify.nodes.Root
45 interfaces:
46 cloudify.interfaces.lifecycle:
47 create:
48 implementation: scripts/create.py
49 configure:
50 implementation: scripts/kubernetes_node/configure.py
51 start:
52 implementation: fabric.fabric_plugin.tasks.run_task
53 inputs:
54 tasks_file:
55 default: scripts/tasks.py
56 task_name:
57 default: label_node
58 task_properties:
59 default:
60 hostname: { get_attribute: [ SELF, hostname ] }
61 labels: { get_input: labels }
62 fabric_env:
63 default:
64 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
65 user: { get_input: agent_user }
66 key: { get_secret: agent_key_private }
67 stop:
68 implementation: fabric.fabric_plugin.tasks.run_task
69 inputs:
70 tasks_file:
71 default: scripts/tasks.py
72 task_name:
73 default: stop_node
74 task_properties:
75 default:
76 hostname: { get_attribute: [ SELF, hostname ] }
77 fabric_env:
78 default:
79 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
80 user: { get_input: agent_user }
81 key: { get_secret: agent_key_private }
82 delete:
83 implementation: fabric.fabric_plugin.tasks.run_task
84 inputs:
85 tasks_file:
86 default: scripts/tasks.py
87 task_name:
88 default: delete_node
89 task_properties:
90 default:
91 hostname: { get_attribute: [ SELF, hostname ] }
92 fabric_env:
93 default:
94 host_string: { get_attribute: [ kubernetes_master_host, ip ] }
95 user: { get_input: agent_user }
96 key: { get_secret: agent_key_private }
97
98node_templates:
99
100 kubernetes_master:
101 type: cloudify.nodes.Kubernetes.Master
102 relationships:
103 - type: cloudify.relationships.contained_in
104 target: kubernetes_master_host
105
106 kubernetes_node:
107 type: cloudify.nodes.Kubernetes.Node
108 relationships:
109 - type: cloudify.relationships.contained_in
110 target: kubernetes_node_host
111 - type: cloudify.relationships.depends_on
112 target: kubernetes_master
113
114outputs:
115
116 kubernetes_cluster_bootstrap_token:
117 value: { get_attribute: [ kubernetes_master, bootstrap_token ] }
118
119 kubernetes_cluster_master_ip:
120 value: { get_attribute: [ kubernetes_master, master_ip ] }
121
122 kubernetes-admin_client_certificate_data:
123 value: { get_attribute: [ kubernetes_master, kubernetes-admin_client_certificate_data ] }
124
125 kubernetes-admin_client_key_data:
126 value: { get_attribute: [ kubernetes_master, kubernetes-admin_client_key_data ] }
127
128 kubernetes_certificate_authority_data:
129 value: { get_attribute: [ kubernetes_master, kubernetes_certificate_authority_data ] }
130
131policy_types:
132 scale_policy_type:
133 source: policies/scale.clj
134 properties:
135 policy_operates_on_group:
136 default: true
137 service_selector:
138 description: regular expression that selects the metric to be measured
139 default: ".*"
140 moving_window_size:
141 description: the moving window for individual sources in secs
142 default: 10
143 scale_threshold:
144 description: the value to trigger scaling over aggregrated moving values
145 scale_limit:
146 description: scaling limit
147 default: 10
148 scale_direction:
149 description: scale up ('<') or scale down ('>')
150 default: '<'
151 cooldown_time:
152 description: the time to wait before evaluating again after a scale
153 default: 60
154
155groups: {}
156
157# scale_up_group:
158# members: [kubernetes_node_host]
159# policies:
160# auto_scale_up:
161# type: scale_policy_type
162# properties:
163# policy_operates_on_group: true
164# scale_limit: 6
165# scale_direction: '<'
166# scale_threshold: 30
167# service_selector: .*kubernetes_node_host.*cpu.total.user
168# cooldown_time: 60
169# triggers:
170# execute_scale_workflow:
171# type: cloudify.policies.triggers.execute_workflow
172# parameters:
173# workflow: scale
174# workflow_parameters:
175# delta: 1
176# scalable_entity_name: kubernetes_node_host
177
178# scale_down_group:
179# members: [kubernetes_node_host]
180# policies:
181# auto_scale_down:
182# type: scale_policy_type
183# properties:
184# policy_operates_on_group: true
185# scale_limit: 6
186# scale_direction: '<'
187# scale_threshold: 30
188# service_selector: .*kubernetes_node_host.*cpu.total.user
189# cooldown_time: 60
190# triggers:
191# execute_scale_workflow:
192# type: cloudify.policies.triggers.execute_workflow
193# parameters:
194# workflow: scale
195# workflow_parameters:
196# delta: 1
197# scalable_entity_name: kubernetes_node_host
198
199# heal_group:
200# members: [kubernetes_node_host]
201# policies:
202# simple_autoheal_policy:
203# type: cloudify.policies.types.host_failure
204# properties:
205# service:
206# - .*kubernetes_node_host.*.cpu.total.system
207# - .*kubernetes_node_host.*.process.hyperkube.cpu.percent
208# interval_between_workflows: 60
209# triggers:
210# auto_heal_trigger:
211# type: cloudify.policies.triggers.execute_workflow
212# parameters:
213# workflow: heal
214# workflow_parameters:
215# node_instance_id: { 'get_property': [ SELF, node_id ] }
216# diagnose_value: { 'get_property': [ SELF, diagnose ] }