Commit 371dea09 authored by Pål Karlsrud's avatar Pål Karlsrud
Browse files

Add the ability to specify a owner email for a release.

parent ad1644d4
......@@ -37,4 +37,7 @@ message Info {
// Username is the authenticated user who performed this release.
string Username = 6;
// Email is the email of the authenticated user.
string Email = 7;
......@@ -24,6 +24,8 @@ type Info struct {
Description string `protobuf:"bytes,5,opt,name=Description" json:"Description,omitempty"`
// Username is the authenticated user who performed this release.
Username string `protobuf:"bytes,6,opt,name=Username" json:"Username,omitempty"`
// Email is the email of the authenticated user.
Email string `protobuf:"bytes,7,opt,name=Email" json:"Email,omitempty"`
func (m *Info) Reset() { *m = Info{} }
......@@ -73,6 +75,13 @@ func (m *Info) GetUsername() string {
return ""
func (m *Info) GetEmail() string {
if m != nil {
return m.Email
return ""
func init() {
proto.RegisterType((*Info)(nil), "hapi.release.Info")
......@@ -80,21 +89,22 @@ func init() {
func init() { proto.RegisterFile("hapi/release/info.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{
// 249 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4f, 0xc3, 0x30,
0x10, 0x85, 0x95, 0x52, 0x52, 0xea, 0xb6, 0x0c, 0x16, 0x12, 0x26, 0x0b, 0x11, 0x53, 0x07, 0xe4,
0x48, 0xc0, 0x8e, 0x40, 0x5d, 0x58, 0x03, 0x2c, 0x2c, 0xc8, 0x25, 0x97, 0x62, 0xc9, 0xc9, 0x59,
0xf6, 0x75, 0xe0, 0x3f, 0xf1, 0x23, 0x51, 0x1d, 0xa7, 0x0a, 0x53, 0xc6, 0xe4, 0x7b, 0xdf, 0xbb,
0x27, 0xb3, 0xcb, 0x6f, 0x65, 0x75, 0xe1, 0xc0, 0x80, 0xf2, 0x50, 0xe8, 0xb6, 0x46, 0x69, 0x1d,
0x12, 0xf2, 0xe5, 0x01, 0xc8, 0x08, 0xb2, 0xeb, 0x1d, 0xe2, 0xce, 0x40, 0x11, 0xd8, 0x76, 0x5f,
0x17, 0xa4, 0x1b, 0xf0, 0xa4, 0x1a, 0xdb, 0xc5, 0xb3, 0xab, 0x7f, 0x3d, 0x9e, 0x14, 0xed, 0x7d,
0x87, 0x6e, 0x7e, 0x27, 0x6c, 0xfa, 0xd2, 0xd6, 0xc8, 0x6f, 0x59, 0xda, 0x01, 0x91, 0xe4, 0xc9,
0x7a, 0x71, 0x77, 0x21, 0x87, 0x37, 0xe4, 0x6b, 0x60, 0x65, 0xcc, 0xf0, 0x27, 0x76, 0x5e, 0x6b,
0xe7, 0xe9, 0xb3, 0x02, 0x6b, 0xf0, 0x07, 0x2a, 0x31, 0x09, 0x56, 0x26, 0xbb, 0x2d, 0xb2, 0xdf,
0x22, 0xdf, 0xfa, 0x2d, 0xe5, 0x2a, 0x18, 0x9b, 0x28, 0xf0, 0x47, 0xb6, 0x32, 0x6a, 0xd8, 0x70,
0x32, 0xda, 0xb0, 0x3c, 0x08, 0xc7, 0x82, 0x07, 0x36, 0xab, 0xc0, 0x00, 0x41, 0x25, 0xa6, 0xa3,
0x6a, 0x1f, 0xe5, 0x39, 0x5b, 0x6c, 0xc0, 0x7f, 0x39, 0x6d, 0x49, 0x63, 0x2b, 0x4e, 0xf3, 0x64,
0x3d, 0x2f, 0x87, 0xbf, 0x78, 0xc6, 0xce, 0xde, 0x3d, 0xb8, 0x56, 0x35, 0x20, 0xd2, 0x80, 0x8f,
0xdf, 0xcf, 0xf3, 0x8f, 0x59, 0x7c, 0x91, 0x6d, 0x1a, 0xae, 0xdc, 0xff, 0x05, 0x00, 0x00, 0xff,
0xff, 0xf4, 0x9e, 0xd9, 0x9e, 0xa5, 0x01, 0x00, 0x00,
// 260 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
0x10, 0x86, 0x95, 0xd2, 0x26, 0xf4, 0xda, 0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xd5, 0xb4, 0x1a, 0x3e, 0x91, 0x1c, 0xce, 0x3f, 0x2c, 0x9a, 0x8e, 0xb7, 0x48, 0x53, 0x8f,
0x0f, 0x33, 0x59, 0xc2, 0xe4, 0xa5, 0xe5, 0x42, 0xd2, 0xcc, 0x83, 0x30, 0x3c, 0x4f, 0x3f, 0xb3,
0xf8, 0x4f, 0x9b, 0xd4, 0xdf, 0xbe, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xa2, 0x5e, 0xc9,
0xbb, 0x01, 0x00, 0x00,
......@@ -257,8 +257,9 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.Confi
// create and return configmap object
return &core.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: key,
Labels: lbs.toMap(),
Annotations: map[string]string{"helm/owner_email": rls.Info.GetEmail()},
Name: key,
Labels: lbs.toMap(),
Data: map[string]string{"release": s},
}, nil
......@@ -48,6 +48,7 @@ func (s *ReleaseServer) InstallRelease(c ctx.Context, req *services.InstallRelea
return res, err
rel.Info.Username = getUserName(c)
rel.Info.Email = getEmail(c)
usrCli, err := getUserClient(c)
if err != nil {
......@@ -52,6 +52,7 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return nil, err
updatedRelease.Info.Username = getUserName(c)
updatedRelease.Info.Email = getEmail(c)
if !req.DryRun {
s.Log("creating updated release for %s", req.Name)
......@@ -79,6 +79,11 @@ func authenticate(c context.Context, sysCli *kube.Client) (context.Context, erro
return nil, errors.New("Unknown authorization scheme.")
email, ok := md["email"]
if ok {
c = context.WithValue(c, "email", email[0])
return c, err
......@@ -327,3 +332,12 @@ func getUserName(c context.Context) string {
return userInfo.Username
func getEmail(c context.Context) string {
email, ok := c.Value("email").(string)
if !ok {
return ""
return email
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment