-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Roles a dynamic thing, so not tied to any source of truth, cos in reality different services can create an infinite and arbitrary set of scopes. This also forms the basis of having the UI change based on what's allowed for the user.
- Loading branch information
Showing
22 changed files
with
896 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
charts/identity/crds/identity.unikorn-cloud.org_roles.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.14.0 | ||
name: roles.identity.unikorn-cloud.org | ||
spec: | ||
group: identity.unikorn-cloud.org | ||
names: | ||
categories: | ||
- unikorn | ||
kind: Role | ||
listKind: RoleList | ||
plural: roles | ||
singular: role | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .metadata.creationTimestamp | ||
name: age | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: |- | ||
Role defines a role type that forms the basis of RBAC. Permissions are | ||
applied to arbitrary scopes that are used by individual components to | ||
allow or prevent API access. Roles are additive, so effective RBAC | ||
permssions should be create from the boolean union for any roles that apply | ||
to a user. Roles can optionally be scoped to an organization to allow | ||
deep customization of roles and permissions within that organization, for | ||
example the system management organization may have an onboarding role that | ||
allows basic account creation before handing off to the user. | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: RoleSpec defines the role's requested state. | ||
properties: | ||
isDefault: | ||
description: |- | ||
IsDefault indicates that all authenticated users are granted | ||
the following scopes regardless of organizational group membership | ||
and typically are required for organization discovery and RBAC functionality | ||
in the first instance. | ||
type: boolean | ||
scopes: | ||
description: Scopes are a list of uniquely named scopes for the role. | ||
items: | ||
properties: | ||
name: | ||
description: |- | ||
Name is a unique name that applies to the scope. Individual APIs should | ||
coordinate with one another to avoid clashes and privilege escallation. | ||
type: string | ||
permissions: | ||
description: Permissions defines a set of CRUD permissions for | ||
the scope. | ||
items: | ||
enum: | ||
- create | ||
- read | ||
- update | ||
- delete | ||
type: string | ||
type: array | ||
x-kubernetes-list-type: set | ||
required: | ||
- name | ||
type: object | ||
type: array | ||
x-kubernetes-list-map-keys: | ||
- name | ||
x-kubernetes-list-type: map | ||
type: object | ||
status: | ||
description: RoleStatus defines any role status information. | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- range $role, $spec := .Values.roles }} | ||
--- | ||
apiVersion: identity.unikorn-cloud.org/v1alpha1 | ||
kind: Role | ||
metadata: | ||
name: {{ $role }} | ||
spec: | ||
{{- if $spec.isDefault }} | ||
isDefault: true | ||
{{- end }} | ||
{{- with $scopes := $spec.scopes }} | ||
scopes: | ||
{{- range $scope, $permissions := $scopes }} | ||
{{- printf "- name: %s" $scope | nindent 4 }} | ||
{{- printf "permissions: [%v]" ($permissions | join ", ") | nindent 6 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ rules: | |
resources: | ||
- oauth2clients | ||
- oauth2providers | ||
- roles | ||
- organizations | ||
verbs: | ||
- list | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.