From 4fbbe8f6279c7c9b1e66c7b85f0ecbfa558d4c98 Mon Sep 17 00:00:00 2001 From: Jack Lucas Date: Tue, 17 Jul 2018 21:34:22 +0000 Subject: Add support for updating image. - Refactor type file to reduce duplication - General code cleanup Change-Id: I80354736100dcd3544db2f751335d704bd240666 Issue-ID: DCAEGEN2-543 Signed-off-by: Jack Lucas --- k8s/k8s-node-type.yaml | 154 ++++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 91 deletions(-) (limited to 'k8s/k8s-node-type.yaml') diff --git a/k8s/k8s-node-type.yaml b/k8s/k8s-node-type.yaml index 00f8c8d..4810f3a 100644 --- a/k8s/k8s-node-type.yaml +++ b/k8s/k8s-node-type.yaml @@ -25,7 +25,7 @@ plugins: k8s: executor: 'central_deployment_agent' package_name: k8splugin - package_version: 1.2.0 + package_version: 1.3.0 data_types: @@ -80,7 +80,57 @@ data_types: required: false node_types: - # The ContainerizedServiceComponent node type is to be used for DCAE service components that + dcae.nodes.ContainerizedComponent: + # Bese type for all containerized components + # Captures common properties and interfaces + derived_from: cloudify.nodes.Root + properties: + image: + type: string + description: Full uri of the Docker image + + application_config: + default: {} + description: > + Application configuration for this Docker component. The data structure is + expected to be a complex map (native YAML) and to be constructed and filled + by the creator of the blueprint. + + docker_config: + default: {} + description: > + This is what is the auxilary portion of the component spec that contains things + like healthcheck definitions for the Docker component. Health checks are + optional. + + log_info: + type: dcae.types.LoggingInfo + description: > + Information for setting up centralized logging via ELK. + required: false + + replicas: + type: integer + description: > + The number of instances of the component that should be launched initially + default: 1 + + always_pull_image: + type: boolean + description: > + Set to true if the orchestrator should always pull a new copy of the image + before deploying. By default the orchestrator pulls only if the image is + not already present on the Docker host where the container is being launched. + default: false + + interfaces: + dcae.interfaces.update: + scale: + implementation: k8s.k8splugin.scale + update_image: + implementation: k8s.k8splugin.update_image + + # The ContainerizedServiceComponent node type is to be used for DCAE service components that # are to be run in a Docker container. This node type goes beyond that of a ordinary Docker # plugin where it has DCAE platform specific functionality: # @@ -88,11 +138,11 @@ node_types: # * Managing of service component configuration information # # The plugin deploys the container into a Kubernetes cluster with a very specific choice - # of Kubernetes elements that are deliberately not under the control of the blueprint author. + # of Kubernetes elements that are deliberately not under the control of the blueprint author. # The idea is to deploy all service components in a consistent way, with the details abstracted # away from the blueprint author. dcae.nodes.ContainerizedServiceComponent: - derived_from: cloudify.nodes.Root + derived_from: dcae.nodes.ContainerizedComponent properties: service_component_type: type: string @@ -121,44 +171,6 @@ node_types: names for example the CDAP broker. default: Null - application_config: - default: {} - description: > - Application configuration for this Docker component. The data structure is - expected to be a complex map (native YAML) and to be constructed and filled - by the creator of the blueprint. - - docker_config: - default: {} - description: > - This is what is the auxilary portion of the component spec that contains things - like healthcheck definitions for the Docker component. Health checks are - optional. - - image: - type: string - description: Full uri of the Docker image - - log_info: - type: dcae.types.LoggingInfo - description: > - Information for setting up centralized logging via ELK. - required: false - - replicas: - type: integer - description: > - The number of instances of the component that should be launched initially - default: 1 - - always_pull_image: - type: boolean - description: > - Set to true if the orchestrator should always pull a new copy of the image - before deploying. By default the orchestrator pulls only if the image is - not already present on the Docker host where the container is being launched. - default: false - interfaces: cloudify.interfaces.lifecycle: create: @@ -177,12 +189,8 @@ node_types: # This is to be invoked by the policy handler upon policy updates policy_update: implementation: k8s.k8splugin.policy_update - dcae.interfaces.scale: - scale: - implementation: k8s.k8splugin.scale - - # This node type is intended for DCAE service components that use DMaaP and must use the + # This node type is intended for DCAE service components that use DMaaP and must use the # DMaaP plugin. dcae.nodes.ContainerizedServiceComponentUsingDmaap: derived_from: dcae.nodes.ContainerizedServiceComponent @@ -240,11 +248,10 @@ node_types: # Create Docker container and start implementation: k8s.k8splugin.create_and_start_container_for_components_with_streams - # ContainerizedPlatformComponent is intended for DCAE platform services. Unlike the components, # platform services have well-known names and well-known ports. dcae.nodes.ContainerizedPlatformComponent: - derived_from: cloudify.nodes.Root + derived_from: dcae.nodes.ContainerizedComponent properties: name: description: > @@ -252,30 +259,12 @@ node_types: dns_name: required: false description: > - Name to be registered in the DNS for the service provided by the container. + Name to be registered in the DNS for the service provided by the container. If not provided, the 'name' field is used. This is a work-around for the Kubernetes restriction on having '_' in a DNS name. Having this field allows a component to look up its configuration using a name that includes a '_' while providing a legal Kubernetes DNS name. - application_config: - default: {} - description: > - Application configuration for this Docker component. The data strcture is - expected to be a complex map (native YAML) and to be constructed and filled - by the creator of the blueprint. - - docker_config: - default: {} - description: > - This is what is the auxilary portion of the component spec that contains things - like healthcheck definitions for the Docker component. Health checks are - optional. - - image: - type: string - description: Full uri of the Docker image - host_port: type: integer description: > @@ -294,26 +283,6 @@ node_types: Information for registering with MSB required: false - log_info: - type: dcae.types.LoggingInfo - description: > - Information for setting up centralized logging via ELK. - required: false - - replicas: - type: integer - description: > - The number of instances of the component that should be launched initially - default: 1 - - always_pull_image: - type: boolean - description: > - Set to true if the orchestrator should always pull a new copy of the image - before deploying. By default the orchestrator pulls only if the image is - not already present on the Docker host where the container is being launched. - default: false - interfaces: cloudify.interfaces.lifecycle: create: @@ -328,9 +297,6 @@ node_types: delete: # Delete configuration from Consul implementation: k8s.k8splugin.cleanup_discovery - dcae.interfaces.scale: - scale: - implementation: k8s.k8splugin.tasks.scale # ContainerizedApplication is intended to be more of an all-purpose Docker container node # for non-componentized applications. @@ -351,3 +317,9 @@ node_types: stop: # Stop and remove Docker container implementation: k8s.k8splugin.stop_and_remove_container + dcae.interfaces.scale: + scale: + implementation: k8s.k8splugin.scale + dcae.interfaces.update: + update_image: + implementation: k8s.k8splugin.update_image -- cgit 1.2.3-korg