Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions api/v1alpha1/client_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package v1alpha1
import "strings"

func (c *Client) InternalSubject() string {
return strings.Join([]string{"client", c.Namespace, c.Name, string(c.UID)}, ":")
return strings.Join([]string{"client", c.Name}, ":")
}

func (c *Client) Usernames(prefix string) []string {
usernames := []string{prefix + c.InternalSubject()}
usernames := []string{
prefix + strings.Join([]string{"client", c.Name}, ":"), // New portable format
prefix + strings.Join([]string{"client", c.Namespace, c.Name, string(c.UID)}, ":"), // Legacy format
}

if c.Spec.Username != nil {
usernames = append(usernames, *c.Spec.Username)
Expand Down
7 changes: 5 additions & 2 deletions api/v1alpha1/exporter_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import (
)

func (e *Exporter) InternalSubject() string {
return strings.Join([]string{"exporter", e.Namespace, e.Name, string(e.UID)}, ":")
return strings.Join([]string{"exporter", e.Name}, ":")
}

func (e *Exporter) Usernames(prefix string) []string {
usernames := []string{prefix + e.InternalSubject()}
usernames := []string{
prefix + strings.Join([]string{"exporter", e.Name}, ":"), // New portable format
prefix + strings.Join([]string{"exporter", e.Namespace, e.Name, string(e.UID)}, ":"), // Legacy format
}

if e.Spec.Username != nil {
usernames = append(usernames, *e.Spec.Username)
Expand Down