diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index 06952251c..84a744991 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -33,6 +33,8 @@ message Status { SUPERSEDED = 3; // Status_FAILED indicates that the release was not successfully deployed. FAILED = 4; + // Status_DELETING indicates that a delete operation is underway. + DELETING = 5; } Code code = 1; diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 928fc0ab4..845e8d15c 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -67,6 +67,7 @@ type listCmd struct { out io.Writer all bool deleted bool + deleting bool deployed bool failed bool superseded bool @@ -104,6 +105,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVarP(&list.offset, "offset", "o", "", "next release name in the list, used to offset from start value") f.BoolVar(&list.all, "all", false, "show all releases, not just the ones marked DEPLOYED") f.BoolVar(&list.deleted, "deleted", false, "show deleted releases") + f.BoolVar(&list.deleting, "deleting", false, "show releases that are currently being deleted") f.BoolVar(&list.deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled") f.BoolVar(&list.failed, "failed", false, "show failed releases") // TODO: Do we want this as a feature of 'helm list'? @@ -165,9 +167,7 @@ func (l *listCmd) statusCodes() []release.Status_Code { release.Status_UNKNOWN, release.Status_DEPLOYED, release.Status_DELETED, - // TODO: Should we return superseded records? These are records - // that were replaced by an upgrade. - //release.Status_SUPERSEDED, + release.Status_DELETING, release.Status_FAILED, } } @@ -178,6 +178,9 @@ func (l *listCmd) statusCodes() []release.Status_Code { if l.deleted { status = append(status, release.Status_DELETED) } + if l.deleting { + status = append(status, release.Status_DELETING) + } if l.failed { status = append(status, release.Status_FAILED) } diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index 3d1ffa1c9..4f9592f31 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -77,6 +77,16 @@ func TestListCmd(t *testing.T) { // See note on previous test. expected: "thomas-guide\natlas-guide", }, + { + name: "with a release, multiple flags, deleting", + args: []string{"--all", "-q"}, + resp: []*release.Release{ + releaseMock(&releaseOptions{name: "thomas-guide", statusCode: release.Status_DELETING}), + releaseMock(&releaseOptions{name: "atlas-guide", statusCode: release.Status_DEPLOYED}), + }, + // See note on previous test. + expected: "thomas-guide\natlas-guide", + }, } var buf bytes.Buffer diff --git a/pkg/proto/hapi/release/status.pb.go b/pkg/proto/hapi/release/status.pb.go index 79c721e31..7a919cdc0 100644 --- a/pkg/proto/hapi/release/status.pb.go +++ b/pkg/proto/hapi/release/status.pb.go @@ -27,6 +27,8 @@ const ( Status_SUPERSEDED Status_Code = 3 // Status_FAILED indicates that the release was not successfully deployed. Status_FAILED Status_Code = 4 + // Status_DELETING indicates that a delete operation is underway. + Status_DELETING Status_Code = 5 ) var Status_Code_name = map[int32]string{ @@ -35,6 +37,7 @@ var Status_Code_name = map[int32]string{ 2: "DELETED", 3: "SUPERSEDED", 4: "FAILED", + 5: "DELETING", } var Status_Code_value = map[string]int32{ "UNKNOWN": 0, @@ -42,6 +45,7 @@ var Status_Code_value = map[string]int32{ "DELETED": 2, "SUPERSEDED": 3, "FAILED": 4, + "DELETING": 5, } func (x Status_Code) String() string { @@ -79,22 +83,22 @@ func init() { func init() { proto.RegisterFile("hapi/release/status.proto", fileDescriptor3) } var fileDescriptor3 = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x8f, 0xc1, 0x4e, 0x83, 0x40, - 0x10, 0x86, 0xdd, 0x16, 0x41, 0xa6, 0x4d, 0x43, 0x36, 0x3d, 0x80, 0xf1, 0x40, 0x7a, 0xe2, 0xe2, - 0x92, 0xd4, 0x27, 0xa8, 0xee, 0x9a, 0xa8, 0x84, 0x36, 0x60, 0x63, 0xf4, 0x46, 0xcb, 0x58, 0x9b, - 0x10, 0xb6, 0x61, 0x97, 0x43, 0x9f, 0xd8, 0xd7, 0x30, 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0x5f, - 0xce, 0xe9, 0x99, 0x8d, 0x6d, 0x2e, 0x7c, 0xf8, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xae, 0x07, 0x47, - 0x1f, 0x41, 0x01, 0x00, 0x00, + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x8f, 0x4d, 0x6f, 0x82, 0x40, + 0x10, 0x86, 0xbb, 0x8a, 0x50, 0x46, 0x63, 0x36, 0x1b, 0x0f, 0xd0, 0xf4, 0x40, 0x3c, 0x71, 0xe9, + 0x92, 0xd8, 0x5f, 0x60, 0xbb, 0xdb, 0xc6, 0x94, 0xa0, 0x01, 0x4d, 0x3f, 0x6e, 0x28, 0x53, 0x6b, + 0x42, 0x58, 0xc3, 0xc2, 0xc1, 0x1f, 0xde, 0x7b, 0x03, 0x68, 0xea, 0x71, 0xf7, 0x79, 0xde, 0x79, + 0x67, 0xc0, 0xfd, 0x49, 0x8f, 0x87, 0xa0, 0xc4, 0x1c, 0x53, 0x8d, 0x81, 0xae, 0xd2, 0xaa, 0xd6, + 0xfc, 0x58, 0xaa, 0x4a, 0xb1, 0x51, 0x83, 0xf8, 0x19, 0xdd, 0xb9, 0x7b, 0xa5, 0xf6, 0x39, 0x06, + 0x2d, 0xdb, 0xd6, 0xdf, 0x41, 0x5a, 0x9c, 0x3a, 0x71, 0xfa, 0x4b, 0xc0, 0x4c, 0xda, 0x24, 0x7b, + 0x00, 0x63, 0xa7, 0x32, 0x74, 0x88, 0x47, 0xfc, 0xf1, 0xcc, 0xe5, 0xd7, 0x23, 0x78, 0xe7, 0xf0, + 0x67, 0x95, 0x61, 0xdc, 0x6a, 0x8c, 0x83, 0x95, 0x61, 0x95, 0x1e, 0x72, 0xed, 0xf4, 0x3c, 0xe2, + 0x0f, 0x67, 0x13, 0xde, 0xd5, 0xf0, 0x4b, 0x0d, 0x9f, 0x17, 0xa7, 0xf8, 0x22, 0xb1, 0x7b, 0xb0, + 0x4b, 0xd4, 0xaa, 0x2e, 0x77, 0xa8, 0x9d, 0xbe, 0x47, 0x7c, 0x3b, 0xfe, 0xff, 0x60, 0x13, 0x18, + 0x14, 0xaa, 0x42, 0xed, 0x18, 0x2d, 0xe9, 0x1e, 0xd3, 0x0f, 0x30, 0x9a, 0x46, 0x36, 0x04, 0x6b, + 0x13, 0xbd, 0x45, 0xcb, 0xf7, 0x88, 0xde, 0xb0, 0x11, 0xdc, 0x0a, 0xb9, 0x0a, 0x97, 0x9f, 0x52, + 0x50, 0xd2, 0x20, 0x21, 0x43, 0xb9, 0x96, 0x82, 0xf6, 0xd8, 0x18, 0x20, 0xd9, 0xac, 0x64, 0x9c, + 0x48, 0x21, 0x05, 0xed, 0x33, 0x00, 0xf3, 0x65, 0xbe, 0x08, 0xa5, 0xa0, 0x46, 0x17, 0x0b, 0xe5, + 0x7a, 0x11, 0xbd, 0xd2, 0xc1, 0x93, 0xfd, 0x65, 0x9d, 0x4f, 0xdb, 0x9a, 0xed, 0xbe, 0x8f, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x7b, 0x5f, 0x3b, 0x4f, 0x01, 0x00, 0x00, } diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 8df3a8991..e5266c509 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -946,7 +946,7 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR } log.Printf("uninstall: Deleting %s", req.Name) - rel.Info.Status.Code = release.Status_DELETED + rel.Info.Status.Code = release.Status_DELETING rel.Info.Deleted = timeconv.Now() res := &services.UninstallReleaseResponse{Release: rel} @@ -961,9 +961,8 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR return nil, fmt.Errorf("Could not get apiVersions from Kubernetes: %s", err) } - // From here on out, the release is currently considered to be in Status_DELETED - // state. See https://github.com/kubernetes/helm/issues/1511 for a better way - // to do this. + // From here on out, the release is currently considered to be in Status_DELETING + // state. if err := s.env.Releases.Update(rel); err != nil { log.Printf("uninstall: Failed to store updated release: %s", err) } @@ -1009,6 +1008,11 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR } } + rel.Info.Status.Code = release.Status_DELETED + if err := s.env.Releases.Update(rel); err != nil { + log.Printf("uninstall: Failed to store updated release: %s", err) + } + var errs error if len(es) > 0 { errs = fmt.Errorf("deletion completed with %d error(s): %s", len(es), strings.Join(es, "; "))