Skip to content

Commit 6252cdd

Browse files
authored
Implement compileMeta endpoint according to SDD 0031 (#218)
1 parent 77806ea commit 6252cdd

File tree

8 files changed

+799
-134
lines changed

8 files changed

+799
-134
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ require (
1818
github.com/projectsyn/lieutenant-operator v1.6.0
1919
github.com/stretchr/testify v1.9.0
2020
github.com/taion809/haikunator v0.0.0-20150324135039-4e414e676fd1
21+
go.uber.org/multierr v1.11.0
2122
k8s.io/api v0.30.1
2223
k8s.io/apimachinery v0.30.1
2324
sigs.k8s.io/controller-runtime v0.18.3

openapi.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ components:
102102
$ref: '#/components/schemas/ClusterFacts'
103103
dynamicFacts:
104104
$ref: '#/components/schemas/DynamicClusterFacts'
105+
compileMeta:
106+
$ref: '#/components/schemas/ClusterCompileMeta'
105107
gitRepo:
106108
$ref: '#/components/schemas/GitRepo'
107109
tenantGitRepoRevision:
@@ -160,6 +162,104 @@ components:
160162
major: "1"
161163
minor: "20"
162164
platform: linux/amd64
165+
# ClusterCompileMeta is exported from k8s. Must match the k8s structure.
166+
# kubectl get --raw /openapi/v3/apis/syn.tools/v1alpha1 | yq --prettyPrint '.components.schemas["tools.syn.v1alpha1.Cluster"].properties.status.properties.compileMeta'
167+
ClusterCompileMeta:
168+
description: CompileMeta contains information about the last compilation with Commodore.
169+
type: object
170+
properties:
171+
commodoreBuildInfo:
172+
description: CommodoreBuildInfo is the freeform build information reported by the Commodore binary used for the last compilation.
173+
type: object
174+
additionalProperties:
175+
type: string
176+
global:
177+
description: Global contains the information of the global configuration used for the last compilation.
178+
type: object
179+
properties:
180+
gitSha:
181+
description: GitSHA is the git commit SHA of the used commit.
182+
type: string
183+
path:
184+
description: Path is the path inside the git repository where the configuration is stored.
185+
type: string
186+
url:
187+
description: URL is the URL of the git repository.
188+
type: string
189+
version:
190+
description: |-
191+
Version is the version of the configuration.
192+
Can point to a tag, branch or any other git reference.
193+
type: string
194+
instances:
195+
description: |-
196+
Instances contains the information of the component instances used for the last compilation.
197+
The key is the name of the component instance.
198+
type: object
199+
additionalProperties:
200+
description: CompileMetaInstanceVersionInfo contains information about the version of a component instance.
201+
type: object
202+
properties:
203+
component:
204+
description: Component is the name of a component instance.
205+
type: string
206+
gitSha:
207+
description: GitSHA is the git commit SHA of the used commit.
208+
type: string
209+
path:
210+
description: Path is the path inside the git repository where the configuration is stored.
211+
type: string
212+
url:
213+
description: URL is the URL of the git repository.
214+
type: string
215+
version:
216+
description: |-
217+
Version is the version of the configuration.
218+
Can point to a tag, branch or any other git reference.
219+
type: string
220+
lastCompile:
221+
description: LastCompile is the time of the last successful compilation.
222+
type: string
223+
format: date-time
224+
packages:
225+
description: Packages contains the information of the packages used for the last compilation.
226+
type: object
227+
additionalProperties:
228+
description: CompileMetaVersionInfo contains information about the version of a configuration repo or a package.
229+
type: object
230+
properties:
231+
gitSha:
232+
description: GitSHA is the git commit SHA of the used commit.
233+
type: string
234+
path:
235+
description: Path is the path inside the git repository where the configuration is stored.
236+
type: string
237+
url:
238+
description: URL is the URL of the git repository.
239+
type: string
240+
version:
241+
description: |-
242+
Version is the version of the configuration.
243+
Can point to a tag, branch or any other git reference.
244+
type: string
245+
tenant:
246+
description: Tenant contains the information of the tenant configuration used for the last compilation.
247+
type: object
248+
properties:
249+
gitSha:
250+
description: GitSHA is the git commit SHA of the used commit.
251+
type: string
252+
path:
253+
description: Path is the path inside the git repository where the configuration is stored.
254+
type: string
255+
url:
256+
description: URL is the URL of the git repository.
257+
type: string
258+
version:
259+
description: |-
260+
Version is the version of the configuration.
261+
Can point to a tag, branch or any other git reference.
262+
type: string
163263
Cluster:
164264
allOf:
165265
- $ref: '#/components/schemas/ClusterId'
@@ -623,6 +723,39 @@ paths:
623723
$ref: '#/components/schemas/Reason'
624724
default:
625725
$ref: '#/components/responses/Default'
726+
/clusters/{clusterId}/compileMeta:
727+
post:
728+
operationId: postClusterCompileMeta
729+
summary: Stores compilation metadata for a cluster
730+
description: |
731+
Stores compilation metadata for a cluster.
732+
733+
Intended for commodore to report the last compilation.
734+
Contains version information and timestamps.
735+
tags:
736+
- cluster
737+
- metadata
738+
- version-information
739+
parameters:
740+
- $ref: '#/components/parameters/ClusterIdParameter'
741+
requestBody:
742+
description: Stores compilation metadata for a cluster
743+
required: true
744+
content:
745+
application/json:
746+
schema:
747+
$ref: '#/components/schemas/ClusterCompileMeta'
748+
responses:
749+
'204':
750+
description: Data stored
751+
'403':
752+
description: Cluster update forbidden
753+
content:
754+
application/json:
755+
schema:
756+
$ref: '#/components/schemas/Reason'
757+
default:
758+
$ref: '#/components/responses/Default'
626759
/install/steward.json:
627760
get:
628761
operationId: installSteward

0 commit comments

Comments
 (0)