rbac

package
v0.0.0-...-e58ac12 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RoleNames = map[string]string{
	"admin":              "nsm-role",
	"view":               "aggregate-network-services-view",
	"binding":            "nsm-role-binding",
	"prometheus":         "prometheus",
	"prometheus_binding": "prometheus",
}

* RoleNames is a map where the keys are simplified roles names for external usage and the values are the real roles names in the Kubernetes cluster

View Source
var Roles = map[string]func(string, string) Role{
	"admin":              CreateRoleAdmin,
	"view":               CreateRoleView,
	"binding":            CreateRoleBinding,
	"prometheus":         CreatePrometheusRole,
	"prometheus_binding": CreatePrometheusRoleBinding,
}

* Roles is a map containing simplified roles names for external usage and mapping them to a function that creates object of the required type.

Functions

func DeleteAllRoles

func DeleteAllRoles(clientset kubernetes.Interface) error

DeleteAllRoles deletes all listed roles in a cluster

func DeletePrometheusRoles

func DeletePrometheusRoles(clientset kubernetes.Interface) error

DeletePrometheusRoles deletes prometheus roles

Types

type ClusterRole

type ClusterRole struct {
	rbacv1.ClusterRole
}

ClusterRole is K8s cluster role struct, created for implementing Role interface functions

func (*ClusterRole) Create

func (r *ClusterRole) Create(clientset kubernetes.Interface) error

Create creates ClusterRole from clientset

func (*ClusterRole) Delete

func (r *ClusterRole) Delete(clientset kubernetes.Interface, name string) error

Delete deletes ClusterRole based on name

func (*ClusterRole) GetName

func (r *ClusterRole) GetName() string

GetName returns ClusterRole name

type ClusterRoleBinding

type ClusterRoleBinding struct {
	rbacv1.ClusterRoleBinding
}

ClusterRoleBinding is K8s cluster role-binding struct, created for implementing Role interface functions

func (*ClusterRoleBinding) Create

func (r *ClusterRoleBinding) Create(clientset kubernetes.Interface) error

Create creates ClusterRoleBinding from clientset

func (*ClusterRoleBinding) Delete

func (r *ClusterRoleBinding) Delete(clientset kubernetes.Interface, name string) error

Delete deletes ClusterRoleBinding based on name

func (*ClusterRoleBinding) GetName

func (r *ClusterRoleBinding) GetName() string

GetName returns ClusterRoleBinding name

type Role

type Role interface {
	// Create method is for creating Role
	Create(kubernetes.Interface) error
	// Delete method is for deleting Role
	Delete(kubernetes.Interface, string) error
	// GetName method returns role name
	GetName() string
}

Role is an interface for a cluster role

func CreatePrometheusRole

func CreatePrometheusRole(name, namespace string) Role

CreatePrometheusRole creates prometheus cluster role

func CreatePrometheusRoleBinding

func CreatePrometheusRoleBinding(name, namespace string) Role

CreatePrometheusRoleBinding creates prometheus role-binding

func CreateRoleAdmin

func CreateRoleAdmin(name, namespace string) Role

CreateRoleAdmin creates a role with admin permissions.

func CreateRoleBinding

func CreateRoleBinding(name, namespace string) Role

CreateRoleBinding creates a role with binding permissions

func CreateRoleView

func CreateRoleView(name, namespace string) Role

CreateRoleView creates a role with view permissions

Jump to

Keyboard shortcuts

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