Merge pull request #4340 from adshmh/4321-feat-helm-sort-releases-by-chart-name

feat(helm): add ability to sort release list by chart name
pull/4078/head
Matthew Fisher 6 years ago committed by GitHub
commit 8a72628beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -124,6 +124,7 @@ message ListSort{
UNKNOWN = 0;
NAME = 1;
LAST_RELEASED = 2;
CHART_NAME = 3;
}
// SortOrder defines sort orders to augment sorting operations.

@ -78,6 +78,7 @@ type listCmd struct {
client helm.Interface
colWidth uint
output string
byChartName bool
}
type listResult struct {
@ -133,6 +134,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace")
f.UintVar(&list.colWidth, "col-width", 60, "specifies the max column width of output")
f.StringVar(&list.output, "output", "", "output the specified format (json or yaml)")
f.BoolVarP(&list.byChartName, "chart-name", "c", false, "sort by chart name")
// TODO: Do we want this as a feature of 'helm list'?
//f.BoolVar(&list.superseded, "history", true, "show historical releases")
@ -145,6 +147,9 @@ func (l *listCmd) run() error {
if l.byDate {
sortBy = services.ListSort_LAST_RELEASED
}
if l.byChartName {
sortBy = services.ListSort_CHART_NAME
}
sortOrder := services.ListSort_ASC
if l.sortDesc {

@ -39,6 +39,7 @@ helm list [flags] [FILTER]
```
-a, --all show all releases, not just the ones marked DEPLOYED
-c, --chart-name sort by chart name
--col-width uint specifies the max column width of output (default 60)
-d, --date sort by release date
--deleted show deleted releases
@ -77,4 +78,4 @@ helm list [flags] [FILTER]
* [helm](helm.md) - The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on 10-Aug-2018
###### Auto generated by spf13/cobra on 1-Sep-2018

@ -66,17 +66,20 @@ const (
ListSort_UNKNOWN ListSort_SortBy = 0
ListSort_NAME ListSort_SortBy = 1
ListSort_LAST_RELEASED ListSort_SortBy = 2
ListSort_CHART_NAME ListSort_SortBy = 3
)
var ListSort_SortBy_name = map[int32]string{
0: "UNKNOWN",
1: "NAME",
2: "LAST_RELEASED",
3: "CHART_NAME",
}
var ListSort_SortBy_value = map[string]int32{
"UNKNOWN": 0,
"NAME": 1,
"LAST_RELEASED": 2,
"CHART_NAME": 3,
}
func (x ListSort_SortBy) String() string {
@ -110,7 +113,7 @@ func (ListSort_SortOrder) EnumDescriptor() ([]byte, []int) { return fileDescript
//
// Releases can be retrieved in chunks by setting limit and offset.
//
// Releases can be sorted according to a few pre-determined sort stategies.
// Releases can be sorted according to a few pre-determined sort strategies.
type ListReleasesRequest struct {
// Limit is the maximum number of releases to be returned.
Limit int64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"`
@ -609,9 +612,9 @@ type InstallReleaseRequest struct {
Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
// DisableHooks causes the server to skip running any hooks for the install.
DisableHooks bool `protobuf:"varint,5,opt,name=disable_hooks,json=disableHooks" json:"disable_hooks,omitempty"`
// Namepace is the kubernetes namespace of the release.
// Namespace is the kubernetes namespace of the release.
Namespace string `protobuf:"bytes,6,opt,name=namespace" json:"namespace,omitempty"`
// ReuseName requests that Tiller re-uses a name, instead of erroring out.
// Reuse_name requests that Tiller re-uses a name, instead of erroring out.
ReuseName bool `protobuf:"varint,7,opt,name=reuse_name,json=reuseName" json:"reuse_name,omitempty"`
// timeout specifies the max amount of time any kubernetes client command can run.
Timeout int64 `protobuf:"varint,8,opt,name=timeout" json:"timeout,omitempty"`
@ -1412,85 +1415,85 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 1267 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x6e, 0xe3, 0x44,
0x17, 0x6e, 0xe2, 0x7c, 0x9e, 0x74, 0xf3, 0x66, 0x67, 0xb3, 0xad, 0xeb, 0x77, 0x41, 0xc1, 0x08,
0x36,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ec, 0x6b, 0x09, 0x6d, 0xb5, 0x8d, 0xa1, 0x1c, 0x03, 0x99, 0x6f, 0x8c, 0xf1,
0x71, 0x31, 0xe5, 0xd8, 0x1d, 0x81, 0x4e, 0xba, 0x87, 0xe4, 0xf1, 0x98, 0xd3, 0x11, 0xf3, 0x78,
0xcc, 0x6b, 0x4d, 0xe6, 0x16, 0xb2, 0x01, 0x6e, 0x5a, 0x08, 0x7a, 0x9c, 0x4b, 0x88, 0xda, 0x79,
0x8c, 0xfe, 0xed, 0x8a, 0xb1, 0x8b, 0x15, 0xfc, 0x2f, 0xf5, 0xa2, 0xa3, 0x1c, 0x68, 0xb2, 0x07,
0x20, 0xe3, 0x59, 0x41, 0xed, 0x54, 0x52, 0xa2, 0x2b, 0x6d, 0x48, 0x4a, 0x6d, 0x79, 0x1b, 0x92,
0x4a, 0x35, 0x38, 0x73, 0x0b, 0x39, 0xd0, 0xb6, 0x42, 0x4f, 0xb8, 0x8e, 0xda, 0x02, 0xca, 0x39,
0xbd, 0xde, 0xd5, 0x8c, 0x27, 0x05, 0x34, 0x6f, 0xea, 0xfb, 0x39, 0x7c, 0xdf, 0x90, 0xaa, 0xe7,
0x35, 0xf6, 0x5f, 0xf8, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x73, 0x4f, 0x4d, 0x73,
0x10, 0x00, 0x00,
// 1276 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0x44,
0x14, 0x6e, 0xe2, 0xfc, 0x9e, 0x74, 0x43, 0x76, 0x36, 0xdb, 0x7a, 0xcd, 0x82, 0x82, 0x11, 0x6c,
0x76, 0x61, 0x53, 0x08, 0xdc, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, 0xed,
0x22, 0x21, 0x50, 0xe4, 0x26, 0x93, 0x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b4, 0x98, 0x72, 0xec, 0x8e, 0x40, 0x27,
0xdd, 0x43, 0xf2, 0x78, 0xcc, 0xe9, 0x88, 0x79, 0x3c, 0xe6, 0xb5, 0x26, 0x73, 0x0b, 0xd9, 0x00,
0x37, 0x2d, 0x04, 0x3d, 0xc9, 0x25, 0x44, 0xed, 0x3c, 0x46, 0xff, 0x76, 0xc5, 0xd8, 0xc5, 0x0a,
0xde, 0x49, 0xbd, 0xe8, 0x28, 0x07, 0x9a, 0xec, 0x01, 0xc8, 0x78, 0x5e, 0x50, 0x3b, 0x95, 0x94,
0xe8, 0x4a, 0x1b, 0x92, 0x52, 0x5b, 0xde, 0x86, 0xa4, 0x52, 0x0d, 0xce, 0xdc, 0x42, 0x0e, 0xb4,
0xad, 0xd0, 0x13, 0xae, 0xa3, 0xb6, 0x80, 0x72, 0x4e, 0xaf, 0x77, 0x35, 0xe3, 0x69, 0x01, 0xcd,
0x9b, 0xfa, 0x7e, 0x01, 0x3f, 0x36, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x57, 0xfe, 0xc5, 0x7f, 0x01,
0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0x4c, 0x12, 0x83, 0x10, 0x00, 0x00,
}

@ -75,3 +75,26 @@ func SortByRevision(list []*rspb.Release) {
}
sort.Sort(s)
}
// SortByChartName sorts the list of releases by a
// release's chart name in lexicographical order.
func SortByChartName(list []*rspb.Release) {
s := &sorter{list: list}
s.less = func(i, j int) bool {
chi := s.list[i].Chart
chj := s.list[j].Chart
ni := ""
if chi != nil && chi.Metadata != nil {
ni = chi.Metadata.Name
}
nj := ""
if chj != nil && chj.Metadata != nil {
nj = chj.Metadata.Name
}
return ni < nj
}
sort.Sort(s)
}

@ -20,6 +20,7 @@ import (
"testing"
"time"
"k8s.io/helm/pkg/proto/hapi/chart"
rspb "k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/timeconv"
)
@ -40,6 +41,11 @@ func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code
Name: name,
Version: vers,
Info: info,
Chart: &chart.Chart{
Metadata: &chart.Metadata{
Name: name,
},
},
}
}
@ -80,3 +86,13 @@ func TestSortByRevision(t *testing.T) {
return vi < vj
})
}
func TestSortByChartName(t *testing.T) {
SortByChartName(releases)
check(t, "ByChartName", func(i, j int) bool {
ni := releases[i].Chart.Metadata.Name
nj := releases[j].Chart.Metadata.Name
return ni < nj
})
}

@ -65,6 +65,8 @@ func (s *ReleaseServer) ListReleases(req *services.ListReleasesRequest, stream s
relutil.SortByName(rels)
case services.ListSort_LAST_RELEASED:
relutil.SortByDate(rels)
case services.ListSort_CHART_NAME:
relutil.SortByChartName(rels)
}
if req.SortOrder == services.ListSort_DESC {

@ -20,6 +20,7 @@ import (
"fmt"
"testing"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/proto/hapi/services"
)
@ -147,6 +148,48 @@ func TestListReleasesSort(t *testing.T) {
}
}
func TestListReleasesSortByChartName(t *testing.T) {
rs := rsFixture()
// Put them in by reverse order so that the mock doesn't "accidentally"
// sort.
num := 7
for i := num; i > 0; i-- {
rel := releaseStub()
rel.Name = fmt.Sprintf("rel-%d", num-i)
rel.Chart = &chart.Chart{
Metadata: &chart.Metadata{
Name: fmt.Sprintf("chartName-%d", i),
},
}
if err := rs.env.Releases.Create(rel); err != nil {
t.Fatalf("Could not store mock release: %s", err)
}
}
limit := 6
mrs := &mockListServer{}
req := &services.ListReleasesRequest{
Offset: "",
Limit: int64(limit),
SortBy: services.ListSort_CHART_NAME,
}
if err := rs.ListReleases(req, mrs); err != nil {
t.Fatalf("Failed listing: %s", err)
}
if len(mrs.val.Releases) != limit {
t.Errorf("Expected %d releases, got %d", limit, len(mrs.val.Releases))
}
for i := 0; i < limit; i++ {
n := fmt.Sprintf("chartName-%d", i+1)
if mrs.val.Releases[i].Chart.Metadata.Name != n {
t.Errorf("Expected %q, got %q", n, mrs.val.Releases[i].Chart.Metadata.Name)
}
}
}
func TestListReleasesFilter(t *testing.T) {
rs := rsFixture()
names := []string{

Loading…
Cancel
Save