forked from Rajeshzealster/Dynamic-deployment_workshop-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.yaml
182 lines (153 loc) · 5.95 KB
/
service.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
---
tosca_definitions_version: tosca_simple_yaml_1_3
description: Service Template for Intelligent Temperature & Humidity Management System using k3s orchestration
metadata:
template_name: "fog service orchestration for IT & HMS"
template_author: "Rajesh_Thalla"
template_version: "1.0"
imports:
- nodetypes/k3s_control_plane/k3s_control_plane.yaml
- relationshiptypes/token_tranfer/token_transfer.yaml
- nodetypes/k3s_worker/k3s_worker.yaml
- nodetypes/k3s_deployment/k3s_deployment.yaml
- nodetypes/daemon-service/daemon-service.yaml
topology_template:
inputs:
node_1:
type: string
description: Input IP address of node_1
node_2:
type: string
description: Input IP address of node_2
node_3:
type: string
description: Input IP address of node_3
node_4:
type: string
description: Input IP address of node_4
outputs:
fog_node_1_ip:
description: IP address of fog-node-1 - K3s master-node
value: { get_attribute: [fog-node-1, private_address] }
# or use public_address if that is the required IP
node_templates:
# All fog nodes
fog-node-1:
type: tosca.nodes.Compute
attributes:
private_address: { get_input: node_1 }
public_address: { get_input: node_1 }
fog-node-2:
type: tosca.nodes.Compute
attributes:
private_address: { get_input: node_2 }
public_address: { get_input: node_2 }
fog-node-3:
type: tosca.nodes.Compute
attributes:
private_address: { get_input: node_3 }
public_address: { get_input: node_3 }
fog-node-4:
type: tosca.nodes.Compute
attributes:
private_address: { get_input: node_4 }
public_address: { get_input: node_4 }
#k3s-control-plane
k3s-control-plane:
type: fog.k3s.ControlPlane
requirements:
- host: fog-node-1
#k3s worker node -1
k3s-worker-1:
type: fog.k3s.Worker
requirements:
- host: fog-node-2
- leader: k3s-control-plane
# k3s worker node - 2
k3s-worker-2:
type: fog.k3s.Worker
requirements:
- host: fog-node-3
- leader: k3s-control-plane
#k3s deployment of MQTT-broker server
k3s-deployment-1:
type: fog.k3s.Deployment
properties:
depl_name: mqtt-broker-deployment
svc_name: mqtt-broker-service
depl_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/mqtt_broker/mqtt_broker_deployment.yaml
k3s_name_space: default
requirements:
- host: fog-node-1
- dependency: k3s-worker-1
- dependency: k3s-worker-2
# # #k3s deployment -- mqtt-subscriber
k3s-deployment-2:
type: fog.k3s.Deployment
properties:
depl_name: mqtt-subscriber-deployment
svc_name: mqtt-subscriber-service
depl_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/mqtt_subscriber/mqtt_subscriber_deployment.yaml
k3s_name_space: default
requirements:
- host: fog-node-1
- dependency: k3s-worker-1
- dependency: k3s-worker-2
- dependency: k3s-deployment-1
#Background service to publish sensor data on to broker server
publisher-node:
type: fog.daemon.Service
properties:
name: mqtt-publisher
script_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/DHT11-publisher/publisher.py
service_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/DHT11-publisher/mqtt-publisher.service
Broker_Server_URL: { concat: [{ get_input: node_1 }, ":30001"] }
packages:
- paho-mqtt
- RPi.GPIO
- dht11
requirements:
- host: fog-node-4
- dependency: k3s-deployment-1
#Actuation service on fog-node-1
# actuator-service-1:
# type: fog.daemon.Service
# properties:
# name: actuator
# script_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation.py
# service_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation_window_ac.service
# Broker_Server_URL: { concat: [{ get_input: node_1 }, ":30001"] }
# packages:
# - paho-mqtt
# - RPi.GPIO
# requirements:
# - host: fog-node-1
# - dependency: k3s-deployment-1
#Actuation service on fog-node-2
# daemon-service-2:
# type: fog.daemon.Service
# properties:
# name: actuator
# script_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation.py
# service_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation_window_ac.service
# Broker_Server_URL: { concat: [{ get_input: node_1 }, ":30001"] }
# packages:
# - paho-mqtt
# - RPi.GPIO
# requirements:
# - host: fog-node-2
# - dependency: k3s-deployment-1
#Actuation service on fog-node-3
actuator-service-3:
type: fog.daemon.Service
properties:
name: actuator
script_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation.py
service_url: https://raw.githubusercontent.com/Rajeshzealster/FogDEFTKube--Intelli-Climate-Case-study/main/mqtt/actuation-service/actuation_window_ac.service
Broker_Server_URL: { concat: [{ get_input: node_1 }, ":30001"] }
packages:
- paho-mqtt
- RPi.GPIO
requirements:
- host: fog-node-3
- dependency: k3s-deployment-1