Split UserManagement into seperate Cluster and Namespace Roles and RoleBindings (#2755)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-06-09 13:40:55 -04:00
1 parent 1ed7892b26
commit a1a1c240e9
69 files changed
+2896 -901

No files matched your search

@@ -18,14 +18,39 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { RoleBinding } from "./role-binding.api";
import { KubeApi } from "../kube-api";
import { KubeObject } from "../kube-object";
export class ClusterRoleBinding extends RoleBinding {
export type ClusterRoleBindingSubjectKind = "Group" | "ServiceAccount" | "User";
export interface ClusterRoleBindingSubject {
kind: ClusterRoleBindingSubjectKind;
name: string;
apiGroup?: string;
namespace?: string;
}
export interface ClusterRoleBinding {
subjects?: ClusterRoleBindingSubject[];
roleRef: {
kind: string;
name: string;
apiGroup?: string;
};
}
export class ClusterRoleBinding extends KubeObject {
static kind = "ClusterRoleBinding";
static namespaced = false;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings";
getSubjects() {
return this.subjects || [];
}
getSubjectNames(): string {
return this.getSubjects().map(subject => subject.name).join(", ");
}
}
export const clusterRoleBindingApi = new KubeApi({
+15 -2
View File
@@ -19,13 +19,26 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { Role } from "./role.api";
import { KubeApi } from "../kube-api";
import { KubeObject } from "../kube-object";
export class ClusterRole extends Role {
export interface ClusterRole {
rules: {
verbs: string[];
apiGroups: string[];
resources: string[];
resourceNames?: string[];
}[];
}
export class ClusterRole extends KubeObject {
static kind = "ClusterRole";
static namespaced = false;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles";
getRules() {
return this.rules || [];
}
}
export const clusterRoleApi = new KubeApi({
@@ -24,15 +24,17 @@ import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api";
export interface IRoleBindingSubject {
kind: string;
export type RoleBindingSubjectKind = "Group" | "ServiceAccount" | "User";
export interface RoleBindingSubject {
kind: RoleBindingSubjectKind;
name: string;
namespace?: string;
apiGroup?: string;
}
export interface RoleBinding {
subjects?: IRoleBindingSubject[];
subjects?: RoleBindingSubject[];
roleRef: {
kind: string;
name: string;