Skip to content

Install flag of the Upgrade action is not working on the sdk #7807

Closed

Description

@Nitive

Not working code example

Code

upgrade := action.NewUpgrade(actionConfig)
upgrade.Install = true

upgrade.Run("release", chart, values)

Expected result: chart deployed
Actual result: Error: release has no deployed releases

It's a rough example, but it seems to be enough for understanding the problem.
Happy to provide repository with minimal but complete code needed for reproduction if there is need for it.

Cause of bug

This happens because install flag logic implemented in “main” package and tightly coupled with cli:

helm/cmd/helm/upgrade.go

Lines 93 to 97 in 193850a

if client.Install {
// If a release does not exist, install it.
histClient := action.NewHistory(cfg)
histClient.Max = 1
if _, err := histClient.Run(args[0]); err == driver.ErrReleaseNotFound {


Helm sdk version: 3.1.2

Activity

  1. liuming-dev commented on Mar 25, 2020

    @liuming-dev
    Contributor

    Actual result: Error: release has no deployed releases
    this message tells us that the release exists, but status is not deployed.

    helm upgrade --install install flag will work when no release exists.

  2. Nitive commented on Mar 25, 2020

    @Nitive
    Author

    @Liuming-tech cli is working fine, the issue is with go sdk usage

  3. technosophos commented on Mar 28, 2020

    @technosophos
    Member

    The Install flag on action/upgrade.go does not do an install if the release is not present. See cmd/upgrade.go to see how helm upgrade --install works.

    The action's Upgrade.Install flag could definitely use some documentation. That is confusing.

    Update: I submitted before explaining. Sorry. Upgrade.Install is just a flag that can be used for asking whether the Upgrade operation was called as a regular upgrade or as an install-or-upgrade. It is informational, and doesn't do anything.

  4. Nitive commented on Mar 29, 2020

    @Nitive
    Author

    @technosophos, I can see that it works that way but there is two problems with that

    1. To make upgrade --install from go sdk I have to repeat cmd/upgrade.go logic in my application
    2. Like you said, current behavior is confusing and do not align with other actions

    I could change the code to respect Install flag and create a PR, but it would be a breaking change. Minor one, but still. If I do create a PR, would it be considered to be a part of helm v3 or it have to be postponed until helm v4?

  5. github-actions commented on Aug 21, 2020

    @github-actions

    This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

  6. bridgetkromhout commented on Aug 27, 2020

    @bridgetkromhout
    Member

    Hi, @Nitive - as you may have seen, we added an inline explanation in #7834.

    The Helm project does follow strict SemVer so if we are going to make a breaking change, it will be in Helm v4. I'll resolve this issue at this time, and if you decide that working on v4 is something you'd like to do, we'd welcome your participation. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions