diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2019-05-28 15:59:05 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2019-05-28 16:04:01 +0200 |
commit | 8e9812a9dda6fff57c249e2179023c16bc061958 (patch) | |
tree | cbf0d982d22d88aa73ccb4e5773825c646dc2928 /helm_deployment_status.py | |
parent | 13ba3c34d2144beafccb3d4519e416fa51d96d37 (diff) |
Support running healthcheck in any mode supported
So far it was only possible to run health checking
script with a default option of 'health'. This patch
allows passing through to healtcheck script any mode
that it supports via --health-mode runtime option.
Change-Id: Ic0145e5b4a1f17d64867287538dd63b850d86feb
Issue-ID: OOM-1806
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'helm_deployment_status.py')
-rwxr-xr-x | helm_deployment_status.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/helm_deployment_status.py b/helm_deployment_status.py index 7f8954f2..e92f64b1 100755 --- a/helm_deployment_status.py +++ b/helm_deployment_status.py @@ -101,10 +101,10 @@ def get_k8s_controllers(k8s): return k8s_controllers, list(not_ready_controllers) -def exec_healthcheck(hp_script, namespace): +def exec_healthcheck(hp_script, namespace, hp_mode): try: hc = subprocess.check_output( - ['sh', hp_script, namespace, 'health'], + ['sh', hp_script, namespace, hp_mode], stderr=subprocess.STDOUT) return 0, hc except subprocess.CalledProcessError as err: @@ -171,7 +171,8 @@ def print_status(verbosity, resources, not_ready_pods): print('\n'.join(status_strings), '\n') def parse_args(): - parser = argparse.ArgumentParser(description='Monitor ONAP deployment progress') + parser = argparse.ArgumentParser(description='Monitor ONAP deployment progress', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--namespace', '-n', default='onap', help='Kubernetes namespace of ONAP') parser.add_argument('--server', '-s', help='address of Kubernetes cluster') @@ -179,6 +180,9 @@ def parse_args(): default=expanduser('~') + '/.kube/config', help='path to .kube/config file') parser.add_argument('--health-path', '-hp', help='path to ONAP robot ete-k8s.sh') + parser.add_argument('--health-mode', default='health', help='healthcheck mode', + choices=('health','healthdist','distribute','instantiate','instantiateVFWCL', + 'instantiateDemoVFWCL','portal')) parser.add_argument('--no-helm', action='store_true', help='Do not check Helm') parser.add_argument('--check-frequency', '-w', default=300, type=int, help='time between readiness checks in seconds') @@ -294,7 +298,7 @@ def main(): if args.health_path is not None: try: - hc_rc, hc_output = exec_healthcheck(args.health_path, args.namespace) + hc_rc, hc_output = exec_healthcheck(args.health_path, args.namespace, args.health_mode) except IOError as err: sys.exit(err.strerror) print(hc_output.decode('utf-8')) |