From 915e7023c402eb6ac48b8c8e25a6696b711e2a52 Mon Sep 17 00:00:00 2001 From: Aishwarya Thangappa Date: Thu, 13 Jul 2017 15:20:07 -0700 Subject: [PATCH] Added more granular statuses --- _proto/hapi/release/status.proto | 8 +++- cmd/helm/list.go | 6 ++- cmd/helm/list_test.go | 8 ++-- pkg/proto/hapi/release/status.pb.go | 70 ++++++++++++++++------------- pkg/tiller/release_install.go | 2 +- pkg/tiller/release_rollback.go | 2 +- pkg/tiller/release_update.go | 2 +- 7 files changed, 58 insertions(+), 40 deletions(-) diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index 2c82effaa..ef28a233c 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -37,8 +37,12 @@ message Status { FAILED = 4; // Status_DELETING indicates that a delete operation is underway. DELETING = 5; - // Status_PENDING indicates that an upgrade/rollback operation is underway. - PENDING = 6; + // Status_PENDING_INSTALL indicates that an install operation is underway. + PENDING_INSTALL = 6; + // Status_PENDING_UPGRADE indicates that an upgrade operation is underway. + PENDING_UPGRADE = 7; + // Status_PENDING_ROLLBACK indicates that an rollback operation is underway. + PENDING_ROLLBACK = 8; } Code code = 1; diff --git a/cmd/helm/list.go b/cmd/helm/list.go index e58015d23..f6cdaacfe 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -175,7 +175,9 @@ func (l *listCmd) statusCodes() []release.Status_Code { release.Status_DELETED, release.Status_DELETING, release.Status_FAILED, - release.Status_PENDING, + release.Status_PENDING_INSTALL, + release.Status_PENDING_UPGRADE, + release.Status_PENDING_ROLLBACK, } } status := []release.Status_Code{} @@ -195,7 +197,7 @@ func (l *listCmd) statusCodes() []release.Status_Code { status = append(status, release.Status_SUPERSEDED) } if l.pending { - status = append(status, release.Status_PENDING) + status = append(status, release.Status_PENDING_INSTALL, release.Status_PENDING_UPGRADE, release.Status_PENDING_ROLLBACK) } // Default case. diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index f0859e60a..5660eb26a 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -102,7 +102,7 @@ func TestListCmd(t *testing.T) { name: "with a pending release, multiple flags", args: []string{"--all", "-q"}, resp: []*release.Release{ - releaseMock(&releaseOptions{name: "thomas-guide", statusCode: release.Status_PENDING}), + releaseMock(&releaseOptions{name: "thomas-guide", statusCode: release.Status_PENDING_INSTALL}), releaseMock(&releaseOptions{name: "atlas-guide", statusCode: release.Status_DEPLOYED}), }, expected: "thomas-guide\natlas-guide", @@ -111,10 +111,12 @@ func TestListCmd(t *testing.T) { name: "with a pending release, pending flag", args: []string{"--pending", "-q"}, resp: []*release.Release{ - releaseMock(&releaseOptions{name: "thomas-guide", statusCode: release.Status_PENDING}), + releaseMock(&releaseOptions{name: "thomas-guide", statusCode: release.Status_PENDING_INSTALL}), + releaseMock(&releaseOptions{name: "wild-idea", statusCode: release.Status_PENDING_UPGRADE}), + releaseMock(&releaseOptions{name: "crazy-maps", statusCode: release.Status_PENDING_ROLLBACK}), releaseMock(&releaseOptions{name: "atlas-guide", statusCode: release.Status_DEPLOYED}), }, - expected: "thomas-guide", + expected: "thomas-guide\nwild-idea\ncrazy-maps", }, } diff --git a/pkg/proto/hapi/release/status.pb.go b/pkg/proto/hapi/release/status.pb.go index 8252ec163..284892642 100644 --- a/pkg/proto/hapi/release/status.pb.go +++ b/pkg/proto/hapi/release/status.pb.go @@ -28,8 +28,12 @@ const ( Status_FAILED Status_Code = 4 // Status_DELETING indicates that a delete operation is underway. Status_DELETING Status_Code = 5 - // Status_PENDING indicates that an upgrade/rollback operation is underway. - Status_PENDING Status_Code = 6 + // Status_PENDING_INSTALL indicates that an install operation is underway. + Status_PENDING_INSTALL Status_Code = 6 + // Status_PENDING_UPGRADE indicates that an upgrade operation is underway. + Status_PENDING_UPGRADE Status_Code = 7 + // Status_PENDING_ROLLBACK indicates that an rollback operation is underway. + Status_PENDING_ROLLBACK Status_Code = 8 ) var Status_Code_name = map[int32]string{ @@ -39,16 +43,20 @@ var Status_Code_name = map[int32]string{ 3: "SUPERSEDED", 4: "FAILED", 5: "DELETING", - 6: "PENDING", + 6: "PENDING_INSTALL", + 7: "PENDING_UPGRADE", + 8: "PENDING_ROLLBACK", } var Status_Code_value = map[string]int32{ - "UNKNOWN": 0, - "DEPLOYED": 1, - "DELETED": 2, - "SUPERSEDED": 3, - "FAILED": 4, - "DELETING": 5, - "PENDING": 6, + "UNKNOWN": 0, + "DEPLOYED": 1, + "DELETED": 2, + "SUPERSEDED": 3, + "FAILED": 4, + "DELETING": 5, + "PENDING_INSTALL": 6, + "PENDING_UPGRADE": 7, + "PENDING_ROLLBACK": 8, } func (x Status_Code) String() string { @@ -108,24 +116,26 @@ func init() { func init() { proto.RegisterFile("hapi/release/status.proto", fileDescriptor3) } var fileDescriptor3 = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xc1, 0x6a, 0xf2, 0x40, - 0x14, 0x85, 0xff, 0x68, 0x8c, 0xbf, 0x57, 0x91, 0x61, 0x5a, 0x68, 0x94, 0x16, 0xc4, 0x95, 0x9b, - 0x26, 0x60, 0x9f, 0xa0, 0xed, 0x8c, 0x45, 0x1a, 0xa2, 0x24, 0x91, 0xd2, 0x6e, 0x42, 0xd4, 0x5b, - 0x2b, 0x84, 0x8c, 0x64, 0x66, 0x16, 0x7d, 0x95, 0x3e, 0x6d, 0x99, 0x44, 0x48, 0x5d, 0x9e, 0x7c, - 0xdf, 0xc9, 0x3d, 0x0c, 0x8c, 0xbe, 0xb2, 0xd3, 0xd1, 0x2f, 0x31, 0xc7, 0x4c, 0xa2, 0x2f, 0x55, - 0xa6, 0xb4, 0xf4, 0x4e, 0xa5, 0x50, 0x82, 0x0e, 0x0c, 0xf2, 0xce, 0x68, 0x7c, 0x77, 0x21, 0x2a, - 0x94, 0x2a, 0x95, 0xfa, 0xa8, 0xb0, 0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1, 0x37, 0x00, 0x00, 0xff, - 0xff, 0x2b, 0x97, 0x66, 0xb2, 0x93, 0x01, 0x00, 0x00, + // 333 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xd1, 0x6e, 0xa2, 0x40, + 0x14, 0x86, 0x17, 0x45, 0xd4, 0xa3, 0x71, 0x27, 0xa3, 0xc9, 0xa2, 0xd9, 0x4d, 0x8c, 0x57, 0xde, + 0x2c, 0x24, 0xf6, 0x09, 0xd0, 0x19, 0x0d, 0x71, 0x82, 0x04, 0x30, 0x4d, 0x7b, 0x43, 0x50, 0xa7, + 0xd6, 0xc4, 0x30, 0x86, 0x19, 0x2e, 0xfa, 0x26, 0x7d, 0xaa, 0x3e, 0x53, 0x03, 0xd8, 0xa8, 0x97, + 0xff, 0xff, 0x7d, 0x87, 0x73, 0x18, 0x18, 0xbe, 0x27, 0x97, 0x93, 0x9d, 0xf1, 0x33, 0x4f, 0x24, + 0xb7, 0xa5, 0x4a, 0x54, 0x2e, 0xad, 0x4b, 0x26, 0x94, 0xc0, 0xdd, 0x02, 0x59, 0x57, 0x34, 0xfa, + 0xf7, 0x20, 0x2a, 0x2e, 0x55, 0x2c, 0xf3, 0x93, 0xe2, 0x95, 0x3c, 0x1a, 0x1e, 0x85, 0x38, 0x9e, + 0xb9, 0x5d, 0xa6, 0x5d, 0xfe, 0x66, 0x27, 0xe9, 0x47, 0x85, 0x26, 0x5f, 0x35, 0x30, 0xc2, 0xf2, + 0xc3, 0xf8, 0x3f, 0xe8, 0x7b, 0x71, 0xe0, 0xa6, 0x36, 0xd6, 0xa6, 0xbd, 0xd9, 0xd0, 0xba, 0xdf, + 0x60, 0x55, 0x8e, 0xb5, 0x10, 0x07, 0x1e, 0x94, 0x1a, 0xfe, 0x0b, 0xed, 0x8c, 0x4b, 0x91, 0x67, + 0x7b, 0x2e, 0xcd, 0xfa, 0x58, 0x9b, 0xb6, 0x83, 0x5b, 0x81, 0x07, 0xd0, 0x48, 0x85, 0xe2, 0xd2, + 0xd4, 0x4b, 0x52, 0x05, 0xbc, 0x84, 0xfe, 0x39, 0x91, 0x2a, 0xbe, 0x5d, 0x18, 0x67, 0x79, 0x6a, + 0x36, 0xc6, 0xda, 0xb4, 0x33, 0xfb, 0xf3, 0xb8, 0x31, 0xe2, 0x52, 0x85, 0x85, 0x12, 0xa0, 0x62, + 0xe6, 0x16, 0xf3, 0x74, 0xf2, 0xa9, 0x81, 0x5e, 0x9c, 0x82, 0x3b, 0xd0, 0xdc, 0x7a, 0x6b, 0x6f, + 0xf3, 0xec, 0xa1, 0x5f, 0xb8, 0x0b, 0x2d, 0x42, 0x7d, 0xb6, 0x79, 0xa1, 0x04, 0x69, 0x05, 0x22, + 0x94, 0xd1, 0x88, 0x12, 0x54, 0xc3, 0x3d, 0x80, 0x70, 0xeb, 0xd3, 0x20, 0xa4, 0x84, 0x12, 0x54, + 0xc7, 0x00, 0xc6, 0xd2, 0x71, 0x19, 0x25, 0x48, 0xaf, 0xc6, 0x18, 0x8d, 0x5c, 0x6f, 0x85, 0x1a, + 0xb8, 0x0f, 0xbf, 0x7d, 0xea, 0x11, 0xd7, 0x5b, 0xc5, 0xae, 0x17, 0x46, 0x0e, 0x63, 0xc8, 0xb8, + 0x2f, 0xb7, 0xfe, 0x2a, 0x70, 0x08, 0x45, 0x4d, 0x3c, 0x00, 0xf4, 0x53, 0x06, 0x1b, 0xc6, 0xe6, + 0xce, 0x62, 0x8d, 0x5a, 0xf3, 0xf6, 0x6b, 0xf3, 0xfa, 0x07, 0x3b, 0xa3, 0x7c, 0xe2, 0xa7, 0xef, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x09, 0x48, 0x18, 0xba, 0xc7, 0x01, 0x00, 0x00, } diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index dd5d88d82..8e7fd3acd 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -116,7 +116,7 @@ func (s *ReleaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re Info: &release.Info{ FirstDeployed: ts, LastDeployed: ts, - Status: &release.Status{Code: release.Status_PENDING}, + Status: &release.Status{Code: release.Status_PENDING_INSTALL}, Description: "Initial install underway", // Will be overwritten. }, Manifest: manifestDoc.String(), diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index 512aa3b11..2100f145a 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -102,7 +102,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* FirstDeployed: crls.Info.FirstDeployed, LastDeployed: timeconv.Now(), Status: &release.Status{ - Code: release.Status_PENDING, + Code: release.Status_PENDING_ROLLBACK, Notes: prls.Info.Status.Notes, }, // Because we lose the reference to rbv elsewhere, we set the diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 37c0d88eb..d6f35ecb8 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -123,7 +123,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele Info: &release.Info{ FirstDeployed: currentRelease.Info.FirstDeployed, LastDeployed: ts, - Status: &release.Status{Code: release.Status_PENDING}, + Status: &release.Status{Code: release.Status_PENDING_UPGRADE}, Description: "Preparing upgrade", // This should be overwritten later. }, Version: revision,