Skip to content

Commit

Permalink
Support listing releases from all namespaces (kubepack#61)
Browse files Browse the repository at this point in the history
* Support listing releases from all namespaces
* List releases with all statuses if no status is given
  • Loading branch information
tamalsaha committed Oct 30, 2017
1 parent 5485a5a commit 175b678
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 131 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -13,7 +13,13 @@ GET http://127.0.0.1:9855/tiller/v2/version/json
- **Summarize releases**
```
# List releases from all namespaces
GET http://127.0.0.1:9855/tiller/v2/releases/json
# List releases from one namespace
GET http://127.0.0.1:9855/tiller/v2/releases/json?namespace=default
# List releases from all namespaces with list of statuses
GET http://127.0.0.1:9855/tiller/v2/releases/json?status_codes=DEPLOYED&&status_codes=DELETED
Available query parameters:
Expand Down
3 changes: 0 additions & 3 deletions _proto/swift/v2/tiller.proto
Expand Up @@ -162,9 +162,6 @@ message SummarizeReleasesRequest {

// Namespace is the filter to select releases only from a specific namespace.
string namespace = 7;

// if true, list releases with all status codes
bool all = 8;
}

// ListSort defines sorting fields on a release list.
Expand Down
4 changes: 0 additions & 4 deletions _proto/swift/v2/tiller.schema.json
Expand Up @@ -350,10 +350,6 @@
"v2SummarizeReleasesRequest": {
"description": "SummarizeReleasesRequest requests a list of releases.\n\nReleases can be retrieved in chunks by setting limit and offset.\n\nReleases can be sorted according to a few pre-determined sort stategies.",
"properties": {
"all": {
"title": "if true, list releases with all status codes",
"type": "boolean"
},
"filter": {
"description": "Filter is a regular expression used to filter which releases should be listed.\n\nAnything that matches the regexp will be included in the results.",
"type": "string"
Expand Down
13 changes: 0 additions & 13 deletions _proto/swift/v2/tiller.swagger.json
Expand Up @@ -688,11 +688,6 @@
"v2SummarizeReleasesRequest": {
"description": "SummarizeReleasesRequest requests a list of releases.\n\nReleases can be retrieved in chunks by setting limit and offset.\n\nReleases can be sorted according to a few pre-determined sort stategies.",
"properties": {
"all": {
"format": "boolean",
"title": "if true, list releases with all status codes",
"type": "boolean"
},
"filter": {
"description": "Filter is a regular expression used to filter which releases should be listed.\n\nAnything that matches the regexp will be included in the results.",
"type": "string"
Expand Down Expand Up @@ -939,14 +934,6 @@
"name": "namespace",
"required": false,
"type": "string"
},
{
"description": "if true, list releases with all status codes.",
"format": "boolean",
"in": "query",
"name": "all",
"required": false,
"type": "boolean"
}
],
"responses": {
Expand Down
4 changes: 0 additions & 4 deletions client/js/schemas/swift/v2/tiller.schema.json
Expand Up @@ -350,10 +350,6 @@
"v2SummarizeReleasesRequest": {
"description": "SummarizeReleasesRequest requests a list of releases.\n\nReleases can be retrieved in chunks by setting limit and offset.\n\nReleases can be sorted according to a few pre-determined sort stategies.",
"properties": {
"all": {
"title": "if true, list releases with all status codes",
"type": "boolean"
},
"filter": {
"description": "Filter is a regular expression used to filter which releases should be listed.\n\nAnything that matches the regexp will be included in the results.",
"type": "string"
Expand Down
6 changes: 6 additions & 0 deletions docs/README.md
Expand Up @@ -13,7 +13,13 @@ GET http://127.0.0.1:9855/tiller/v2/version/json
- **Summarize releases**
```
# List releases from all namespaces
GET http://127.0.0.1:9855/tiller/v2/releases/json
# List releases from one namespace
GET http://127.0.0.1:9855/tiller/v2/releases/json?namespace=default
# List releases from all namespaces with list of statuses
GET http://127.0.0.1:9855/tiller/v2/releases/json?status_codes=DEPLOYED&&status_codes=DELETED
Available query parameters:
Expand Down
192 changes: 91 additions & 101 deletions pkg/apis/swift/v2/tiller.pb.go

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions pkg/apis/swift/v2/tiller.schema.go
Expand Up @@ -650,10 +650,6 @@ func init() {
},
"description": "SummarizeReleasesRequest requests a list of releases.\n\nReleases can be retrieved in chunks by setting limit and offset.\n\nReleases can be sorted according to a few pre-determined sort stategies.",
"properties": {
"all": {
"title": "if true, list releases with all status codes",
"type": "boolean"
},
"filter": {
"description": "Filter is a regular expression used to filter which releases should be listed.\n\nAnything that matches the regexp will be included in the results.",
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions pkg/release/server.go
Expand Up @@ -34,14 +34,14 @@ func (s *Server) SummarizeReleases(ctx context.Context, req *proto.SummarizeRele
listReq := rls.ListReleasesRequest{
Filter: req.Filter,
Limit: req.Limit,
Namespace: stringz.Val(req.Namespace, core.NamespaceDefault),
Namespace: req.Namespace,
Offset: req.Offset,
SortBy: rls.ListSort_SortBy(rls.ListSort_SortBy_value[req.SortBy.String()]),
SortOrder: rls.ListSort_SortOrder(rls.ListSort_SortOrder_value[req.SortOrder.String()]),
StatusCodes: []hrls.Status_Code{},
}

if req.All { // list all releases
if len(req.StatusCodes) == 0 { // list all releases
listReq.StatusCodes = []hrls.Status_Code{
hrls.Status_UNKNOWN,
hrls.Status_DEPLOYED,
Expand Down

0 comments on commit 175b678

Please sign in to comment.