The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [1.4.8]
+* If an installation step times out because a component does not become ready within the maximum wait time,
+delete the Kubernetes artifacts associated with the component. Previously, an installation step might time
+out due to a very slow image pull. Cloudify would report a failure, but the component would come up, much
+later, after Kubernetes finished pulling the image. This should no longer happen.
+
+## [1.4.7]
+* Increase unit test coverage
## [1.4.6]
* Support for specifying CPU and memory resources in a blueprint for a containerized component
else:
return results[0]["ServiceAddress"]
-
def _verify_k8s_deployment(service_component_name, max_wait):
"""Verify that the k8s Deployment is ready
Return:
-------
- True if deployment is ready else a DockerPluginDeploymentError exception
- will be raised.
+ True if deployment is ready within the maximum wait time, False otherwise
"""
num_attempts = 1
num_attempts += 1
if max_wait > 0 and max_wait < num_attempts:
- raise DockerPluginDeploymentError("k8s deployment never became ready for {0}".format(service_component_name))
+ return False
time.sleep(1)
# Capture the result of deployment for future use
ctx.instance.runtime_properties[K8S_DEPLOYMENT] = dep
+ kwargs[K8S_DEPLOYMENT] = dep
ctx.instance.runtime_properties["replicas"] = replicas
ctx.logger.info ("k8s deployment initiated successfully for {0}: {1}".format(container_name, dep))
+ return kwargs
def _parse_cloudify_context(**kwargs):
"""Parse Cloudify context
"labels": kwargs.get("labels", {}),
"resource_config": kwargs.get("resource_config",{}),
"readiness": kwargs.get("readiness",{})}
- _create_and_start_container(service_component_name, image, **sub_kwargs)
+ returned_args = _create_and_start_container(service_component_name, image, **sub_kwargs)
+ kwargs[K8S_DEPLOYMENT] = returned_args[K8S_DEPLOYMENT]
return kwargs
if _verify_k8s_deployment(service_component_name, max_wait):
ctx.logger.info("k8s deployment is ready for: {0}".format(service_component_name))
+ else:
+ # The component did not become ready within the "max_wait" interval.
+ # Delete the k8s components created already and remove configuration from Consul.
+ ctx.logger.error("k8s deployment never became ready for {0}".format(service_component_name))
+ if (K8S_DEPLOYMENT in kwargs) and (len(kwargs[K8S_DEPLOYMENT]["deployment"]) > 0):
+ ctx.logger.info("attempting to delete k8s artifacts: {0}".format(kwargs[K8S_DEPLOYMENT]))
+ k8sclient.undeploy(kwargs[K8S_DEPLOYMENT])
+ ctx.logger.info("deleted k8s artifacts: {0}".format(kwargs[K8S_DEPLOYMENT]))
+ cleanup_discovery(**kwargs)
+ raise DockerPluginDeploymentError("k8s deployment never became ready for {0}".format(service_component_name))
return kwargs
kwargs["replicas"] = ctx.node.properties["replicas"]
if "always_pull_image" in ctx.node.properties:
kwargs["always_pull_image"] = ctx.node.properties["always_pull_image"]
- _create_and_start_container(service_component_name, image, **kwargs)
+ returned_args = _create_and_start_container(service_component_name, image, **kwargs)
# Verify that the k8s deployment is ready
-
- max_wait = kwargs.get("max_wait", DEFAULT_MAX_WAIT)
- ctx.logger.info("Waiting up to {0} secs for {1} to become ready".format(max_wait, service_component_name))
-
- if _verify_k8s_deployment(service_component_name, max_wait):
- ctx.logger.info("k8s deployment ready for: {0}".format(service_component_name))
-
+ # - Set service component name into kwargs
+ # - max_wait is already in kwargs if it was set
+ returned_args[SERVICE_COMPONENT_NAME] = service_component_name
+ _verify_component(**returned_args)
@wrap_error_handling_start
@monkeypatch_loggers