diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index 9fc8eb49a..ac179f668 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -38,5 +38,6 @@ message Status { Code code = 1; google.protobuf.Any details = 2; - string cluster_status = 3; + // Cluster resources as kubectl would print them. + string resources = 3; } diff --git a/cmd/helm/status.go b/cmd/helm/status.go index cf407bbb6..436445642 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -68,7 +68,7 @@ func (s *statusCmd) run() error { fmt.Fprintf(s.out, "Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed)) fmt.Fprintf(s.out, "Status: %s\n", res.Info.Status.Code) - fmt.Fprintf(s.out, "Cluster Status:\n%s\n", res.Info.Status.ClusterStatus) + fmt.Fprintf(s.out, "Resources:\n%s\n", res.Info.Status.Resources) if res.Info.Status.Details != nil { fmt.Fprintf(s.out, "Details: %s\n", res.Info.Status.Details) } diff --git a/cmd/tiller/environment/environment.go b/cmd/tiller/environment/environment.go index 609a1d113..3c07e187d 100644 --- a/cmd/tiller/environment/environment.go +++ b/cmd/tiller/environment/environment.go @@ -147,7 +147,8 @@ type KubeClient interface { // by "\n---\n"). Create(namespace string, reader io.Reader) error - // Get gets one or more resources. + // Get gets one or more resources. Returned string hsa the format like kubectl + // provides with the column headers separating the resource types. // // namespace must contain a valid existing namespace. // @@ -192,6 +193,12 @@ func (p *PrintingKubeClient) Create(ns string, r io.Reader) error { return err } +// Get prints the values of what would be created with a real KubeClient. +func (p *PrintingKubeClient) Get(ns string, r io.Reader) (string, error) { + _, err := io.Copy(p.Out, r) + return "", err +} + // Delete implements KubeClient delete. // // It only prints out the content to be deleted. diff --git a/cmd/tiller/environment/environment_test.go b/cmd/tiller/environment/environment_test.go index ff82e2cc1..3d9060c11 100644 --- a/cmd/tiller/environment/environment_test.go +++ b/cmd/tiller/environment/environment_test.go @@ -80,6 +80,9 @@ type mockKubeClient struct { func (k *mockKubeClient) Create(ns string, r io.Reader) error { return nil } +func (k *mockKubeClient) Get(ns string, r io.Reader) (string, error) { + return nil +} func (k *mockKubeClient) Delete(ns string, r io.Reader) error { return nil } diff --git a/cmd/tiller/release_server.go b/cmd/tiller/release_server.go index f924cecf7..78888e8f2 100644 --- a/cmd/tiller/release_server.go +++ b/cmd/tiller/release_server.go @@ -165,10 +165,10 @@ func (s *releaseServer) GetReleaseStatus(c ctx.Context, req *services.GetRelease kubeCli := s.env.KubeClient resp, err := kubeCli.Get(rel.Namespace, bytes.NewBufferString(rel.Manifest)) if err != nil { - log.Printf("warning: COULDN'T FETCH %q failed: %s", rel.Name, err) + log.Printf("warning: Get for %s failed: %v", rel.Name, err) return nil, err } - rel.Info.Status.ClusterStatus = resp + rel.Info.Status.Resources = resp return &services.GetReleaseStatusResponse{Info: rel.Info}, nil } diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 66acd3ce2..cb7e4590b 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -77,14 +77,15 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { if err != nil { return err } - // We need to fetch the + // We need to grab the ObjectReference so we can correctly group the objects. or, err := api.GetReference(obj) if err != nil { log.Printf("FAILED GetReference for: %#v\n%v", obj, err) return err } - // Use APIVersion/Kind as grouping mechanism + // Use APIVersion/Kind as grouping mechanism. I'm not sure if you can have multiple + // versions per cluster, but this certainly won't hurt anything, so let's be safe. objType := or.APIVersion + "/" + or.Kind objs[objType] = append(objs[objType], obj) return nil @@ -97,6 +98,10 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { buf := new(bytes.Buffer) p := kubectl.NewHumanReadablePrinter(false, false, false, false, false, false, []string{}) for t, ot := range objs { + _, err = buf.WriteString("==> " + t + "\n") + if err != nil { + return "", err + } for _, o := range ot { err = p.PrintObj(o, buf) if err != nil { diff --git a/pkg/proto/hapi/release/status.pb.go b/pkg/proto/hapi/release/status.pb.go index 66a4345f5..33f418aac 100644 --- a/pkg/proto/hapi/release/status.pb.go +++ b/pkg/proto/hapi/release/status.pb.go @@ -51,9 +51,10 @@ func (Status_Code) EnumDescriptor() ([]byte, []int) { return fileDescriptor3, [] // Status defines the status of a release. type Status struct { - Code Status_Code `protobuf:"varint,1,opt,name=code,enum=hapi.release.Status_Code" json:"code,omitempty"` - Details *google_protobuf1.Any `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"` - ClusterStatus string `protobuf:"bytes,3,opt,name=cluster_status,json=clusterStatus" json:"cluster_status,omitempty"` + Code Status_Code `protobuf:"varint,1,opt,name=code,enum=hapi.release.Status_Code" json:"code,omitempty"` + Details *google_protobuf1.Any `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"` + // Cluster resources as kubectl would print them. + Resources string `protobuf:"bytes,3,opt,name=resources" json:"resources,omitempty"` } func (m *Status) Reset() { *m = Status{} } @@ -74,21 +75,21 @@ func init() { } var fileDescriptor3 = []byte{ - // 251 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x48, 0x2c, 0xc8, 0xd4, 0x2f, 0x4a, 0xcd, 0x49, 0x4d, 0x2c, 0x4e, 0xd5, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x49, 0xe9, 0x41, 0xa5, 0xa4, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0x72, 0x49, 0xa5, 0x69, 0xfa, 0x89, 0x79, 0x95, 0x10, 0x85, - 0x4a, 0xb7, 0x18, 0xb9, 0xd8, 0x82, 0xc1, 0x3a, 0x85, 0x74, 0xb9, 0x58, 0x92, 0xf3, 0x53, 0x52, + 0x4a, 0x17, 0x19, 0xb9, 0xd8, 0x82, 0xc1, 0x3a, 0x85, 0x74, 0xb9, 0x58, 0x92, 0xf3, 0x53, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0xf8, 0x8c, 0x24, 0xf5, 0x90, 0x8d, 0xd0, 0x83, 0xa8, 0xd1, 0x73, 0x06, 0x2a, 0x08, 0x02, 0x2b, 0x13, 0xd2, 0xe3, 0x62, 0x4f, 0x49, 0x2d, 0x49, 0xcc, 0xcc, 0x29, 0x96, 0x60, 0x02, 0xea, 0xe0, 0x36, 0x12, 0xd1, 0x83, 0x58, 0xa3, 0x07, 0xb3, 0x46, 0xcf, 0x31, - 0xaf, 0x32, 0x08, 0xa6, 0x48, 0x48, 0x95, 0x8b, 0x2f, 0x39, 0xa7, 0xb4, 0xb8, 0x24, 0xb5, 0x28, - 0x1e, 0xe2, 0x54, 0x09, 0x66, 0xa0, 0x36, 0xce, 0x20, 0x5e, 0xa8, 0x28, 0xc4, 0x06, 0x25, 0x2f, - 0x2e, 0x16, 0x90, 0x25, 0x42, 0xdc, 0x5c, 0xec, 0xa1, 0x7e, 0xde, 0x7e, 0xfe, 0xe1, 0x7e, 0x02, - 0x0c, 0x42, 0x3c, 0x5c, 0x1c, 0x2e, 0xae, 0x01, 0x3e, 0xfe, 0x91, 0xae, 0x2e, 0x02, 0x8c, 0x20, - 0x29, 0x17, 0x57, 0x1f, 0xd7, 0x10, 0x20, 0x87, 0x49, 0x88, 0x8f, 0x8b, 0x2b, 0x38, 0x34, 0xc0, - 0x35, 0x28, 0xd8, 0xd5, 0x05, 0xc8, 0x67, 0x16, 0xe2, 0xe2, 0x62, 0x73, 0x73, 0xf4, 0xf4, 0x01, - 0xb2, 0x59, 0x9c, 0x38, 0xa3, 0xd8, 0xa1, 0xee, 0x4f, 0x62, 0x03, 0x3b, 0xca, 0x18, 0x10, 0x00, - 0x00, 0xff, 0xff, 0xa0, 0xaf, 0xd3, 0x6a, 0x34, 0x01, 0x00, 0x00, + 0xaf, 0x32, 0x08, 0xa6, 0x48, 0x48, 0x86, 0x8b, 0xb3, 0x28, 0xb5, 0x38, 0xbf, 0xb4, 0x28, 0x39, + 0xb5, 0x58, 0x82, 0x19, 0xa8, 0x83, 0x33, 0x08, 0x21, 0xa0, 0xe4, 0xc5, 0xc5, 0x02, 0x32, 0x5b, + 0x88, 0x9b, 0x8b, 0x3d, 0xd4, 0xcf, 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x41, 0x88, 0x87, 0x8b, + 0xc3, 0xc5, 0x35, 0xc0, 0xc7, 0x3f, 0xd2, 0xd5, 0x45, 0x80, 0x11, 0x24, 0xe5, 0xe2, 0xea, 0xe3, + 0x1a, 0x02, 0xe4, 0x30, 0x09, 0xf1, 0x71, 0x71, 0x05, 0x87, 0x06, 0xb8, 0x06, 0x05, 0xbb, 0xba, + 0x00, 0xf9, 0xcc, 0x42, 0x5c, 0x5c, 0x6c, 0x6e, 0x8e, 0x9e, 0x3e, 0x40, 0x36, 0x8b, 0x13, 0x67, + 0x14, 0x3b, 0xd4, 0xd9, 0x49, 0x6c, 0x60, 0xb7, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd1, + 0xc3, 0xbf, 0x50, 0x2b, 0x01, 0x00, 0x00, }