saltstack / saltstack/salt

[BUG] helm install succeed but with error message

Open
#61,471 0 comments 0 reactions 1 assignee View on GitHub

@dwoz is already working on this.

Since Jan 17, 2022.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
we are using salt.states.helm.release_present to install helm chart, after successful helm chart install, we saw below salt error message.

this message is very misleading us.

2022-01-17 09:34:27,406 [salt.loaded.int.module.cmdmod:410 ][INFO ][4669] Executing command 'helm' in directory '/root'
2022-01-17 09:34:27,540 [salt.loaded.int.module.cmdmod:844 ][ERROR ][4669] Command 'helm' failed with return code: 1
2022-01-17 09:34:27,541 [salt.loaded.int.module.cmdmod:848 ][ERROR ][4669] stderr: Error: release: not found
2022-01-17 09:34:27,541 [salt.loaded.int.module.cmdmod:850 ][ERROR ][4669] retcode: 1

with current salt.states.helm.release_present logic, it always checks if release is present and then perform upgrade and install respectively, that means for any fresh install we will always get above ERROR message.

we can actually simplify the logic to do "helm upgrade --install" only, let helm to handle actual logic thus we can avoiding these unnecessary ERROR message.

https://helm.sh/docs/helm/helm_upgrade/

-i, --install                      if a release by this name doesn't already exist, run an install 

244     else:
245         **release_old_status = __salt__["helm.status"](release=name, namespace=namespace)**
246         if isinstance(release_old_status, dict):
247             release_upgrade = __salt__["helm.upgrade"](
248                 release=name,
249                 chart=chart,
250                 values=values,
251                 version=version,
252                 namespace=namespace,
253                 set=set,
254                 flags=flags,
255                 kvflags=kvflags,
256             )
.............
270 
271         else:
272             release_install = __salt__["helm.install"](
273                 release=name,
274                 chart=chart,
275                 values=values,
276                 version=version,
277                 namespace=namespace,
278                 set=set,
279                 flags=flags,
280                 kvflags=kvflags,
281             )

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
helm_release_is_present:
helm.release_present:
- name: release_name
- chart: repo/chart

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)
2022-01-17 09:34:27,399 [salt.state :2097][INFO ][4669] Executing state helm.release_present for [something]
2022-01-17 09:34:27,406 [salt.loaded.int.module.cmdmod:410 ][INFO ][4669] Executing command 'helm' in directory '/root'
2022-01-17 09:34:27,540 [salt.loaded.int.module.cmdmod:844 ][ERROR ][4669] Command 'helm' failed with return code: 1
2022-01-17 09:34:27,541 [salt.loaded.int.module.cmdmod:848 ][ERROR ][4669] stderr: Error: release: not found
2022-01-17 09:34:27,541 [salt.loaded.int.module.cmdmod:850 ][ERROR ][4669] retcode: 1

Expected behavior
A clear and concise description of what you expected to happen.

No ERROR with successful helm install

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3003.3
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: unknown
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10
       libgit2: 0.27.7
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: Not Installed
  pycryptodome: 3.6.1
        pygit2: 0.27.4
        Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1
 
System Versions:
          dist: debian 10 buster
        locale: utf-8
       machine: x86_64
       release: 5.4.109+
        system: Linux
       version: Debian GNU/Linux 10 buster

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.