-
Notifications
You must be signed in to change notification settings - Fork 13
/
openapi.yaml
193 lines (189 loc) · 4.77 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
openapi: '3.0.0'
info:
version: 0.5.0
title: JWT to RBAC
license:
name: Apache License Version 2.0
servers:
- url: 127.0.0.1:5555
paths:
/rbac/:
get:
summary: List all RBAC resources
operationId: listRbac
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Rbac'
post:
summary: Create service account, cluster role and cluster role binding
operationId: createRbac
requestBody:
description: An ID token that is used to create RBAC resources
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/IdToken'
responses:
'200':
description: An object that represents
content:
application/json:
schema:
$ref: '#/components/schemas/IdTokenClaims'
'500':
description: "Invalid request body or internal server error"
content:
text/plain:
schema:
type: string
example: "missing federatedClaims: jwt doesn't contain required federatedClaims"
/tokens/{saNme}:
get:
summary: 'Get service account token with default TTL of 24 hours'
operationId: getSaToken
parameters:
- name: saNme
in: path
required: true
description: Service account name
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: '#/components/schemas/SaToken'
post:
summary: Get service account token and set its TTL
operationId: Get service account token with TTL
parameters:
- name: saNme
in: path
required: true
description: Service account name
schema:
type: string
requestBody:
description: JWT that is used to create RBAC resources
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SaTokenRequest'
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: '#/components/schemas/SaToken'
components:
schemas:
IdTokenClaims:
example:
Email: [email protected]
FederatedClaims:
connector_id: ldap
user_id: cn=jane,ou=People,dc=example,dc=org
Groups:
- admins
- developers
ServiceAccount: janedoe-example-com
properties:
Email:
type: string
FederatedClaims:
properties:
connector_id:
type: string
enum:
- ldap
- local
- github
user_id:
type: string
required:
- connector_id
- user_id
type: object
ServiceAccount:
type: string
required:
- Email
- FederatedClaims
- ServiceAccount
Rbac:
example:
crole_list:
- developers-from-jwt
crolebind_list:
- janedoe-example-com-admin-binding
- janedoe-example-com-developers-from-jwt-binding
sa_list:
- janedoe-example-com
properties:
crole_list:
items:
type: string
type: array
crolebind_list:
items:
type: string
type: array
sa_list:
items:
type: string
type: array
required:
- sa_list
- crole_list
- crolebind_list
type: object
IdToken:
properties:
token:
description: JSON Web token
type: string
required:
- token
type: object
SaToken:
example:
- data:
ca.crt: example-ca-cer-base64
namespace: ZGVmYXVsdA==
token: example-k8s-sa-token-base64
name: janedoe-example-com-token-m4gbj
items:
properties:
data:
properties:
ca.crt:
type: string
namespace:
type: string
token:
type: string
required:
- ca.crt
- namespace
- token
type: object
name:
type: string
required:
- name
- data
type: object
type: array
SaTokenRequest:
properties:
duration:
type: string