Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Investigate the use of PyHelm to replace the execution of helm via subprocess. #44

Open
dbandin opened this issue Jun 12, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@dbandin
Copy link
Contributor

dbandin commented Jun 12, 2019

Investigate the library PyHelm to replace the "helm" commands launched from Python using subprocess.

  • Could be cleaner to handle credentials to access helm in the cluster.
  • Maybe we can reduce the complexity of unit-testing using this library.
  • Adding the third party library we may reduce the maintenance load, make the code more clear to handle using only python code and not having to assemble cli commands, and what is expected from the api call could be more reliable.
  • Reduce the error handling special characters and how we are escaping them.

Module documentation: https://pypi.org/project/pyhelm/

Example of how we execute:

  • We create a command string:
command = "helm install {repo}/{app} -n {name} --namespace {ns}".format(
  • Execute method:
  if show_command:
       print(t.magenta(command))
   try:
       # TODO: Can we do this with a different command than check_output (Bandit security issue)
       result = check_output(command, stderr=STDOUT, shell=True)
       decoded = result.decode("utf-8")
       if verbose:
           print(decoded)
       return decoded, None
   except CalledProcessError as e:
       error_text = e.output.decode("utf-8")
       if show_errors:
           print(t.red("Command failed with CalledProcessError:"))
           print(error_text)
return None, error_text

This could help to fix #26

@alexvicegrab
Copy link
Contributor

Aha, PyHelm appears to be relatively young project. I agree that it is worth looking into it, and agree that getting rid of as many subprocess calls as possible, would be helpful.

And anything that reduces the Unit Test complexity without sacrificing functionality is worthwhile.

@alexvicegrab alexvicegrab added the enhancement New feature or request label Jun 13, 2019
@alexvicegrab alexvicegrab added this to the Performance Enhancement milestone Jun 13, 2019
@alexvicegrab
Copy link
Contributor

Related tools mentioned on Helm website include:

https://github.com/reactiveops/reckoner

Furthermore, currently we use Helm, but depending on the future of Kubernetes packaging, we may also consider using https://github.com/kubernetes-sigs/kustomize

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants