summaryrefslogtreecommitdiffstats
path: root/helm
diff options
context:
space:
mode:
authorHong Guan <hg4105@att.com>2018-12-04 14:35:36 -0500
committerHong Guan <hg4105@att.com>2018-12-04 14:35:36 -0500
commit2e7361cf94af3d57ae57610118a8a8975e022f74 (patch)
treeebb59bd3641f801add3848acc51743561ab21765 /helm
parentac39f88aa15b511dab1230720057b9737d38c102 (diff)
Add a new 'status' workflow for Helm Plugin
Change-Id: I87aa50b5ab5524494f035b290323c697169f26b9 Issue-ID: CCSDK-788 Signed-off-by: Hong Guan <hg4105@att.com>
Diffstat (limited to 'helm')
-rw-r--r--helm/helm-type.yaml6
-rw-r--r--helm/plugin/tasks.py19
-rw-r--r--helm/plugin/workflows.py10
-rw-r--r--helm/setup.py2
4 files changed, 35 insertions, 2 deletions
diff --git a/helm/helm-type.yaml b/helm/helm-type.yaml
index 15b5956..0b32d34 100644
--- a/helm/helm-type.yaml
+++ b/helm/helm-type.yaml
@@ -19,7 +19,7 @@ plugins:
helm-plugin:
executor: central_deployment_agent
package_name: helm
- package_version: 3.0.0
+ package_version: 3.0.1
node_types:
@@ -106,6 +106,7 @@ node_types:
stop: helm-plugin.plugin.tasks.stop
upgrade: helm-plugin.plugin.tasks.upgrade
rollback: helm-plugin.plugin.tasks.rollback
+ status: helm-plugin.plugin.tasks.status
workflows:
@@ -134,3 +135,6 @@ workflows:
description: The id of the node-instance that you want to modify.
revision:
description: Check the node runtime property history, find the revision number you want to rollback to
+ status:
+ mapping: helm-plugin.plugin.workflows.status
+ parameters:
diff --git a/helm/plugin/tasks.py b/helm/plugin/tasks.py
index 3374e94..7cb9147 100644
--- a/helm/plugin/tasks.py
+++ b/helm/plugin/tasks.py
@@ -368,3 +368,22 @@ def rollback(**kwargs):
retry_after=5)
get_current_helm_value(chartName)
get_helm_history(chartName)
+
+@operation
+def status(**kwargs):
+ componentName = ctx.node.properties['component-name']
+ namespace = ctx.node.properties['namespace']
+
+ chartName = namespace + "-" + componentName
+ statusCommand = 'helm status ' + chartName + tiller_host() + tls()
+ output = execute_command(statusCommand)
+ if output == False:
+ return ctx.operation.retry(
+ message='helm status failed, re-try after 5 second ',
+ retry_after=5)
+
+ status_output = [line.strip() for line in output.split('\n') if
+ line.strip()]
+ for index in range(len(status_output)):
+ status_output[index] = status_output[index].replace('\t', ' ')
+ ctx.instance.runtime_properties['install-status'] = status_output
diff --git a/helm/plugin/workflows.py b/helm/plugin/workflows.py
index 2999b73..de5549d 100644
--- a/helm/plugin/workflows.py
+++ b/helm/plugin/workflows.py
@@ -83,3 +83,13 @@ def rollback(node_instance_id, revision, **kwargs):
operation_args = {'operation': 'rollback', }
operation_args['kwargs'] = kwargs
node_instance.execute_operation(**operation_args)
+
+@workflow
+def status(**kwargs):
+
+ for node in ctx.nodes:
+ for node_instance in node.instances:
+ kwargs = {}
+ operation_args = {'operation': 'status', }
+ operation_args['kwargs'] = kwargs
+ node_instance.execute_operation(**operation_args)
diff --git a/helm/setup.py b/helm/setup.py
index 5eba25c..b020186 100644
--- a/helm/setup.py
+++ b/helm/setup.py
@@ -24,7 +24,7 @@ setup(
# Do not use underscores in the plugin name.
name='helm',
- version='3.0.0',
+ version='3.0.1',
author='Nicolas Hu(AT&T)',
author_email='jh245g@att.com',
description='This plugin will install/uninstall/upgrade/rollback helm '