diff --git a/api/v1alpha1/client_helpers.go b/api/v1alpha1/client_helpers.go index 06be70c0..e5ae0fab 100644 --- a/api/v1alpha1/client_helpers.go +++ b/api/v1alpha1/client_helpers.go @@ -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) diff --git a/api/v1alpha1/exporter_helpers.go b/api/v1alpha1/exporter_helpers.go index 93dbf3de..d00b23d8 100644 --- a/api/v1alpha1/exporter_helpers.go +++ b/api/v1alpha1/exporter_helpers.go @@ -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)