Skip to content

Commit 2ebac5a

Browse files
authored
Merge pull request #19763 from jakesmith/HPCC-33834-backgroud-vault-update
HPCC-33834 Allow vaults to be updated without k8s restarts Reviewed-by: Gavin Halliday <[email protected]> Merged-by: Gavin Halliday <[email protected]>
2 parents 05e7a48 + 5e6d1a8 commit 2ebac5a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

helm/hpcc/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ globalExcludeList below is a hard-coded list of global keys to exclude.
26232623
26242624
*/}}
26252625
{{- define "hpcc.getConfigSHA" }}
2626-
{{- $globalExcludeList := list "~.*::replicas" -}}
2626+
{{- $globalExcludeList := list "~.*::replicas" "~.*::vaults" -}}
26272627
{{- $globalExcludeSectionRegexList := list ".*-job.yaml$" -}}
26282628
{{- $componentExcludeList := ternary (splitList "," (.excludeKeys | default "")) list (hasKey . "excludeKeys") -}}
26292629
{{- $combinedExcludeKeyList := concat $globalExcludeList $componentExcludeList -}}

system/jlib/jsecrets.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,12 +1079,24 @@ class CVaultManager : public CInterfaceOf<IVaultManager>
10791079
}
10801080
};
10811081

1082-
IVaultManager *ensureVaultManager()
1082+
static CConfigUpdateHook vaultManagerUpdateHook;
1083+
static void vaultManagerConfigUpdate(const IPropertyTree *oldComponentConfiguration, const IPropertyTree *oldGlobalConfiguration)
1084+
{
1085+
Owned<IVaultManager> newVaultManager = new CVaultManager();
1086+
{
1087+
CriticalBlock block(secretCS);
1088+
vaultManager.swap(newVaultManager);
1089+
}
1090+
}
1091+
IVaultManager *getVaultManager()
10831092
{
10841093
CriticalBlock block(secretCS);
10851094
if (!vaultManager)
1095+
{
10861096
vaultManager.setown(new CVaultManager());
1087-
return vaultManager;
1097+
vaultManagerUpdateHook.installOnce(vaultManagerConfigUpdate, false);
1098+
}
1099+
return LINK(vaultManager);
10881100
}
10891101

10901102
//---------------------------------------------------------------------------------------------------------------------
@@ -1162,7 +1174,7 @@ static IPropertyTree *resolveVaultSecret(const char *category, const char * name
11621174
{
11631175
CVaultKind kind;
11641176
StringBuffer json;
1165-
IVaultManager *vaultmgr = ensureVaultManager();
1177+
Owned<IVaultManager> vaultmgr = getVaultManager();
11661178
if (isEmptyString(vaultId))
11671179
{
11681180
if (!vaultmgr->requestSecretByCategory(category, kind, json, name, version))

0 commit comments

Comments
 (0)