mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 23:16:22 +00:00
Add kubeapi proxy cluster role and role binding
This commit is contained in:
committed by
Alena Prokharchyk
parent
e923730388
commit
2bc960a01c
@@ -36,3 +36,19 @@ func ApplySystemNodeClusterRoleBinding(ctx context.Context, kubeConfigPath strin
|
||||
log.Infof(ctx, "[authz] system:node ClusterRoleBinding created successfully")
|
||||
return nil
|
||||
}
|
||||
|
||||
func ApplyKubeAPIClusterRole(ctx context.Context, kubeConfigPath string, k8sWrapTransport k8s.WrapTransport) error {
|
||||
log.Infof(ctx, "[authz] Creating kube-apiserver proxy ClusterRole and ClusterRoleBinding")
|
||||
k8sClient, err := k8s.NewClient(kubeConfigPath, k8sWrapTransport)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := k8s.UpdateClusterRoleFromYaml(k8sClient, templates.KubeAPIClusterRole); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := k8s.UpdateClusterRoleBindingFromYaml(k8sClient, templates.KubeAPIClusterRoleBinding); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof(ctx, "[authz] kube-apiserver proxy ClusterRole and ClusterRoleBinding created successfully")
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user