Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
CreatePrometheusRole creates prometheus cluster role
func CreatePrometheusRoleBinding ¶
CreatePrometheusRoleBinding creates prometheus role-binding
func CreateRoleAdmin ¶
CreateRoleAdmin creates a role with admin permissions.
func CreateRoleBinding ¶
CreateRoleBinding creates a role with binding permissions
func CreateRoleView ¶
CreateRoleView creates a role with view permissions