Crreate Register Module in k8s plugin
[multicloud/framework.git] / docs / specs / multicloud4k8s-hpa-discovery.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.\r
2 .. http://creativecommons.org/licenses/by/4.0\r
3 .. Copyright (c) 2019 Intel, Inc.\r
4 \r
5 =================================================\r
6 MultiCloud for k8s HPA Discovery And Registration\r
7 =================================================\r
8 Discover HPA capability and register it to A&AI\r
9 \r
10 Problem Description\r
11 ===================\r
12 \r
13 Kubernetes clusters using ONAP Multicloud K8s Plugin Project for R4/R5 do not report hardware\r
14 features to A&AI. Consequently during the CNF/VNF life cycle CNFs/VNFs that require or recommend\r
15 specific hardware during instantiation cannot dynamically reach the correct cluster and node that\r
16 provides the needed hardware capabilities.\r
17 \r
18 \r
19 Propose Change\r
20 ==============\r
21 \r
22 Cluster Registration FLOW\r
23 -------------------------\r
24 #. Cluster is deployed.\r
25 #. K8s registration agent is deployed on cluster.\r
26 #. K8s registration agent gathers features and cluster info.\r
27 #. K8s registration agent registers with K8s scheduler with labels identifying it's capabilities.\r
28 #. K8s Scheduler hook gives HPA Placement Plugin hardware features.\r
29 #. HPA Placement Plugins stores features in mongoDB.\r
30 \r
31 AAI Registration\r
32 ----------------\r
33 #. CLI registers cluster with K8s plugin.\r
34 #. Registration asks HPA Placement for cluster features.\r
35 #. HPA Placement gets cluster features from mongoDB.\r
36 #. HPA Placement plugin returns map of nodes/features to registration.\r
37 #. Registration module munges features into tenant/flavors updates AAI.\r
38 \r
39 Converting node feature label to flavor properties\r
40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
41 \r
42 Node feature label::\r
43     \r
44     feature.node.kubernetes.io/network-sriov.capable=True\r
45     feature.node.kubernetes.io/network-sriov.configured=True\r
46     feature.node.kubernetes.io/pci-1200_8086.present=True\r
47 \r
48 Comments: The other parameter we can set default because node feature label can not provide.\r
49 \r
50 \r
51 Flavor properties::\r
52     \r
53     +-----------------------------------------------------+-------------+\r
54     | Field                                               | Value       |\r
55     +-----------------------------------------------------+-------------+\r
56     | OS-FLV-DISABLED:disabled                            | False       |\r
57     | OS-FLV-DISABLED:ephemeral                           | 0           |\r
58     | feature.node.kubernetes.io/network-sriov.capable    | True        |\r
59     | feature.node.kubernetes.io/network-sriov.configured | True        |\r
60     | feature.node.kubernetes.io/pci-1200_8086.present    | True        |\r
61     | disk                                                | 1           |\r
62     | id                                                  | 1           |\r
63     | name                                                | k8s_sriov_1 |\r
64     | ram                                                 | 512         |\r
65     | vcpus                                               | 1           |\r
66     +-----------------------------------------------------+-------------+\r
67 \r
68 Add API for K8s Plugin\r
69 ^^^^^^^^^^^^^^^^^^^^^^\r
70 API V0 URL: POST http://{{MSB_IP}}:{{MSB_PORT}}/api/v0/multicloud-k8s/{{cloud-owner}}_{{cloud-region-id}}/registry\r
71 API V1 URL: POST http://{{MSB_IP}}:{{MSB_PORT}}/api/v1/multicloud-k8s/{{cloud-owner}}/{{cloud-region-id}}/registry\r
72 \r
73 Request Body:\r
74 >>>>>>>>>>>>>\r
75 ::\r
76 \r
77   {\r
78   }\r
79 \r
80 Response:\r
81 >>>>>>>>>\r
82 \r
83 Response Codes\r
84 ::::::::::::::\r
85 Success\r
86 .......\r
87 \r
88 +--------------------+----------------------------------------------------------------------+\r
89 | Code               | Reason                                                               |\r
90 +====================+======================================================================+\r
91 | 202 - ACCEPTED     | Discover HPA and successfully register it                            |\r
92 +--------------------+----------------------------------------------------------------------+\r
93 \r
94 Error\r
95 .....\r
96 \r
97 +----------------------------+--------------------------------------------------------------+\r
98 | Code                       | Reason                                                       |\r
99 +============================+==============================================================+\r
100 | 500 - INTERAL_SERVER_ERROR | Some content in the request was invalid.                     |\r
101 +----------------------------+--------------------------------------------------------------+\r
102 \r
103 \r
104 Response Body\r
105 :::::::::::::\r
106 ::\r
107 \r
108     {\r
109     }\r
110         \r
111 API V0 URL: GET http://{{MSB_IP}}:{{MSB_PORT}}/api/v0/multicloud-k8s/{{cloud-owner}}_{{cloud-region-id}}/registry\r
112 API V1 URL: GET http://{{MSB_IP}}:{{MSB_PORT}}/api/v1/multicloud-k8s/{{cloud-owner}}/{{cloud-region-id}}/registry\r
113 \r
114 Request Body:\r
115 >>>>>>>>>>>>>\r
116 ::\r
117 \r
118   {\r
119   }\r
120 \r
121 Response:\r
122 >>>>>>>>>\r
123 \r
124 Response Codes\r
125 ::::::::::::::\r
126 Success\r
127 .......\r
128 \r
129 +--------------------+----------------------------------------------------------------------+\r
130 | Code               | Reason                                                               |\r
131 +====================+======================================================================+\r
132 | 202 - ACCEPTED     | Discover HPA and successfully register it                            |\r
133 +--------------------+----------------------------------------------------------------------+\r
134 \r
135 Error\r
136 .....\r
137 \r
138 +----------------------------+--------------------------------------------------------------+\r
139 | Code                       | Reason                                                       |\r
140 +============================+==============================================================+\r
141 | 500 - INTERAL_SERVER_ERROR | Some content in the request was invalid.                     |\r
142 +----------------------------+--------------------------------------------------------------+\r
143 \r
144 \r
145 Response Body\r
146 :::::::::::::\r
147 ::\r
148 \r
149     {\r
150     }\r
151         \r
152         \r
153 API V0 URL: DELETE http://{{MSB_IP}}:{{MSB_PORT}}/api/v0/multicloud-k8s/{{cloud-owner}}_{{cloud-region-id}}/registry\r
154 API V1 URL: DELETE http://{{MSB_IP}}:{{MSB_PORT}}/api/v1/multicloud-k8s/{{cloud-owner}}/{{cloud-region-id}}/registry\r
155 \r
156 Request Body:\r
157 >>>>>>>>>>>>>\r
158 ::\r
159 \r
160   {\r
161   }\r
162 \r
163 Response:\r
164 >>>>>>>>>\r
165 \r
166 Response Codes\r
167 ::::::::::::::\r
168 Success\r
169 .......\r
170 \r
171 +--------------------+----------------------------------------------------------------------+\r
172 | Code               | Reason                                                               |\r
173 +====================+======================================================================+\r
174 | 204 - NO_CONTENT   | Successfully delete HPA information from AAI                         |\r
175 +--------------------+----------------------------------------------------------------------+\r
176 \r
177 Error\r
178 .....\r
179 \r
180 +----------------------------+--------------------------------------------------------------+\r
181 | Code                       | Reason                                                       |\r
182 +============================+==============================================================+\r
183 | 500 - INTERAL_SERVER_ERROR | Some content in the request was invalid.                     |\r
184 +----------------------------+--------------------------------------------------------------+\r
185 \r
186 \r
187 Response Body\r
188 :::::::::::::\r
189 ::\r
190 \r
191     {\r
192     }\r
193 \r
194 Work Items\r
195 ==========\r
196 \r
197 #. Work with CLI.\r
198 #. Work with AAI.\r
199 #. Expose API by broker and k8s plugin.\r
200 \r
201 Tests\r
202 =====\r
203 \r
204 #. Unit Tests with tox\r
205 #. Pairwise test with AAI project.\r
206 #. Integration test with vFW HPA test.\r
207 #. CSIT Tests, the input/ouput of broker and k8s plugin see API design above.\r
208 \r
209 Reference\r
210 =========\r
211 https://wiki.onap.org/display/DW/Extending+HPA+for+K8S\r