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