forked from EarthmanT/db-lb-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblueprint.yaml
252 lines (222 loc) · 8.01 KB
/
blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
tosca_definitions_version: cloudify_dsl_1_3
imports:
- http://www.getcloudify.org/spec/cloudify/4.2/types.yaml
- http://www.getcloudify.org/spec/utilities-plugin/1.4.5/plugin.yaml
- http://www.getcloudify.org/spec/kubernetes-plugin/2.0.0/plugin.yaml
- http://www.getcloudify.org/spec/dblb/0.2/plugin.yaml
inputs:
environment_blueprint_filename:
default: aws.yaml
lb_blueprint_archive:
default: https://github.com/cloudify-examples/haproxy-blueprint/archive/1b56f1ebb524576e755535c3aa687e20a39b94f9.zip
db_blueprint_archive:
default: https://github.com/cloudify-examples/mariadb-blueprint/archive/f2d91c267743ab14c86703efafda02cfd7cac466.zip
kubernetes_master_ip:
type: string
default: { get_secret: kubernetes_master_ip }
kubernetes_master_port:
type: string
default: { get_secret: kubernetes_master_port }
kubernetes_certificate_authority_data:
default: { get_secret: kubernetes_certificate_authority_data }
kubernetes-admin_client_certificate_data:
default: { get_secret: kubernetes-admin_client_certificate_data }
kubernetes-admin_client_key_data:
default: { get_secret: kubernetes-admin_client_key_data }
new_database_user:
default: demo
new_database_password:
default: new_password
use_external_database:
default: true
proxy_manager_network:
default: aws
db_blueprint:
default: db
lb_blueprint:
default: lb
db_deployment:
default: { get_input: db_blueprint }
lb_deployment:
default: { get_input: lb_blueprint }
node_types:
cloudify.kubernetes.resources.PersistentVolumeClaim:
derived_from: cloudify.kubernetes.resources.CustomBlueprintDefinedResource
properties:
api_mapping:
default:
create:
api: CoreV1Api
method: create_namespaced_persistent_volume_claim
payload: V1PersistentVolumeClaim
read:
api: CoreV1Api
method: read_namespaced_persistent_volume_claim
delete:
api: CoreV1Api
method: delete_namespaced_persistent_volume_claim
payload: V1DeleteOptions
update:
api: CoreV1Api
method: patch_namespaced_persistent_volume_claim
dsl_definitions:
kube_config: &kube_config
apiVersion: v1
kind: Config
preferences: {}
current-context: kubernetes-admin@kubernetes
clusters:
- name: kubernetes
cluster:
certificate-authority-data: { get_input: kubernetes_certificate_authority_data }
server: { concat: [ 'https://', { get_input: kubernetes_master_ip}, ':', { get_input: kubernetes_master_port } ] }
contexts:
- name: kubernetes-admin@kubernetes
context:
cluster: kubernetes
user: kubernetes-admin
users:
- name: kubernetes-admin
user:
client-certificate-data: { get_input: kubernetes-admin_client_certificate_data }
client-key-data: { get_input: kubernetes-admin_client_key_data }
node_templates:
app_svc:
type: cloudify.kubernetes.resources.FileDefinedResource
properties:
file:
resource_path: resources/service.yaml
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
- type: cloudify.relationships.depends_on
target: app_deploy
app_deploy:
type: cloudify.kubernetes.resources.FileDefinedResource
properties:
file:
resource_path: resources/deployment.yaml
template_variables:
db_host: { get_attribute: [ lb, deployment, outputs, ip ] }
db_user_password: { get_input: new_database_password }
db_user: { get_input: new_database_user }
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
- type: cloudify.relationships.depends_on
target: pv_claim
- type: cloudify.relationships.depends_on
target: lb
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: kubernetes.cloudify_kubernetes.tasks.file_resource_create
inputs:
file:
resource_path: resources/deployment.yaml
template_variables:
db_host: { get_attribute: [ lb, deployment, outputs, ip ] }
db_user_password: { get_input: new_database_password }
db_user: { get_input: new_database_user }
pv_claim:
type: cloudify.kubernetes.resources.PersistentVolumeClaim
properties:
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
- type: cloudify.relationships.depends_on
target: pv_1
pv_1:
type: cloudify.kubernetes.resources.FileDefinedResource
properties:
file:
resource_path: resources/persistent-volume.yaml
relationships:
- type: cloudify.kubernetes.relationships.managed_by_master
target: kubernetes_master
kubernetes_master:
type: cloudify.kubernetes.nodes.Master
properties:
configuration:
file_content: *kube_config
lb:
type: cloudify.nodes.DeploymentProxy
properties:
resource_config:
blueprint:
id: { get_input: lb_blueprint }
blueprint_archive: https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip
main_file_name: { get_input: environment_blueprint_filename }
external_resource: { get_input: use_external_database }
deployment:
id: { get_input: lb_deployment }
inputs:
manager_network: { get_input: proxy_manager_network }
application_ip: ''
outputs:
ip: ip
external_resource: { get_input: use_external_database }
reexecute: false
relationships:
- type: cloudify.relationships.depends_on
target: db
interfaces:
cloudify.interfaces.lifecycle:
configure:
implementation: cfy_util.cloudify_deployment_proxy.tasks.create_deployment
inputs:
resource_config:
blueprint: { get_property: [ SELF, resource_config, blueprint ] }
deployment:
id: { get_property: [ SELF, resource_config, deployment, id ] }
inputs:
manager_network: { get_input: proxy_manager_network }
application_ip: { get_attribute: [ db, deployment, outputs, ips, 0 ] }
outputs:
ip: { get_property: [ SELF, resource_config, deployment, outputs, ip ] }
start:
implementation: cfy_util.cloudify_deployment_proxy.tasks.execute_start
inputs:
workflow_id: install
timeout: 1100
interval: 15
db:
type: cloudify.nodes.DeploymentProxy
properties:
resource_config:
blueprint:
id: { get_input: db_blueprint }
blueprint_archive: https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip
main_file_name: { get_input: environment_blueprint_filename }
external_resource: { get_input: use_external_database }
deployment:
id: { get_input: db_deployment }
inputs:
new_database_user: { get_input: new_database_user}
new_database_password: { get_input: new_database_password }
manager_network: { get_input: proxy_manager_network }
outputs:
cluster_addresses: ips
external_resource: { get_input: use_external_database }
reexecute: false
interfaces:
cloudify.interfaces.lifecycle:
start:
implementation: cfy_util.cloudify_deployment_proxy.tasks.execute_start
inputs:
workflow_id: install
timeout: 1100
interval: 15