package serviceaccount
import "k8s.io/apiserver/pkg/authentication/serviceaccount"
Index ¶
- Constants
- func MakeGroupNames(namespace string) []string
- func MakeNamespaceGroupName(namespace string) string
- func MakeUsername(namespace, name string) string
- func MatchesUsername(namespace, name string, username string) bool
- func SplitUsername(username string) (string, string, error)
Constants ¶
const ( ServiceAccountUsernamePrefix = "system:serviceaccount:" ServiceAccountUsernameSeparator = ":" ServiceAccountGroupPrefix = "system:serviceaccounts:" AllServiceAccountsGroup = "system:serviceaccounts" )
Functions ¶
func MakeGroupNames ¶
MakeGroupNames generates service account group names for the given namespace
func MakeNamespaceGroupName ¶
MakeNamespaceGroupName returns the name of the group all service accounts in the namespace are included in
func MakeUsername ¶
MakeUsername generates a username from the given namespace and ServiceAccount name. The resulting username can be passed to SplitUsername to extract the original namespace and ServiceAccount name.
func MatchesUsername ¶
MatchesUsername checks whether the provided username matches the namespace and name without allocating. Use this when checking a service account namespace and name against a known string.
func SplitUsername ¶
SplitUsername returns the namespace and ServiceAccount name embedded in the given username, or an error if the username is not a valid name produced by MakeUsername
Source Files ¶
util.go
- Version
- v0.19.0
- Published
- Aug 26, 2020
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 1 minute ago –
Tools for package owners.