Provisioning: Keep the existing k8s name if it is specified in metadata (#100672)
* keep name
* keep name
* Revert "keep name"
This reverts commit 29f87bcaeb.
* Commit stale go.mod
* Keep name also for sync deletions
---------
Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
This commit is contained in:
1 parent
1419639b0b
commit
cfd29c1653
2 files changed
+9
-3
No files matched your search
@@ -379,8 +379,12 @@ func (r *syncJob) deleteObject(ctx context.Context, path string, ref string) job
|
||||
return result
|
||||
}
|
||||
|
||||
// Find the referenced file
|
||||
objName, _ := resources.NamesFromHashedRepoPath(r.repository.Config().Name, path)
|
||||
objName := obj.GetName()
|
||||
if objName == "" {
|
||||
// Find the referenced file
|
||||
objName, _ = resources.NamesFromHashedRepoPath(r.repository.Config().Name, path)
|
||||
}
|
||||
|
||||
result.Name = objName
|
||||
result.Resource = gvk.Kind
|
||||
result.Group = gvk.Group
|
||||
|
||||
@@ -161,7 +161,9 @@ func (r *Parser) Parse(ctx context.Context, info *repository.FileInfo, validate
|
||||
})
|
||||
|
||||
objName, folderName := NamesFromHashedRepoPath(cfg.Name, info.Path)
|
||||
obj.SetName(objName)
|
||||
if obj.GetName() == "" {
|
||||
obj.SetName(objName) // use the name saved in config
|
||||
}
|
||||
obj.SetUID("") // clear identifiers
|
||||
obj.SetResourceVersion("") // clear identifiers
|
||||
parsed.Meta.SetFolder(folderName)
|
||||
|
||||
Reference in new issue
Block a user