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