provider

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AnnotationProviderNameKey = "authz.tkestack.io/provider-name"

Variables

This section is empty.

Functions

func Providers

func Providers() []string

Providers returns a sorted list of the names of the registered providers.

func Register

func Register(name string, provider Provider)

Register makes a provider available by the provided name. If Register is called twice with the same name or if provider is nil, it panics.

Types

type DelegateProvider

type DelegateProvider struct {
	ProviderName string
}

func (*DelegateProvider) DeleteClusterRole

func (p *DelegateProvider) DeleteClusterRole(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, role *authzv1.Role) error

func (*DelegateProvider) DeleteMultiClusterRoleBindingResources

func (p *DelegateProvider) DeleteMultiClusterRoleBindingResources(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding) error

func (*DelegateProvider) DeleteUnbindingResources

func (p *DelegateProvider) DeleteUnbindingResources(ctx context.Context, client platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding, clusterIDs []string) error

func (*DelegateProvider) DispatchMultiClusterRoleBinding

func (p *DelegateProvider) DispatchMultiClusterRoleBinding(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding, rules []rbacv1.PolicyRule, clusterSubjects map[string]*rbacv1.Subject) error

func (*DelegateProvider) GetSubject

func (p *DelegateProvider) GetSubject(ctx context.Context, platformUser string, cluster *platformv1.Cluster) (*rbacv1.Subject, error)

func (*DelegateProvider) GetTenantClusters

func (p *DelegateProvider) GetTenantClusters(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, tenantID string) ([]string, error)

func (*DelegateProvider) InitContext

func (p *DelegateProvider) InitContext(param interface{}) context.Context

func (*DelegateProvider) Name

func (p *DelegateProvider) Name() string

func (*DelegateProvider) OnFilter

func (p *DelegateProvider) OnFilter(todo context.Context, annotations map[string]string) bool

func (*DelegateProvider) Validate

type Provider

type Provider interface {
	Name() string
	OnFilter(ctx context.Context, annotations map[string]string) bool
	Validate(ctx context.Context, obj runtime.Object, platformClient platformversionedclient.PlatformV1Interface) *field.Error
	InitContext(param interface{}) context.Context
	GetTenantClusters(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, tenantID string) ([]string, error)
	GetSubject(ctx context.Context, userName string, cluster *platformv1.Cluster) (*rbacv1.Subject, error)
	DispatchMultiClusterRoleBinding(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding, rules []rbacv1.PolicyRule, clusterSubjects map[string]*rbacv1.Subject) error
	DeleteUnbindingResources(ctx context.Context, client platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding, clusterIDs []string) error
	DeleteClusterRole(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, role *authzv1.Role) error
	DeleteMultiClusterRoleBindingResources(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, mcrb *authzv1.MultiClusterRoleBinding) error
}

func GetProvider

func GetProvider(annotation map[string]string) (Provider, error)

GetProvider will get your provider with the application, set an annotation with key, application.tkestack.io/provider-name, and value, the provider will work for your application.

Jump to

Keyboard shortcuts

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