Commit graph

30 commits

Author SHA1 Message Date
suzaku
d76f86b01c Add support helm list --no-headers
Signed-off-by: suzaku <satorulogic@gmail.com>

Add test

Signed-off-by: suzaku <satorulogic@gmail.com>

Revert change to value semantic

Signed-off-by: satoru <satorulogic@gmail.com>
2022-03-26 09:07:18 +08:00
Daniel Lipovetsky
1da2212a9d
Add explanatory comments to action.List and action.History
While the comments may seem to state the obvious to someone with helm CLI
experience, an SDK-first user may find these comments helpful.

Signed-off-by: Daniel Lipovetsky <dlipovetsky@d2iq.com>
2020-12-18 15:16:50 -08:00
Abhilash Gnan
c5e9732a9f rename to time format flag
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2020-09-23 22:32:06 +02:00
Abhilash Gnan
f61332f379 add time-format flag to list command
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2020-09-23 22:32:05 +02:00
Dmitry Chepurovskiy
266c74f390
Move selector filtering after latest release version filtering
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
2020-08-04 18:20:53 +03:00
Dmitry Chepurovskiy
09172b468a
Fix linting issues
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
2020-08-04 18:18:50 +03:00
Dmitry Chepurovskiy
357a0785bc
Added selector filtering
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
2020-08-04 18:18:50 +03:00
Dmitry Chepurovskiy
edc7d8ea32
Added selector option to list command
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
2020-08-04 18:18:49 +03:00
Andrew Melis
f9d35242d0 Enhance readability by extracting bitwise operation
Fixes https://github.com/helm/helm/pull/8282#discussion_r458368780

Signed-off-by: Andrew Melis <andrewmelis@gmail.com>
2020-07-22 12:23:44 -04:00
Andrew Melis
70f89e5f26 Make helm ls return only current releases if providing state filter
Previously, the `helm ls --$state` operation would display outdated
releases under certain conditions.

Given the following set of releases:
```
NAME  REVISION  UPDATED                   STATUS    CHART      APP VERSION  NAMESPACE
bar   1         Wed Apr  8 16:54:39 2020  DEPLOYED  bar-4.0.0  1.0          default
foo   1         Fri Feb  7 06:16:56 2020  DEPLOYED  foo-0.1.0  1.0          default
foo   2         Mon May  4 07:16:56 2020  FAILED    foo-0.1.0  1.0          default
foo   3         Mon May  4 07:20:00 2020  FAILED    foo-0.1.0  1.0          default
foo   4         Tue May  5 08:16:56 2020  DEPLOYED  foo-0.2.0  1.0          default
qux   1         Tue Jun  9 10:32:00 2020  DEPLOYED  qux-4.0.3  1.0          default
qux   2         Tue Jun  9 10:57:00 2020  FAILED    qux-4.0.3  1.0          default
```

`helm ls --failed` produced the following output:
```
NAME  REVISION  UPDATED                   STATUS    CHART      APP VERSION  NAMESPACE
foo   3         Mon May  4 07:20:00 2020  FAILED    foo-0.1.0  1.0          default
qux   2         Tue Jun  9 10:57:00 2020  FAILED    qux-4.0.0  1.0          default
```

Including the `qux` release in that `helm ls --failed` output is not
controversial; the most recent revision of `qux` was not successful
and an operator should investigate.

Including the `foo` release in the output, however, is
questionable. Revision 3 of `foo` is _not_ the most recent release of
`foo`, and that FAILED release was fixed in a susubsequent upgrade. A
user may see that FAILED deploy and start taking inappropriate
action. Further, that issue was fixed months ago in this example --
troubleshooting an old deploy may not be safe if significant changes
have occurred. Concern over this behavior was raised in
https://github.com/helm/helm/issues/7495.

This behavior applied to all the state filter flags (--deployed,
--failed, --pending, etc.), and a user could pass multiple state
filter flags to a single command. The previous behavior can be
summarized as follows:

For each release name, all release revisions having any of the
supplied state flags were retrieved, and the most recent revision
among these was returned (regardless of whether a newer revision of an
unspecified state exists).

This change request alters the helm list action to match user
expectations such that only "current" releases are shown when
filtering on release state. After this change, the following output
would be produced by `helm ls --failed`:

```
NAME  REVISION  UPDATED                   STATUS    CHART      APP VERSION  NAMESPACE
qux   2         Tue Jun  9 10:57:00 2020  FAILED    qux-4.0.0  1.0          default
```
The command now returns only `qux` because it is the only "current" FAILED release.

This behavior change applies to all the state filters _except_
`superseded`, which now becomes a special case. By definition, at
least one newer release exists ahead of each superseded release. A
conditional is included in this change request to maintain the
preexisting behavior (return "most recent" superseded revison for
each release name) if the superseded state filter is requested.

---

Note that there is an alternate perspective that a state filter flag
should return all releases of a given state rather than only the
"current" releases. In the above example, `helm ls --failed` with this
approach would return the following:
```
NAME  REVISION  UPDATED                   STATUS    CHART      APP VERSION  NAMESPACE
foo   2         Mon May  4 07:16:56 2020  FAILED    foo-0.1.0  1.0          default
foo   3         Mon May  4 07:20:00 2020  FAILED    foo-0.1.0  1.0          default
qux   2         Tue Jun  9 10:57:00 2020  FAILED    qux-4.0.0  1.0          default
```
Multiple FAILED `foo` revisions are included in the output, unlike the current behavior.

This approach is logical and achievable. It allows a user to find
exactly what is requested: all historical releases of a given
state. In order to achieve continuity with helm behavior, however, a
new filter (something like "current") would probably need to be
implemented and become the new default.

Given current helm behavior as well as the comments in the #7495, I
did not pursue this approach.

---

Technical details:

 - Moved list action state mask filter after latest release filter

Previously, the list operation in helm/pkg/action/list.go skipped
releases that were not covered by the state mask on _retrieval_ from
the Releases store:

```
results, err := l.cfg.Releases.List(func(rel *release.Release) bool {
		// Skip anything that the mask doesn't cover
		currentStatus := l.StateMask.FromName(rel.Info.Status.String())
		if l.StateMask&currentStatus == 0 {
			return false
		}
                ...
```
8ea6b970ec/pkg/action/list.go (L154-L159)

While filtering on retrieval in this manner avoided an extra iteration
through the entire list to check on the supplied condition later, it
introduced the possibility of returning an outdated release to the
user because newer releases (that would have otherwise squashed
outdated releases in the `filterList` function) are simply not
included in the set of working records.

This change moves the state mask filtering process to _after_ the set
of current releases is built. Outdated, potentially misleading
releases are scrubbed out prior to the application of the state mask
filter.

As written, this state mask filtration (in the new `filterStateMask`
method on `*List`) incurs an additional, potentially expensive
iteration over the set of releases to return to the user. An
alternative approach could avoid that extra iteration and fit this
logic into the existing `filterList` function at the cost of making
`filterList` function a little harder to understand.

 - Rename filterList to filterLatestReleases for clarity

Another function that filters the list is added, so update
to the more descriptive name here.

 - List superseded releases without filtering for latest

This change makes superseded releases a special case, as they would
_never_ be displayed otherwise (by definition, as superseded releases have been
replaced by a newer release), so a conditional maintains current
behavior ("return newest superseded revision for each release name")

Fixes #7495.

Signed-off-by: Andrew Melis <andrewmelis@gmail.com>
2020-06-10 05:08:22 -04:00
Song Shukun
1ff7202a98 Fix output of list action when it is failed
Signed-off-by: Song Shukun <song.shukun@fujitsu.com>
2020-02-20 20:55:04 +09:00
Song Shukun
e9f40ed7a5 fix golint failure in pkg/action
Signed-off-by: Song Shukun <song.shukun@fujitsu.com>
2020-02-18 23:15:56 +09:00
LongKB
1d79ed2c18
Fix some spelling errors in comment (#7492)
Although it is spelling mistakes, it might make an affects while reading.

Signed-off-by: Kim Bao Long <longkb@vn.fujitsu.com>
2020-01-30 11:19:10 +00:00
Josh Soref
02ad2b1187 Spelling (#7258)
* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cryptographic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesnot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: don't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unexpected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dreadnought

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: default

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: envvars

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: evaluates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: execute

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: extractor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: frobnitz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabba

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: keywords

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: override

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: package

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: progress

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recursively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: release

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cache

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: serializer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subchart

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utilities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2019-12-18 12:04:08 +00:00
Karuppiah Natarajan
bfd8250803 fix list not showing multiple releases with same name in different namespaces (#6756)
Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2019-10-24 14:34:48 +01:00
Taylor Thomas
3d64c6bb54 ref(cmd): Implement flag parsing for output format
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-07 12:58:36 -06:00
Matt Farina
9bc7934f35
Updating the module for v3 as the major version
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-10-03 14:27:05 -04:00
Taylor Thomas
eac6a60001 feat(*): Ports all output functionality from v2
As part of this port, I removed some now superfluous code from the `action` package.
This is technically a breaking change, but since the package was introduced in v3, it
is highly unlikely anyone is using it and we are still within the beta window.

Also closes #6437

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-09-25 16:07:10 -06:00
Matthew Fisher
4971ed5077
fix(list): scrub list returned from .List()
This way only the latest release is displayed with `helm list`.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-09-23 15:00:16 -07:00
Vibhav Bobade
d00e328020 Applied check to actions
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
2019-08-27 04:16:02 +05:30
Adam Reese
b2d5e41fc7
ref(*): remove dead code
Signed-off-by: Adam Reese <adam@reese.io>
2019-08-19 10:22:27 -07:00
Abhilash Gnan
f019ec0e8d add superseded to list filter mask
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2019-04-04 23:57:03 +02:00
Abhilash Gnan
416667a8e9 Remove redundant ByNameAsc enum value. Handled by default sorting
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2019-04-03 19:58:57 +02:00
Abhilash Gnan
b9a39e46de handle default list sort order through enum order
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2019-04-02 22:40:31 +02:00
Abhilash Gnan
d3c85f97c2 fix sort list with options bug
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
2019-04-02 21:14:13 +02:00
Matthew Fisher
32712201ec
ref(list): move namespaces field closer to the name
Most users want to see the release name and the namespace it was deployed to,
as those are the unique identifiers where the release is stored. I also added
integration tests for `helm list` to better test the command output.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-03-20 13:43:22 -07:00
Adam Reese
895e9192d4
feat(*): use vanity import helm.sh/helm
Signed-off-by: Adam Reese <adam@reese.io>
2019-03-13 13:43:47 -07:00
Matthew Fisher
f185103b60
ref(action): move AddFlags functions back to cmd
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-03-13 08:58:35 -07:00
Matthew Fisher
2571dbf82f
ref: remove pkg/helm, pkg/hapi, pkg/tiller
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-03-12 09:47:12 -07:00
Matt Butcher
425f7a6f6c
feat: add 'pkg/action' for list operations (#5077)
* feat: add pkg/action to encapsulate action logic

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* feat: replace client/server internals with action package

While we removed Tiller, we left the internal client/server architecture mostly intact. This replaces that architecture with the `pkg/action` package.

This implements the action package for list, but nothing else.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* feat: Add install and refactor some tests

This adds install to the action package, and then fixes up a lot of testing.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fix: Move a bunch of sorters to the releaseutils package

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fix: updated APIs and fixed a failed test

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* Use var for timestamper, instead of adding as a struct field

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2019-01-07 17:45:14 -07:00