Fix tox configuration for coverage
[dcaegen2/platform/plugins.git] / k8s / k8s-node-type.yaml
1 # ================================================================================
2 # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # ============LICENSE_END=========================================================
16 #
17 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
18
19 tosca_definitions_version: cloudify_dsl_1_3
20
21 plugins:
22   k8s:
23     executor: 'central_deployment_agent'
24     package_name: k8splugin
25     package_version: 1.7.1
26
27 data_types:
28
29   dcae.types.MSBRegistration:
30     description: >
31       Information for registering an HTTP service into MSB.  It's optional to do so,
32       but if MSB registration is desired at least the port property must be provided.
33       If 'port' property is not provided, the plugin will not do the registration.
34       (The properties all have to be declared as not required, otherwise the
35       'msb_registration' property on the node would also be required.)
36     properties:
37       port:
38         description: The container port at which the service is exposed
39         type: string
40         required: false
41       version:
42         description: The version identifier for the service
43         type: string
44         required: false
45       url_path:
46         description: The URL path (e.g., "/api", not the full URL) to the service endpoint
47         type: string
48         required: false
49       uses_ssl:
50         description: Set to true if service endpoint uses SSL (TLS)
51         type: boolean
52         required: false
53
54   dcae.types.LoggingInfo:
55     description: >
56       Information for setting up centralized logging via ELK using a "sidecar" container.
57       If 'log_directory' is not provided, the plugin will not set up ELK logging.
58       (The properties all have to be declared as not required, otherwise the
59       'log_info' property on the node would also be required.)
60     properties:
61       log_directory:
62         description: >
63           The path in the container where the component writes its logs.
64           If the component is following the EELF requirements, this would be
65           the directory where the four EELF files are being written.
66           (Other logs can be placed in the directory--if their names in '.log',
67           they'll also be sent into ELK.)
68         type: string
69         required: false
70       alternate_fb_path:
71         description: >
72           Hope not to use this.  By default, the plugin will mount the log volume
73           at /var/log/onap/<component_type> in the sidecar container's file system.
74           'alternate_fb_path' allows overriding the default.  Will affect how the log
75           data can be found in the ELK system.
76         type: string
77         required: false
78
79   dcae.types.TLSInfo:
80     description: >
81       Information for using TLS (HTTPS).  (The properties all have to be declared as not
82       required, otherwise the tls_info property on the node would also be required.)
83     properties:
84       cert_directory:
85         description: >
86           The path in the container where the component expects to find TLS-related data.
87         type: string
88         required: false
89       use_tls:
90         description: >
91           Flag indicating whether TLS (HTTPS) is to be used
92         type: boolean
93         required: false
94
95 node_types:
96     dcae.nodes.ContainerizedComponent:
97     # Base type for all containerized components
98     # Captures common properties and interfaces
99         derived_from: cloudify.nodes.Root
100         properties:
101             image:
102                 type: string
103                 description: Full uri of the Docker image
104
105             application_config:
106                 default: {}
107                 description: >
108                   Application configuration for this Docker component. The data structure is
109                   expected to be a complex map (native YAML) and to be constructed and filled
110                   by the creator of the blueprint.
111
112             docker_config:
113                 default: {}
114                 description: >
115                   Copied from the auxiliary portion of the component spec that contains things
116                   like healthcheck definitions for the Docker component. Health checks are
117                   optional.
118
119             resource_config:
120                 default: {}
121                 description: >
122                   This is used to specify the cpu and memory request and limit for container.
123                   Please specify "requests" property and/or a "limits" property, with subproproperties
124                   for cpu and memory. (https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)
125
126             log_info:
127               type: dcae.types.LoggingInfo
128               description: >
129                 Information for setting up centralized logging via ELK.
130               required: false
131
132             tls_info:
133               type: dcae.types.TLSInfo
134               description: >
135                 Information for setting up TLS (HTTPS).
136               required: false
137
138             replicas:
139               type: integer
140               description: >
141                 The number of instances of the component that should be launched initially
142               default: 1
143
144             always_pull_image:
145               type: boolean
146               description: >
147                 Set to true if the orchestrator should always pull a new copy of the image
148                 before deploying.  By default the orchestrator pulls only if the image is
149                 not already present on the Docker host where the container is being launched.
150               default: false
151
152             location_id:
153               type: string
154               description: >
155                 The identifier for the location where the component is to be deployed.
156                 If absent, the plugin uses its configured default location, typically the location
157                 where the plugin is running (the central site).  Also used to supply a location to
158                 the DMaaP bus controller if the component is being provisioned as a publisher or
159                 subscriber to a DMaaP feed or topic.
160               required: false
161
162         interfaces:
163             dcae.interfaces.update:
164                 scale:
165                     implementation: k8s.k8splugin.scale
166                 update_image:
167                     implementation: k8s.k8splugin.update_image
168
169     # The ContainerizedServiceComponent node type is to be used for DCAE service components that
170     # are to be run in a Docker container.  This node type goes beyond that of a ordinary Docker
171     # plugin where it has DCAE platform specific functionality:
172     #
173     #   * Generation of the service component name
174     #   * Managing of service component configuration information
175     #
176     # The plugin deploys the container into a Kubernetes cluster with a very specific choice
177     # of Kubernetes elements that are deliberately not under the control of the blueprint author.
178     # The idea is to deploy all service components in a consistent way, with the details abstracted
179     # away from the blueprint author.
180     dcae.nodes.ContainerizedServiceComponent:
181         derived_from: dcae.nodes.ContainerizedComponent
182         properties:
183             service_component_type:
184                 type: string
185                 description: Service component type of the application being run in the container
186
187             service_id:
188                 type: string
189                 description: >
190                   Unique id for this DCAE service instance this component belongs to. This value
191                   will be applied as a tag in the registration of this component with Consul.
192                 default: Null
193
194             location_id:
195                 type: string
196                 description: >
197                   Location id of where to run the container.  Not used by the plugin.  Here for backward compatibility.
198                 default: Null
199                 required: False
200
201             service_component_name_override:
202                 type: string
203                 description: >
204                     Manually override and set the name for this Docker container node. If this
205                     is set, then the name will not be auto-generated.  Using this feature provides
206                     a service component with a fixed name that's known in advance, but care must be taken
207                     to avoid attempting to deploy two components with the same name.
208                 default: Null
209
210         interfaces:
211             cloudify.interfaces.lifecycle:
212                 create:
213                     # Generate service component name and populate config into Consul
214                     implementation: k8s.k8splugin.create_for_components
215                 start:
216                     # Create Docker container and start
217                     implementation: k8s.k8splugin.create_and_start_container_for_components
218                 stop:
219                     # Stop and remove Docker container
220                     implementation: k8s.k8splugin.stop_and_remove_container
221                 delete:
222                     # Delete configuration from Consul
223                     implementation: k8s.k8splugin.cleanup_discovery
224             dcae.interfaces.policy:
225                 # This is to be invoked by the policy handler upon policy updates
226                 policy_update:
227                     implementation: k8s.k8splugin.policy_update
228
229     # This node type is intended for DCAE service components that use DMaaP and must use the
230     # DMaaP plugin.
231     dcae.nodes.ContainerizedServiceComponentUsingDmaap:
232         derived_from: dcae.nodes.ContainerizedServiceComponent
233         properties:
234             streams_publishes:
235                 description: >
236                   List of DMaaP streams used for publishing.
237
238                   Message router items look like:
239
240                     name: topic00
241                     location: mtc5
242                     client_role: XXXX
243                     type: message_router
244
245                   Data router items look like:
246
247                     name: feed00
248                     location: mtc5
249                     type: data_router
250
251                   This information is forwarded to the dmaap plugin to provision
252                 default: []
253             streams_subscribes:
254                 description: >
255                   List of DMaaP streams used for subscribing.
256
257                   Message router items look like:
258
259                     name: topic00
260                     location: mtc5
261                     client_role: XXXX
262                     type: message_router
263
264                   Data router items look like:
265
266                     name: feed00
267                     location: mtc5
268                     type: data_router
269                     username: king
270                     password: 123456
271                     route: some-path
272                     scheme: https
273
274                   Note that username and password is optional. If not provided or null then the
275                   plugin will generate them.
276
277                 default: []
278         interfaces:
279             cloudify.interfaces.lifecycle:
280                 create:
281                     # Generate service component name, populate config into Consul, set up runtime properties for DMaaP plugin
282                     implementation: k8s.k8splugin.create_for_components_with_streams
283
284     # ContainerizedPlatformComponent is intended for DCAE platform services.  Unlike the components,
285     # platform services have well-known names and well-known ports.
286     dcae.nodes.ContainerizedPlatformComponent:
287         derived_from: dcae.nodes.ContainerizedComponent
288         properties:
289             name:
290                 description: >
291                   Container name used to register with Consul
292             dns_name:
293                 required: false
294                 description: >
295                   Name to be registered in the DNS for the service provided by the container.
296                   If not provided, the 'name' field is used.
297                   This is a work-around for the Kubernetes restriction on having '_' in a DNS name.
298                   Having this field allows a component to look up its configuration using a name that
299                   includes a '_' while providing a legal Kubernetes DNS name.
300
301             host_port:
302                 type: integer
303                 description: >
304                   Network port that the platform service is expecting to expose on the host
305                 default: 0
306
307             container_port:
308                 type: integer
309                 description: >
310                   Network port that the platform service exposes in the container
311                 default: 0
312
313             msb_registration:
314               type: dcae.types.MSBRegistration
315               description: >
316                 Information for registering with MSB
317               required: false
318
319         interfaces:
320             cloudify.interfaces.lifecycle:
321                 create:
322                     # Populate config into Consul
323                     implementation: k8s.k8splugin.create_for_platforms
324                 start:
325                     # Create Docker container and start
326                     implementation: k8s.k8splugin.create_and_start_container_for_platforms
327                 stop:
328                     # Stop and remove Docker container
329                     implementation: k8s.k8splugin.stop_and_remove_container
330                 delete:
331                     # Delete configuration from Consul
332                     implementation: k8s.k8splugin.cleanup_discovery
333
334     # ContainerizedApplication is intended to be more of an all-purpose Docker container node
335     # for non-componentized applications.
336     dcae.nodes.ContainerizedApplication:
337         derived_from: cloudify.nodes.Root
338         properties:
339             name:
340                 type: string
341                 description: Name of the Docker container to be given
342             image:
343                 type: string
344                 description: Full uri of the Docker image
345         interfaces:
346             cloudify.interfaces.lifecycle:
347                 start:
348                     # Create Docker container and start
349                     implementation: k8s.k8splugin.create_and_start_container
350                 stop:
351                     # Stop and remove Docker container
352                     implementation: k8s.k8splugin.stop_and_remove_container
353             dcae.interfaces.scale:
354                 scale:
355                     implementation: k8s.k8splugin.scale
356             dcae.interfaces.update:
357                 update_image:
358                     implementation: k8s.k8splugin.update_image