1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/core/src/common/rbac.ts
Jari Kolehmainen 2657df2293
Restructure to monorepo (#6907)
* wip: restructure to monorepo

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* refactor create-release-pr to a package

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* build fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* github workflow fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix typo

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add webpack-env types to core

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix github workflows

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* refactor/fix integration tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* lint fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* yarn run dev

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* eslint settings for vscode

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* move templates to right package

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* open-lens build fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* integration test fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix nx task dependencies

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* use bash shell for unit tests in test workflow

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix test:unit for windows

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix win-ca webpack error in open-lens

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix win-ca webpack error in open-lens

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix build:app on windows

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* remove ELECTRON_BUILDER_EXTRA_ARGS

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* sync src/ from master

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* remove Makefile from core

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2023-01-24 10:46:26 -08:00

210 lines
4.5 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export type KubeResource =
"namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "limitranges" | "leases" |
"secrets" | "configmaps" | "ingresses" | "ingressclasses" | "networkpolicies" | "persistentvolumeclaims" | "persistentvolumes" | "storageclasses" |
"pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" |
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets" |
"priorityclasses" | "runtimeclasses" |
"roles" | "clusterroles" | "rolebindings" | "clusterrolebindings" | "serviceaccounts";
export interface KubeApiResource {
kind: string;
group: string; // api-group, if empty then "core"
apiName: string;
namespaced: boolean;
}
export interface KubeApiResourceDescriptor {
apiName: string;
group: string; // api-group, if empty then "core"
}
export const formatKubeApiResource = (desc: KubeApiResourceDescriptor) => (
desc.group
? `${desc.group}/${desc.apiName}`
: desc.apiName
);
export interface KubeApiResourceData {
kind: string; // resource type (e.g. "Namespace")
group: string; // api-group, if empty then "core"
namespaced: boolean;
}
export const apiResourceRecord: Record<KubeResource, KubeApiResourceData> = {
clusterroles: {
kind: "ClusterRole",
group: "rbac.authorization.k8s.io",
namespaced: false,
},
clusterrolebindings: {
kind: "ClusterRoleBinding",
group: "rbac.authorization.k8s.io",
namespaced: false,
},
configmaps: {
kind: "ConfigMap",
group: "",
namespaced: true,
},
cronjobs: {
kind: "CronJob",
group: "batch",
namespaced: true,
},
customresourcedefinitions: {
kind: "CustomResourceDefinition",
group: "apiextensions.k8s.io",
namespaced: false,
},
daemonsets: {
kind: "DaemonSet",
group: "apps",
namespaced: true,
},
deployments: {
kind: "Deployment",
group: "apps",
namespaced: true,
},
endpoints: {
kind: "Endpoint",
group: "",
namespaced: true,
},
events: {
kind: "Event",
group: "",
namespaced: true,
},
horizontalpodautoscalers: {
kind: "HorizontalPodAutoscaler",
group: "autoscaling",
namespaced: true,
},
ingresses: {
kind: "Ingress",
group: "networking.k8s.io",
namespaced: true,
},
ingressclasses: {
kind: "IngressClass",
group: "networking.k8s.io",
namespaced: false,
},
jobs: {
kind: "Job",
group: "batch",
namespaced: true,
},
namespaces: {
kind: "Namespace",
group: "",
namespaced: false,
},
limitranges: {
kind: "LimitRange",
group: "",
namespaced: true,
},
leases: {
kind: "Lease",
group: "",
namespaced: true,
},
networkpolicies: {
kind: "NetworkPolicy",
group: "networking.k8s.io",
namespaced: true,
},
nodes: {
kind: "Node",
group: "",
namespaced: false,
},
persistentvolumes: {
kind: "PersistentVolume",
group: "",
namespaced: false,
},
persistentvolumeclaims: {
kind: "PersistentVolumeClaim",
group: "",
namespaced: true,
},
pods: {
kind: "Pod",
group: "",
namespaced: true,
},
poddisruptionbudgets: {
kind: "PodDisruptionBudget",
group: "policy",
namespaced: true,
},
podsecuritypolicies: {
kind: "PodSecurityPolicy",
group: "policy",
namespaced: false,
},
priorityclasses: {
kind: "PriorityClass",
group: "scheduling.k8s.io",
namespaced: false,
},
runtimeclasses: {
kind: "RuntimeClass",
group: "node.k8s.io",
namespaced: false,
},
resourcequotas: {
kind: "ResourceQuota",
group: "",
namespaced: true,
},
replicasets: {
kind: "ReplicaSet",
group: "apps",
namespaced: true,
},
roles: {
kind: "Role",
group: "rbac.authorization.k8s.io",
namespaced: true,
},
rolebindings: {
kind: "RoleBinding",
group: "rbac.authorization.k8s.io",
namespaced: true,
},
secrets: {
kind: "Secret",
group: "",
namespaced: true,
},
serviceaccounts: {
kind: "ServiceAccount",
group: "",
namespaced: true,
},
services: {
kind: "Service",
group: "",
namespaced: true,
},
statefulsets: {
kind: "StatefulSet",
group: "apps",
namespaced: true,
},
storageclasses: {
kind: "StorageClass",
group: "storage.k8s.io",
namespaced: false,
},
};