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