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