diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-10-25 22:21:16 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-10-25 22:21:16 +0200 |
commit | 3f0da55c0183e9da2f4658308dee1915338266aa (patch) | |
tree | c2b9b4ad06786e51bf9262cb3d0dfacad7ee9853 /src/k8splugin/internal/namegenerator/namegenerator.go | |
parent | 6c28e5a7ca5a0688f5aefad010e0a3071ff6fe0b (diff) |
Fix resolution of values for Config API0.9.3
Issue-ID: MULTICLOUD-1414
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: Ibca5846ffe083bfc4d505c4c3c13efac2c6e2426
Diffstat (limited to 'src/k8splugin/internal/namegenerator/namegenerator.go')
-rw-r--r-- | src/k8splugin/internal/namegenerator/namegenerator.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/k8splugin/internal/namegenerator/namegenerator.go b/src/k8splugin/internal/namegenerator/namegenerator.go index 52eef366..0a49633a 100644 --- a/src/k8splugin/internal/namegenerator/namegenerator.go +++ b/src/k8splugin/internal/namegenerator/namegenerator.go @@ -141,8 +141,28 @@ func (c *cache) generateName() string { } } +func (c *cache) releaseName(name string) { + c.mux.Lock() + defer c.mux.Unlock() + + c.init() + + if c.isAlreadyUsed(name) { + c.cache[name] = false + + // Update the cache and db + c.writeCacheToDB() + } +} + // Generate returns an autogenerated name func Generate() string { return nameCache.generateName() } + +// Release name from cache +func Release(name string) { + + nameCache.releaseName(name) +} |