users

package
v0.13.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceAccountFullName

func GetServiceAccountFullName(ref meta.NamespacedRFC1123ObjectReferenceWithNamespace) string

GetServiceAccountFullName return the full qualified name for the serviceaccount.

func GetServiceAccountGroups

func GetServiceAccountGroups(namespace string) []string

GetServiceAccountGroups returns all groups associated with a ServiceAccount.

func HasIgnoredGroup

func HasIgnoredGroup(userGroups []string, ignoredGroups []string) bool

func ImpersonatedKubernetesClientForServiceAccount

func ImpersonatedKubernetesClientForServiceAccount(
	base *rest.Config,
	scheme *runtime.Scheme,
	reference meta.NamespacedRFC1123ObjectReferenceWithNamespace,
) (client.Client, error)

ImpersonatedKubernetesClientForServiceAccount returns a controller-runtime client.Client that impersonates a given ServiceAccount.

func IsAdminUser

func IsAdminUser(req admission.Request, administrators rbac.UserListSpec) bool

func IsCapsuleUser

func IsCapsuleUser(
	ctx context.Context,
	c client.Client,
	cfg configuration.Configuration,
	user string,
	groups []string,
) bool

func IsControllerServiceAccount

func IsControllerServiceAccount(username string) bool

func IsTenantOwnerByStatus

func IsTenantOwnerByStatus(
	tnt *capsulev1beta2.Tenant,
	user AdmissionUser,
) bool

func ResolveServiceAccountActor

func ResolveServiceAccountActor(
	ctx context.Context,
	c client.Reader,
	ns *corev1.Namespace,
	username string,
	cfg configuration.Configuration,
) (tnt *capsulev1beta2.Tenant, err error)

This function resolves the tenant based on the serviceaccount given via username if a serviceaccount is in a tenant namespace they will return the tenant.

func ServiceAccountGroups

func ServiceAccountGroups(namespace string) []string

func ServiceAccountUserInfo

func ServiceAccountUserInfo(namespace, name string) authenticationv1.UserInfo

func ServiceAccountUsername

func ServiceAccountUsername(namespace, name string) string

Types

type AdmissionServiceAccount

type AdmissionServiceAccount struct {
	Namespace string
	Name      string
}

func ToServiceAccount

func ToServiceAccount(username string) *AdmissionServiceAccount

type AdmissionUser

type AdmissionUser struct {
	Type     AdmissionUserType
	Username string
	Groups   []string

	ServiceAccount *AdmissionServiceAccount
}

func NewAdmissionUser

func NewAdmissionUser(userType AdmissionUserType, info authenticationv1.UserInfo) AdmissionUser

func (AdmissionUser) IsAdmin

func (u AdmissionUser) IsAdmin() bool

func (AdmissionUser) IsCapsule

func (u AdmissionUser) IsCapsule() bool

func (AdmissionUser) IsControllerServiceAccount

func (u AdmissionUser) IsControllerServiceAccount() bool

func (AdmissionUser) IsUnknown

func (u AdmissionUser) IsUnknown() bool

func (AdmissionUser) UserInfo

type AdmissionUserType

type AdmissionUserType string
const (
	AdmissionUserUnknown AdmissionUserType = "Unknown"
	AdmissionUserAdmin   AdmissionUserType = "Admin"
	AdmissionUserCapsule AdmissionUserType = "Capsule"
)

type UserGroupList

type UserGroupList interface {
	Find(needle string) (found bool)
}

func NewUserGroupList

func NewUserGroupList(groups []string) UserGroupList

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL