Store Username added in ReleaseInfo (#5)

pull/2012/head
saumanbiswas 9 years ago committed by sauman
parent ba83a84167
commit 6a4054de27

@ -34,4 +34,7 @@ message Info {
// Description is human-friendly "log entry" about this release. // Description is human-friendly "log entry" about this release.
string Description = 5; string Description = 5;
// Username is the authenticated user who performed this release.
string Username = 6;
} }

@ -38,11 +38,11 @@ configures the maximum length of the revision list returned.
The historical release set is printed as a formatted table, e.g: The historical release set is printed as a formatted table, e.g:
$ helm history angry-bird --max=4 $ helm history angry-bird --max=4
REVISION UPDATED STATUS CHART DESCRIPTION REVISION UPDATED STATUS CHART DESCRIPTION RELEASED BY
1 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Initial install 1 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Initial install x
2 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Upgraded successfully 2 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Upgraded successfully y
3 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Rolled back to 2 3 Mon Oct 3 10:15:13 2016 SUPERSEDED alpine-0.1.0 Rolled back to 2 z
4 Mon Oct 3 10:15:13 2016 DEPLOYED alpine-0.1.0 Upgraded successfully 4 Mon Oct 3 10:15:13 2016 DEPLOYED alpine-0.1.0 Upgraded successfully x
` `
type historyCmd struct { type historyCmd struct {
@ -98,7 +98,7 @@ func (cmd *historyCmd) run() error {
func formatHistory(rls []*release.Release) string { func formatHistory(rls []*release.Release) string {
tbl := uitable.New() tbl := uitable.New()
tbl.MaxColWidth = 60 tbl.MaxColWidth = 60
tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART", "DESCRIPTION") tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART", "DESCRIPTION", "RELEASED BY")
for i := len(rls) - 1; i >= 0; i-- { for i := len(rls) - 1; i >= 0; i-- {
r := rls[i] r := rls[i]
c := formatChartname(r.Chart) c := formatChartname(r.Chart)
@ -106,7 +106,8 @@ func formatHistory(rls []*release.Release) string {
s := r.Info.Status.Code.String() s := r.Info.Status.Code.String()
v := r.Version v := r.Version
d := r.Info.Description d := r.Info.Description
tbl.AddRow(v, t, s, c, d) u := r.Info.Username
tbl.AddRow(v, t, s, c, d, u)
} }
return tbl.String() return tbl.String()
} }

@ -202,14 +202,15 @@ func (l *listCmd) statusCodes() []release.Status_Code {
func formatList(rels []*release.Release) string { func formatList(rels []*release.Release) string {
table := uitable.New() table := uitable.New()
table.MaxColWidth = 60 table.MaxColWidth = 60
table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "NAMESPACE") table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "NAMESPACE", "RELEASED BY")
for _, r := range rels { for _, r := range rels {
c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version) c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version)
t := timeconv.String(r.Info.LastDeployed) t := timeconv.String(r.Info.LastDeployed)
s := r.Info.Status.Code.String() s := r.Info.Status.Code.String()
v := r.Version v := r.Version
n := r.Namespace n := r.Namespace
table.AddRow(r.Name, v, t, s, c, n) u := r.Info.Username
table.AddRow(r.Name, v, t, s, c, n, u)
} }
return table.String() return table.String()
} }

@ -28,6 +28,7 @@ import (
var printReleaseTemplate = `REVISION: {{.Release.Version}} var printReleaseTemplate = `REVISION: {{.Release.Version}}
RELEASED: {{.ReleaseDate}} RELEASED: {{.ReleaseDate}}
RELEASED BY: {{.ReleasedBy}}
CHART: {{.Release.Chart.Metadata.Name}}-{{.Release.Chart.Metadata.Version}} CHART: {{.Release.Chart.Metadata.Name}}-{{.Release.Chart.Metadata.Version}}
USER-SUPPLIED VALUES: USER-SUPPLIED VALUES:
{{.Release.Config.Raw}} {{.Release.Config.Raw}}
@ -61,6 +62,7 @@ func printRelease(out io.Writer, rel *release.Release) error {
"Release": rel, "Release": rel,
"ComputedValues": cfgStr, "ComputedValues": cfgStr,
"ReleaseDate": timeconv.Format(rel.Info.LastDeployed, time.ANSIC), "ReleaseDate": timeconv.Format(rel.Info.LastDeployed, time.ANSIC),
"ReleasedBy": rel.Info.Username,
} }
return tpl(printReleaseTemplate, data, out) return tpl(printReleaseTemplate, data, out)
} }

@ -38,6 +38,7 @@ The status consists of:
- last deployment time - last deployment time
- k8s namespace in which the release lives - k8s namespace in which the release lives
- state of the release (can be: UNKNOWN, DEPLOYED, DELETED, SUPERSEDED, FAILED or DELETING) - state of the release (can be: UNKNOWN, DEPLOYED, DELETED, SUPERSEDED, FAILED or DELETING)
- name of the user who deployed the release
- list of resources that this release consists of, sorted by kind - list of resources that this release consists of, sorted by kind
- details on last test suite run, if applicable - details on last test suite run, if applicable
- additional notes provided by the chart - additional notes provided by the chart
@ -96,6 +97,7 @@ func PrintStatus(out io.Writer, res *services.GetReleaseStatusResponse) {
} }
fmt.Fprintf(out, "NAMESPACE: %s\n", res.Namespace) fmt.Fprintf(out, "NAMESPACE: %s\n", res.Namespace)
fmt.Fprintf(out, "STATUS: %s\n", res.Info.Status.Code) fmt.Fprintf(out, "STATUS: %s\n", res.Info.Status.Code)
fmt.Fprintf(out, "RELEASED BY: %s\n", res.Info.Username)
fmt.Fprintf(out, "\n") fmt.Fprintf(out, "\n")
if len(res.Info.Status.Resources) > 0 { if len(res.Info.Status.Resources) > 0 {
re := regexp.MustCompile(" +") re := regexp.MustCompile(" +")

@ -74,7 +74,7 @@ type Metadata struct {
// The condition to check to enable chart // The condition to check to enable chart
Condition string `protobuf:"bytes,11,opt,name=condition" json:"condition,omitempty"` Condition string `protobuf:"bytes,11,opt,name=condition" json:"condition,omitempty"`
// The tags to check to enable chart // The tags to check to enable chart
Tags []string `protobuf:"bytes,12,opt,name=tags" json:"tags,omitempty"` Tags string `protobuf:"bytes,12,opt,name=tags" json:"tags,omitempty"`
} }
func (m *Metadata) Reset() { *m = Metadata{} } func (m *Metadata) Reset() { *m = Metadata{} }

@ -22,7 +22,9 @@ type Info struct {
// Deleted tracks when this object was deleted. // Deleted tracks when this object was deleted.
Deleted *google_protobuf.Timestamp `protobuf:"bytes,4,opt,name=deleted" json:"deleted,omitempty"` Deleted *google_protobuf.Timestamp `protobuf:"bytes,4,opt,name=deleted" json:"deleted,omitempty"`
// Description is human-friendly "log entry" about this release. // Description is human-friendly "log entry" about this release.
Description string `protobuf:"bytes,5,opt,name=Description" json:"Description,omitempty"` Description string `protobuf:"bytes,5,opt,name=Description,json=description" json:"Description,omitempty"`
// Username is the authenticated user who performed this release.
Username string `protobuf:"bytes,6,opt,name=Username,json=username" json:"Username,omitempty"`
} }
func (m *Info) Reset() { *m = Info{} } func (m *Info) Reset() { *m = Info{} }
@ -65,20 +67,21 @@ func init() {
func init() { proto.RegisterFile("hapi/release/info.proto", fileDescriptor1) } func init() { proto.RegisterFile("hapi/release/info.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{ var fileDescriptor1 = []byte{
// 235 bytes of a gzipped FileDescriptorProto // 252 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8f, 0x31, 0x4f, 0xc3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
0x10, 0x85, 0x95, 0x52, 0x5a, 0xd5, 0x6d, 0x19, 0x2c, 0x24, 0x42, 0x16, 0x22, 0xa6, 0x0e, 0xc8, 0x14, 0x45, 0x95, 0x52, 0xd2, 0xd6, 0x69, 0x19, 0x2c, 0x24, 0x4c, 0x16, 0x22, 0xa6, 0x0e, 0xc8,
0x91, 0x80, 0x1d, 0x81, 0xba, 0xb0, 0x06, 0x26, 0x16, 0xe4, 0xe2, 0x73, 0xb1, 0xe4, 0xe6, 0x2c, 0x91, 0x80, 0x1d, 0x81, 0xba, 0xb0, 0x06, 0x58, 0x58, 0x90, 0x8b, 0x5f, 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x3c, 0xef, 0xe2, 0xf7, 0xd3, 0xe2, 0x7d, 0x16, 0x5f, 0x64, 0x9b, 0x86, 0x2b, 0x77, 0xbf, 0x01,
0x00, 0x00, 0xff, 0xff, 0x32, 0x11, 0x9d, 0xcc, 0xa5, 0x01, 0x00, 0x00,
} }

@ -447,7 +447,7 @@ func (*GetVersionRequest) ProtoMessage() {}
func (*GetVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (*GetVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
type GetVersionResponse struct { type GetVersionResponse struct {
Version *hapi_version.Version `protobuf:"bytes,1,opt,name=Version" json:"Version,omitempty"` Version *hapi_version.Version `protobuf:"bytes,1,opt,name=Version,json=version" json:"Version,omitempty"`
} }
func (m *GetVersionResponse) Reset() { *m = GetVersionResponse{} } func (m *GetVersionResponse) Reset() { *m = GetVersionResponse{} }
@ -1051,23 +1051,23 @@ var fileDescriptor0 = []byte{
0xf2, 0x0e, 0x14, 0xb5, 0x02, 0x28, 0x36, 0xa0, 0xb1, 0x88, 0xa3, 0x4b, 0x2c, 0xa1, 0x15, 0x93, 0xf2, 0x0e, 0x14, 0xb5, 0x02, 0x28, 0x36, 0xa0, 0xb1, 0x88, 0xa3, 0x4b, 0x2c, 0xa1, 0x15, 0x93,
0x6c, 0x8e, 0x75, 0x2d, 0x47, 0x67, 0x0c, 0xd6, 0xdd, 0x18, 0x1e, 0x99, 0x51, 0x12, 0x75, 0x4a, 0x6c, 0x8e, 0x75, 0x2d, 0x47, 0x67, 0x0c, 0xd6, 0xdd, 0x18, 0x1e, 0x99, 0x51, 0x12, 0x75, 0x4a,
0xdd, 0x1d, 0x41, 0xd3, 0xce, 0x3a, 0xac, 0x1d, 0x61, 0xf6, 0x46, 0x1c, 0x00, 0x99, 0x9e, 0x33, 0xdd, 0x1d, 0x41, 0xd3, 0xce, 0x3a, 0xac, 0x1d, 0x61, 0xf6, 0x46, 0x1c, 0x00, 0x99, 0x9e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5e, 0x34, 0xf9, 0xdf, 0xc9, 0x2f, 0xfe, 0x0d, 0x00, 0x00, 0xf7, 0x0b, 0xf8, 0xa1, 0xad, 0x54, 0x2f, 0x9a, 0xfc, 0xef, 0xe4, 0x17, 0xff, 0x06, 0x00, 0x00,
0xff, 0xff, 0xf9, 0x32, 0x44, 0xf7, 0x1f, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x26, 0xd9, 0xff, 0xa0, 0x1f, 0x0f, 0x00, 0x00,
} }

@ -27,12 +27,9 @@ import (
"github.com/technosophos/moniker" "github.com/technosophos/moniker"
ctx "golang.org/x/net/context" ctx "golang.org/x/net/context"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/hooks"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/release"
@ -43,6 +40,10 @@ import (
"k8s.io/helm/pkg/tiller/environment" "k8s.io/helm/pkg/tiller/environment"
"k8s.io/helm/pkg/timeconv" "k8s.io/helm/pkg/timeconv"
"k8s.io/helm/pkg/version" "k8s.io/helm/pkg/version"
"k8s.io/kubernetes/pkg/api/unversioned"
authenticationapi "k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/typed/discovery"
) )
// releaseNameMaxLen is the maximum length of a release name. // releaseNameMaxLen is the maximum length of a release name.
@ -289,7 +290,7 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return nil, err return nil, err
} }
res, err := s.performUpdate(currentRelease, updatedRelease, req) res, err := s.performUpdate(c, currentRelease, updatedRelease, req)
if err != nil { if err != nil {
return res, err return res, err
} }
@ -303,9 +304,10 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return res, nil return res, nil
} }
func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.Release, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { func (s *ReleaseServer) performUpdate(c ctx.Context, originalRelease, updatedRelease *release.Release, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) {
res := &services.UpdateReleaseResponse{Release: updatedRelease} res := &services.UpdateReleaseResponse{Release: updatedRelease}
updatedRelease.Info.Username = getUserName(c)
if req.DryRun { if req.DryRun {
log.Printf("Dry run for %s", updatedRelease.Name) log.Printf("Dry run for %s", updatedRelease.Name)
res.Release.Info.Description = "Dry run complete" res.Release.Info.Description = "Dry run complete"
@ -448,7 +450,7 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return nil, err return nil, err
} }
res, err := s.performRollback(currentRelease, targetRelease, req) res, err := s.performRollback(c, currentRelease, targetRelease, req)
if err != nil { if err != nil {
return res, err return res, err
} }
@ -462,9 +464,11 @@ func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return res, nil return res, nil
} }
func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.Release, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) { func (s *ReleaseServer) performRollback(c ctx.Context, currentRelease, targetRelease *release.Release, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
res := &services.RollbackReleaseResponse{Release: targetRelease} res := &services.RollbackReleaseResponse{Release: targetRelease}
targetRelease.Info.Username = getUserName(c)
if req.DryRun { if req.DryRun {
log.Printf("Dry run for %s", targetRelease.Name) log.Printf("Dry run for %s", targetRelease.Name)
return res, nil return res, nil
@ -634,7 +638,7 @@ func (s *ReleaseServer) InstallRelease(c ctx.Context, req *services.InstallRelea
return res, err return res, err
} }
res, err := s.performRelease(rel, req) res, err := s.performRelease(c, rel, req)
if err != nil { if err != nil {
log.Printf("Failed install perform step: %s", err) log.Printf("Failed install perform step: %s", err)
} }
@ -819,9 +823,10 @@ func (s *ReleaseServer) recordRelease(r *release.Release, reuse bool) {
} }
// performRelease runs a release. // performRelease runs a release.
func (s *ReleaseServer) performRelease(r *release.Release, req *services.InstallReleaseRequest) (*services.InstallReleaseResponse, error) { func (s *ReleaseServer) performRelease(c ctx.Context, r *release.Release, req *services.InstallReleaseRequest) (*services.InstallReleaseResponse, error) {
res := &services.InstallReleaseResponse{Release: r} res := &services.InstallReleaseResponse{Release: r}
r.Info.Username = getUserName(c)
if req.DryRun { if req.DryRun {
log.Printf("Dry run for %s", r.Name) log.Printf("Dry run for %s", r.Name)
res.Release.Info.Description = "Dry run complete" res.Release.Info.Description = "Dry run complete"
@ -1110,3 +1115,15 @@ func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream
return s.env.Releases.Update(rel) return s.env.Releases.Update(rel)
} }
func getUserName(c ctx.Context) string {
user := c.Value(helm.K8sUser)
if user == nil {
return ""
}
userInfo, ok := user.(*authenticationapi.UserInfo)
if !ok {
return ""
}
return userInfo.Username
}

Loading…
Cancel
Save