Skip to content

Commit

Permalink
Merge pull request #268 from projectsyn/compile-meta-storage
Browse files Browse the repository at this point in the history
Add `compileMeta` storage according to SDD 0031
  • Loading branch information
bastjan authored May 27, 2024
2 parents 804c1b0 + 1fd5a03 commit 99ccfa2
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 0 deletions.
40 changes: 40 additions & 0 deletions api/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,46 @@ type ClusterStatus struct {
BootstrapToken *BootstrapToken `json:"bootstrapToken,omitempty"`
// Facts are key/value pairs for dynamically fetched facts
Facts Facts `json:"facts,omitempty"`
// CompileMeta contains information about the last compilation with Commodore.
CompileMeta CompileMeta `json:"compileMeta,omitempty"`
}

// CompileMeta contains information about the last compilation with Commodore.
type CompileMeta struct {
// LastCompile is the time of the last successful compilation.
LastCompile metav1.Time `json:"lastCompile,omitempty"`
// CommodoreBuildInfo is the freeform build information reported by the Commodore binary used for the last compilation.
CommodoreBuildInfo map[string]string `json:"commodoreBuildInfo,omitempty"`
// Global contains the information of the global configuration used for the last compilation.
Global CompileMetaVersionInfo `json:"global,omitempty"`
// Tenant contains the information of the tenant configuration used for the last compilation.
Tenant CompileMetaVersionInfo `json:"tenant,omitempty"`
// Packages contains the information of the packages used for the last compilation.
Packages map[string]CompileMetaVersionInfo `json:"packages,omitempty"`
// Instances contains the information of the component instances used for the last compilation.
// The key is the name of the component instance.
Instances map[string]CompileMetaInstanceVersionInfo `json:"instances,omitempty"`
}

// CompileMetaVersionInfo contains information about the version of a configuration repo or a package.
type CompileMetaVersionInfo struct {
// URL is the URL of the git repository.
URL string `json:"url,omitempty"`
// GitSHA is the git commit SHA of the used commit.
GitSHA string `json:"gitSha,omitempty"`
// Version is the version of the configuration.
// Can point to a tag, branch or any other git reference.
Version string `json:"version,omitempty"`
// Path is the path inside the git repository where the configuration is stored.
Path string `json:"path,omitempty"`
}

// CompileMetaInstanceVersionInfo contains information about the version of a component instance.
type CompileMetaInstanceVersionInfo struct {
CompileMetaVersionInfo `json:",inline"`

// Component is the name of a component instance.
Component string `json:"component,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
71 changes: 71 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 107 additions & 0 deletions config/crd/bases/syn.tools_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,113 @@ spec:
format: date-time
type: string
type: object
compileMeta:
description: CompileMeta contains information about the last compilation
with Commodore.
properties:
commodoreBuildInfo:
additionalProperties:
type: string
description: CommodoreBuildInfo is the freeform build information
reported by the Commodore binary used for the last compilation.
type: object
global:
description: Global contains the information of the global configuration
used for the last compilation.
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
type: object
instances:
additionalProperties:
description: CompileMetaInstanceVersionInfo contains information
about the version of a component instance.
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
type: object
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
lastCompile:
description: LastCompile is the time of the last successful compilation.
format: date-time
type: string
packages:
additionalProperties:
description: CompileMetaVersionInfo contains information about
the version of a configuration repo or a package.
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
type: object
description: Packages contains the information of the packages
used for the last compilation.
type: object
tenant:
description: Tenant contains the information of the tenant configuration
used for the last compilation.
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
type: object
type: object
facts:
additionalProperties:
type: string
Expand Down
67 changes: 67 additions & 0 deletions docs/modules/ROOT/pages/references/api-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,73 @@ Adopt: will create a new external resource or will adopt and manage an already



[id="{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemeta"]
=== CompileMeta

CompileMeta contains information about the last compilation with Commodore.

.Appears In:
****
- xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-clusterstatus[$$ClusterStatus$$]
****

[cols="25a,75a", options="header"]
|===
| Field | Description
| *`lastCompile`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#time-v1-meta[$$Time$$]__ | LastCompile is the time of the last successful compilation.
| *`commodoreBuildInfo`* __object (keys:string, values:string)__ | CommodoreBuildInfo is the freeform build information reported by the Commodore binary used for the last compilation.
| *`global`* __xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetaversioninfo[$$CompileMetaVersionInfo$$]__ | Global contains the information of the global configuration used for the last compilation.
| *`tenant`* __xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetaversioninfo[$$CompileMetaVersionInfo$$]__ | Tenant contains the information of the tenant configuration used for the last compilation.
| *`packages`* __object (keys:string, values:xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetaversioninfo[$$CompileMetaVersionInfo$$])__ | Packages contains the information of the packages used for the last compilation.
| *`instances`* __object (keys:string, values:xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetainstanceversioninfo[$$CompileMetaInstanceVersionInfo$$])__ | Instances contains the information of the component instances used for the last compilation.
The key is the name of the component instance.
|===


[id="{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetainstanceversioninfo"]
=== CompileMetaInstanceVersionInfo

CompileMetaInstanceVersionInfo contains information about the version of a component instance.

.Appears In:
****
- xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemeta[$$CompileMeta$$]
****

[cols="25a,75a", options="header"]
|===
| Field | Description
| *`url`* __string__ | URL is the URL of the git repository.
| *`gitSha`* __string__ | GitSHA is the git commit SHA of the used commit.
| *`version`* __string__ | Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
| *`path`* __string__ | Path is the path inside the git repository where the configuration is stored.
| *`component`* __string__ | Component is the name of a component instance.
|===


[id="{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetaversioninfo"]
=== CompileMetaVersionInfo

CompileMetaVersionInfo contains information about the version of a configuration repo or a package.

.Appears In:
****
- xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemeta[$$CompileMeta$$]
- xref:{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-compilemetainstanceversioninfo[$$CompileMetaInstanceVersionInfo$$]
****

[cols="25a,75a", options="header"]
|===
| Field | Description
| *`url`* __string__ | URL is the URL of the git repository.
| *`gitSha`* __string__ | GitSHA is the git commit SHA of the used commit.
| *`version`* __string__ | Version is the version of the configuration.
Can point to a tag, branch or any other git reference.
| *`path`* __string__ | Path is the path inside the git repository where the configuration is stored.
|===


[id="{anchor_prefix}-github-com-projectsyn-lieutenant-operator-api-v1alpha1-creationpolicy"]
=== CreationPolicy (string)

Expand Down

0 comments on commit 99ccfa2

Please sign in to comment.