rbachandler

package
v0.0.0-...-a28834e Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteClusterRole

func DeleteClusterRole(clusterRole string, config *Config, logger logur.Logger) error

DeleteClusterRole deletes ClusterRole resources

func DeleteRBAC

func DeleteRBAC(saName string, config *Config, logger logur.Logger) error

DeleteRBAC deletes RBAC resources

func WatchClusterRoles

func WatchClusterRoles(config *Config, logger logur.Logger) error

WatchClusterRoles watch if any CustomGroup rule changes and apply them

func WatchSATokens

func WatchSATokens(config *Config, logger logur.Logger) error

WatchSATokens watch created token

Types

type Config

type Config struct {
	CustomGroups        []CustomGroup
	KubeConfig          string
	TokenTTL            string
	GithubOrg           string
	EnableCreateSAToken bool
}

type CustomGroup

type CustomGroup struct {
	GroupName   string
	CustomRules []CustomRule
	NameSpaces  []string
}

type CustomRule

type CustomRule struct {
	Verbs     []string
	Resources []string
	APIGroups []string
}

type RBACHandler

type RBACHandler struct {
	// contains filtered or unexported fields
}

RBACHandler implements getting, creating and deleting resources

func NewRBACHandler

func NewRBACHandler(kubeconfig string, logger logur.Logger) (*RBACHandler, error)

NewRBACHandler create RBACHandler

type RBACList

type RBACList struct {
	SAList        []string `json:"sa_list,omitempty"`
	CRoleList     []string `json:"crole_list,omitempty"`
	CRoleBindList []string `json:"crolebind_list,omitempty"`
}

func ListRBACResources

func ListRBACResources(config *Config, logger logur.Logger) (*RBACList, error)

ListRBACResources clusterrolebindings

type SACredential

type SACredential struct {
	Name string            `json:"name"`
	Data map[string][]byte `json:"data"`
}

func CreateSAToken

func CreateSAToken(saName string, config *Config, duration string, logger logur.Logger) (*SACredential, error)

CreateSAToken creates service account token with ttl

func GetK8sToken

func GetK8sToken(saName string, config *Config, logger logur.Logger) ([]*SACredential, error)

GetK8sToken getting serviceaccount secrets data

type ServiceAccount

type ServiceAccount struct {
	Name string
	// contains filtered or unexported fields
}

serviceAccount implements create ServiceAccount

func CreateRBAC

func CreateRBAC(user *tokenhandler.User, config *Config, logger logur.Logger) (*ServiceAccount, error)

CreateRBAC create RBAC resources

Jump to

Keyboard shortcuts

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