Provisioning: Rename k8s origin metadata to repo (#96524)

This commit is contained in:
Ryan McKinley
2024-11-15 17:26:14 +03:00
committed by GitHub
parent 2e62f75166
commit cc6d057a18
23 changed files with 198 additions and 154 deletions
+2 -2
View File
@@ -97,7 +97,7 @@ func convertToK8sResource(v *playlistsvc.PlaylistDTO, namespacer request.Namespa
meta.SetUpdatedTimestampMillis(v.UpdatedAt)
if v.Id > 0 {
createdAt := time.UnixMilli(v.CreatedAt)
meta.SetOriginInfo(&utils.ResourceOriginInfo{
meta.SetRepositoryInfo(&utils.ResourceRepositoryInfo{
Name: "SQL",
Path: fmt.Sprintf("%d", v.Id),
Timestamp: &createdAt,
@@ -135,7 +135,7 @@ func getLegacyID(item *unstructured.Unstructured) int64 {
if err != nil {
return 0
}
info, _ := meta.GetOriginInfo()
info, _ := meta.GetRepositoryInfo()
if info != nil && info.Name == "SQL" {
i, err := strconv.ParseInt(info.Path, 10, 64)
if err == nil {
@@ -42,9 +42,9 @@ func TestPlaylistConversion(t *testing.T) {
"resourceVersion": "54321",
"creationTimestamp": "1970-01-01T00:00:12Z",
"annotations": {
"grafana.app/originPath": "123",
"grafana.app/originName": "SQL",
"grafana.app/originTimestamp":"1970-01-01T00:00:12Z",
"grafana.app/repoPath": "123",
"grafana.app/repoName": "SQL",
"grafana.app/repoTimestamp":"1970-01-01T00:00:12Z",
"grafana.app/updatedTimestamp": "1970-01-01T00:00:54Z"
}
},