-
Notifications
You must be signed in to change notification settings - Fork 1
/
openapi.yaml
878 lines (875 loc) · 28.2 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
openapi: '3.0.2'
info:
title: Lieutenant API
description: Project Syn Management API
contact:
name: VSHN AG
email: [email protected]
url: https://vshn.ch
version: v0.5.0
license:
name: BSD 3-Clause License
url: https://choosealicense.com/licenses/bsd-3-clause/
servers:
- url: /
description: Local development
- url: https://api.syn.vshn.net/
description: Project Syn Lieutenant Production API
- url: https://api-int.syn.vshn.net/
description: Project Syn Lieutenant Integration API
- url: https://api-dev.syn.vshn.net/
description: Project Syn Lieutenant Dev API
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Id:
type: string
description: >
A unique object identifier string. Automatically generated by the API on creation (in the form
"<letter>-<adjective>-<noun>-<digits>" where all letters are lowercase, max 63 characters in total).
OIDCConfig:
type: object
required:
- discoveryUrl
- clientId
properties:
discoveryUrl:
type: string
format: uri-template
clientId:
type: string
Metadata:
type: object
required:
- apiVersion
properties:
apiVersion:
type: string
oidc:
$ref: '#/components/schemas/OIDCConfig'
TenantProperties:
type: object
description: |-
A tenant definition object.
The Git repository is usually managed by the API and autogenerated.
All properties except name are optional on creation.
properties:
annotations:
$ref: '#/components/schemas/Annotations'
displayName:
type: string
description: Display name of the tenant
example: Acme Corp.
gitRepo:
$ref: '#/components/schemas/RevisionedGitRepo'
globalGitRepoURL:
type: string
description: Full URL of the global configuration git repo
example: ssh://[email protected]/acmecorp/gitops-global.git
globalGitRepoRevision:
type: string
description: Git revision to use with the global configruation git repository.
example: v1.2.3
TenantId:
type: object
properties:
id:
$ref: '#/components/schemas/Id'
Tenant:
allOf:
- $ref: '#/components/schemas/TenantId'
- $ref: '#/components/schemas/TenantProperties'
ClusterProperties:
type: object
description: |-
A cluster defition object.
The Git repository is usually managed by the API and autogenerated.
The sshDeployKey will be managed by Steward
properties:
annotations:
$ref: '#/components/schemas/Annotations'
displayName:
type: string
description: Display Name of the cluster
example: My very important cluster
facts:
$ref: '#/components/schemas/ClusterFacts'
dynamicFacts:
$ref: '#/components/schemas/DynamicClusterFacts'
compileMeta:
$ref: '#/components/schemas/ClusterCompileMeta'
gitRepo:
$ref: '#/components/schemas/GitRepo'
tenantGitRepoRevision:
type: string
description: |-
Git revision to use with the tenant configruation git repository.
This takes precedence over the revision configured on the Tenant.
example: v1.2.3
globalGitRepoRevision:
type: string
description: |-
Git revision to use with the global configruation git repository.
This takes precedence over the revision configured on the Tenant.
example: v1.2.3
installURL:
type: string
readOnly: true
description: URL to fetch install manifests for Steward cluster agent. This will only be set if the cluster's token is still valid.
example: https://api.syn.vshn.net/install/steward.json?token=<secretToken>
ClusterTenant:
type: object
required:
- tenant
properties:
tenant:
type: string
description: Id of the tenant this cluster belongs to
example: multicorp
CreateCluster:
allOf:
- $ref: '#/components/schemas/ClusterTenant'
- $ref: '#/components/schemas/ClusterProperties'
ClusterId:
type: object
properties:
id:
$ref: '#/components/schemas/Id'
ClusterFacts:
type: object
description: Facts about a cluster object. Statically configured key/value pairs.
example:
distribution: openshift4
cloud: aws
region: eu-west-1
DynamicClusterFacts:
type: object
description: Dynamic facts about a cluster object. Are periodically udpated by Project Syn and should not be set manually.
example:
kubernetesVersion:
buildDate: "2021-04-16T19:04:44Z"
compiler: gc
gitCommit: 8d0432824a9fd9474b67138b7630c33f285d332f
gitTreeState: clean
gitVersion: v1.20.6+k3s1
goVersion: go1.15.10
major: "1"
minor: "20"
platform: linux/amd64
# ClusterCompileMeta is exported from k8s. Must match the k8s structure.
# kubectl get --raw /openapi/v3/apis/syn.tools/v1alpha1 | yq --prettyPrint '.components.schemas["tools.syn.v1alpha1.Cluster"].properties.status.properties.compileMeta'
ClusterCompileMeta:
description: CompileMeta contains information about the last compilation with Commodore.
type: object
properties:
commodoreBuildInfo:
description: CommodoreBuildInfo is the freeform build information reported by the Commodore binary used for the last compilation.
type: object
additionalProperties:
type: string
global:
description: Global contains the information of the global configuration used for the last compilation.
type: object
properties:
gitSha:
description: GitSHA is the git commit SHA of the used commit.
type: string
path:
description: Path is the path inside the git repository where the configuration is stored.
type: string
url:
description: URL is the URL of the git repository.
type: string
version:
description: |-
Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
type: string
instances:
description: |-
Instances contains the information of the component instances used for the last compilation.
The key is the name of the component instance.
type: object
additionalProperties:
description: CompileMetaInstanceVersionInfo contains information about the version of a component instance.
type: object
properties:
component:
description: Component is the name of a component instance.
type: string
gitSha:
description: GitSHA is the git commit SHA of the used commit.
type: string
path:
description: Path is the path inside the git repository where the configuration is stored.
type: string
url:
description: URL is the URL of the git repository.
type: string
version:
description: |-
Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
type: string
lastCompile:
description: LastCompile is the time of the last successful compilation.
type: string
format: date-time
packages:
description: Packages contains the information of the packages used for the last compilation.
type: object
additionalProperties:
description: CompileMetaVersionInfo contains information about the version of a configuration repo or a package.
type: object
properties:
gitSha:
description: GitSHA is the git commit SHA of the used commit.
type: string
path:
description: Path is the path inside the git repository where the configuration is stored.
type: string
url:
description: URL is the URL of the git repository.
type: string
version:
description: |-
Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
type: string
tenant:
description: Tenant contains the information of the tenant configuration used for the last compilation.
type: object
properties:
gitSha:
description: GitSHA is the git commit SHA of the used commit.
type: string
path:
description: Path is the path inside the git repository where the configuration is stored.
type: string
url:
description: URL is the URL of the git repository.
type: string
version:
description: |-
Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
type: string
Cluster:
allOf:
- $ref: '#/components/schemas/ClusterId'
- $ref: '#/components/schemas/ClusterTenant'
- $ref: '#/components/schemas/ClusterProperties'
Annotations:
type: object
description: Unstructured key value map containing arbitrary metadata
example:
monitoring.syn.tools/sla: '24/7 Reactive'
syn.tools/tenant: t-nameless-pond-1234
Reason:
type: object
required:
- reason
description: A reason for responses
properties:
reason:
type: string
description: The reason message
example: Because of reasons
Inventory:
type: object
required:
- cluster
description: Inventory data of a cluster
properties:
cluster:
type: string
inventory:
type: object
RevisionedGitRepo:
allOf:
- $ref: '#/components/schemas/GitRepo'
- $ref: '#/components/schemas/Revision'
GitRepo:
type: object
description: Configuration Git repository, usually generated by the API
properties:
url:
type: string
description: Full URL of the git repo
example: ssh://[email protected]/acmecorp/gitops-mycluster.git
type:
type: string
description: Specifies if a repo should be managed by the git controller. A value of 'unmanaged' means it's not manged by the controller
example: auto
deployKey:
type: string
description: SSH public key / deploy key for clusterconfiguration catalog Git repository. This property is managed by Steward.
example: |
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDG9a5WwLuwcxMRydNqI4ofuzXucrBKpGOvPV9PO4guj
hostKeys:
type: string
description: SSH known hosts of the git server (multiline possible for multiple keys)
example: |
gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=
Revision:
type: object
properties:
revision:
type: string
description: Revision to use with a git repository.
responses:
Default:
description: A default response with a reason.
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
parameters:
TenantIdParameter:
name: tenantId
in: path
required: true
description: Distinct id of the tenant.
schema:
$ref: '#/components/schemas/Id'
ClusterIdParameter:
name: clusterId
in: path
required: true
description: Distinct id of the cluster.
schema:
$ref: '#/components/schemas/Id'
tags:
- name: tenant
description: Management of tenants
- name: cluster
description: Management of clusters
- name: bootstrapping
description: Cluster bootstrapping
- name: inventory
description: Cluster inventory time based data
- name: system
description: API system
paths:
/:
get:
operationId: discovery
summary: Lieutenant API Root
description: Get metadata about Lieutenant
security: []
tags:
- system
responses:
'200':
description: Lieutenant metadata
content:
application/json:
schema:
$ref: '#/components/schemas/Metadata'
default:
$ref: '#/components/responses/Default'
/tenants:
get:
operationId: listTenants
summary: Returns a list of tenants
description: List of all tenants available in the API
tags:
- tenant
responses:
'200':
description: Tenant listing. Empty array if no tenants available.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Tenant'
example:
- id: aezoo6
displayName: Big Corp.
gitRepo: https://github.com/bigcorp/commodore-config.git
- id: os3ce3
displayName: Acme Corp. (Subtenant of Big Corp)
gitRepo: https://github.com/acmecorp/commodore-config.git
default:
$ref: '#/components/responses/Default'
post:
operationId: createTenant
summary: Creates a new tenant
description: |-
Create a tenant in the API.
The ID is generated by the API (in the form `t-<adjective>-<noun>-<digits>` where
all the words are lowercase, max 63 characters in total).
It generates the `Tenant` object in the configured namespace (usually the same namespace where the API runs).
The customer config Git repository URL is required.
tags:
- tenant
requestBody:
required: true
description: Create a new tenant
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
responses:
'201':
description: Tenant created
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
example:
id: aezoo6
displayName: Acme Corp.
gitRepo: https://github.com/acmecorp/commodore-config.git
'400':
description: Tenant can't be created
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
'405':
description: Tenant already exists
default:
$ref: '#/components/responses/Default'
/tenants/{tenantId}:
get:
operationId: getTenant
summary: Returns all values of a tenant
description: Returns all values of a tenant
tags:
- tenant
parameters:
- $ref: '#/components/parameters/TenantIdParameter'
responses:
'200':
description: Tenant found
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'404':
description: A tenant with the specified id wasn't found.
default:
$ref: '#/components/responses/Default'
patch:
operationId: updateTenant
summary: Updates a tenant
description: Updates a tenant
tags:
- tenant
parameters:
- $ref: '#/components/parameters/TenantIdParameter'
requestBody:
description: Update tenant with properties to be changed (RFC 7396)
required: true
content:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/TenantProperties'
responses:
'200':
description: Tenant updated
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'403':
description: Tenant update forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
put:
operationId: putTenant
summary: Updates or creates a tenant
description: Updates or creates a tenant
tags:
- tenant
parameters:
- $ref: '#/components/parameters/TenantIdParameter'
requestBody:
required: true
description: Update or create a tenant
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
responses:
'200':
description: Tenant updated
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
'201':
description: Tenant created
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
example:
id: aezoo6
displayName: Acme Corp.
gitRepo: https://github.com/acmecorp/commodore-config.git
'403':
description: Tenant update forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
delete:
operationId: deleteTenant
summary: Deletes a tenant
description: Deletes a tenant
tags:
- tenant
parameters:
- $ref: '#/components/parameters/TenantIdParameter'
responses:
'204':
description: Tenant deleted
'403':
description: Tenant deletion forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
/clusters:
get:
operationId: listClusters
summary: Returns a list of clusters
description: List of clusters available in the API
tags:
- cluster
parameters:
- in: query
name: tenant
schema:
type: string
description: Filter clusters by tenant id
example: aezoo6
- in: query
name: sort_by
schema:
type: string
enum: [id, tenant, displayName]
default: id
description: Sort list by field
example: id
responses:
'200':
description: Cluster listing. Empty array if no tenants available.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Cluster'
default:
$ref: '#/components/responses/Default'
post:
operationId: createCluster
summary: Creates a new cluster
description: |-
Create a cluster in the API.
The ID is generated by the API (in the form `c-<adjective>-<noun>-<digits>` where
all the words are lowercase, max 63 characters in total).
It checks if the tenant exists before creating the object, otherwise fails.
It generates the `Cluster` object and its `<GitRepoSpec>` and `bootstrapToken` values.
tags:
- cluster
requestBody:
description: Create a new Cluster
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
responses:
'201':
description: Cluster created
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'400':
description: Cluster can't be created
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
'405':
description: Cluster already exists
default:
$ref: '#/components/responses/Default'
/clusters/{clusterId}:
get:
operationId: getCluster
summary: Returns all values of a cluster
description: Returns all values of a cluster
tags:
- cluster
parameters:
- $ref: '#/components/parameters/ClusterIdParameter'
responses:
'200':
description: Cluster found
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'404':
description: A cluster with the specified id wasn't found.
default:
$ref: '#/components/responses/Default'
patch:
operationId: updateCluster
summary: Updates a cluster
description: Updates a cluster
tags:
- cluster
parameters:
- $ref: '#/components/parameters/ClusterIdParameter'
requestBody:
description: Update cluster with properties to be changed (RFC 7396)
required: true
content:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/ClusterProperties'
responses:
'200':
description: Cluster updated
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'403':
description: Cluster update forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
put:
operationId: putCluster
summary: Updates or creates a cluster
description: Updates or creates a cluster
tags:
- cluster
parameters:
- $ref: '#/components/parameters/ClusterIdParameter'
requestBody:
description: Update or create a Cluster
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
responses:
'200':
description: Cluster updated
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'201':
description: Cluster created
content:
application/json:
schema:
$ref: '#/components/schemas/Cluster'
'403':
description: Cluster update forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
delete:
operationId: deleteCluster
summary: Deletes a cluster
description: Deletes a cluster
tags:
- cluster
parameters:
- $ref: '#/components/parameters/ClusterIdParameter'
responses:
'204':
description: Cluster deleted
'403':
description: Cluster deletion forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
/clusters/{clusterId}/compileMeta:
post:
operationId: postClusterCompileMeta
summary: Stores compilation metadata for a cluster
description: |
Stores compilation metadata for a cluster.
Intended for commodore to report the last compilation.
Contains version information and timestamps.
tags:
- cluster
- metadata
- version-information
parameters:
- $ref: '#/components/parameters/ClusterIdParameter'
requestBody:
description: Stores compilation metadata for a cluster
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ClusterCompileMeta'
responses:
'204':
description: Data stored
'403':
description: Cluster update forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Reason'
default:
$ref: '#/components/responses/Default'
/install/steward.json:
get:
operationId: installSteward
summary: Returns the Steward JSON installation manifest
description: |-
Autogenerated JSON containing all the needed parameters for having Steward up and running.
It Iterates through all available Cluster objects to find the object matching the token in the field `spec.bootstrapToken.token`.
It checks if the token is valid (fields `spec.bootstrapToken.valid` and field `spec.bootstrapToken.validUntil`).
If valid delivers the JSON and sets the field `spec.bootstrapToken.valid` to `false`.
security: []
tags:
- bootstrapping
parameters:
- in: query
name: token
schema:
type: string
description: Initial bootstrap token
responses:
'200':
description: Kubernetes manifests to install Steward, the cluster agent
content:
application/json:
schema:
type: object
'401':
description: Token invalid
'404':
description: Cluster not found
default:
$ref: '#/components/responses/Default'
/inventory:
get:
operationId: queryInventory
summary: Returns inventory data according to query
description: Search inventory data
tags:
- inventory
parameters:
- in: query
name: q
schema:
type: string
description: InfluxQL query string
example: SELECT LAST(version,cloud) FROM mycluster
responses:
'200':
description: Query succeeded
content:
application/json:
schema:
$ref: '#/components/schemas/Inventory'
default:
$ref: '#/components/responses/Default'
post:
operationId: updateInventory
summary: Write inventory data
description: Write inventory data
tags:
- inventory
requestBody:
description: Inventory data of a cluster
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Inventory'
responses:
'201':
description: Inventory data stored
default:
$ref: '#/components/responses/Default'
/healthz:
get:
operationId: healthz
summary: API health check
description: API health check
security: []
tags:
- system
responses:
'200':
description: All is fine
content:
text/plain:
schema:
type: string
example: ok
default:
$ref: '#/components/responses/Default'
/docs:
get:
operationId: docs
summary: API documentation
description: Interactive API documentation based on Swagger UI
security: []
tags:
- system
responses:
'200':
description: Swagger UI assets
content:
text/html:
schema:
type: string
/openapi.json:
get:
operationId: openapi
summary: OpenAPI JSON spec
description: OpenAPI JSON specification
security: []
tags:
- system
responses:
'200':
description: OpenAPI JSON spec
content:
application/json:
schema:
type: object