def delete(instance_id, instance): tiller_namespace_name = _get_resource_name() ckan_helm_release_name = f'ckan-cloud-{instance_id}' errors = [] try: logs.info(f'Deleting helm release {ckan_helm_release_name}') helm_driver.delete(tiller_namespace_name, ckan_helm_release_name) except Exception as e: logs.warning(traceback.format_exc()) errors.append(f'Failed to delete helm release') if kubectl.call(f'delete --wait=false namespace {instance_id}') != 0: errors.append(f'Failed to delete namespace') assert len(errors) == 0, ', '.join(errors)
def delete(instance_id, instance): tiller_namespace_name = _get_tiller_namespace_name(instance_id, instance) release_name = _get_helm_release_name(instance_id, instance) logs.info(tiller_namespace_name=tiller_namespace_name, release_name=release_name) errors = [] try: logs.info(f'Deleting helm release {release_name}') delete_kwargs = dict(tiller_namespace=tiller_namespace_name, release_name=release_name) app_type = instance['spec'].get('app-type') if app_type: _get_app_type_manager(app_type).pre_delete_hook( instance_id, instance, delete_kwargs) helm_driver.delete(**delete_kwargs) if app_type: _get_app_type_manager(app_type).post_delete_hook( instance_id, instance, delete_kwargs) except Exception as e: logs.warning(traceback.format_exc()) errors.append(f'Failed to delete helm release') if kubectl.call(f'delete --wait=false namespace {instance_id}') != 0: errors.append(f'Failed to delete namespace') assert len(errors) == 0, ', '.join(errors)