Skip to content

Commit 63d4153

Browse files
authored
feat: add name field to AccessRequest permissions (#113)
* add name field to AccessRequest permissions * add secret key constants for oidc access
1 parent 9896537 commit 63d4153

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

api/clusters/v1alpha1/accessrequest_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ type AccessRequestSpec struct {
4545
}
4646

4747
type PermissionsRequest struct {
48+
// Name is an optional name for the (Cluster)Role that will be created for the requested permissions.
49+
// If not set, a randomized name that is unique in the cluster will be generated.
50+
// Note that the AccessRequest will not be granted if the to-be-created (Cluster)Role already exists, but is not managed by the AccessRequest, so choose this name carefully.
51+
// +optional
52+
Name string `json:"name,omitempty"`
53+
4854
// Namespace is the namespace for which the permissions are requested.
4955
// If empty, this will result in a ClusterRole, otherwise in a Role in the respective namespace.
5056
// Note that for a Role, the namespace needs to either exist or a permission to create it must be included in the requested permissions (it will be created automatically then), otherwise the request will be rejected.

api/clusters/v1alpha1/constants.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,13 @@ const (
8484
// SecretKeyCreationTimestamp is the name of the key in the AccessRequest secret that contains the creation timestamp.
8585
// This value is optional and must not be set for non-expiring authentication methods.
8686
SecretKeyCreationTimestamp = "creationTimestamp"
87+
// SecretKeyCAData is the name of the key in the AccessRequest secret that contains the CA data.
88+
// This value is optional and must not be set.
89+
SecretKeyCAData = "caData"
90+
// SecretKeyHost is the name of the key in the AccessRequest secret that contains the host.
91+
// This value is optional and must not be set.
92+
SecretKeyHost = "host"
93+
// SecretKeyClientID is the name of the key in the AccessRequest secret that contains the client ID.
94+
// This value is optional and must not be set for non-OIDC-based authentication methods.
95+
SecretKeyClientID = "clientID"
8796
)

api/crds/manifests/clusters.openmcp.cloud_accessrequests.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ spec:
214214
For token-based access, the serviceaccount will be bound to the created Roles and ClusterRoles.
215215
items:
216216
properties:
217+
name:
218+
description: |-
219+
Name is an optional name for the (Cluster)Role that will be created for the requested permissions.
220+
If not set, a randomized name that is unique in the cluster will be generated.
221+
Note that the AccessRequest will not be granted if the to-be-created (Cluster)Role already exists, but is not managed by the AccessRequest, so choose this name carefully.
222+
type: string
217223
namespace:
218224
description: |-
219225
Namespace is the namespace for which the permissions are requested.

0 commit comments

Comments
 (0)