Skip to content

Commit 3aeb42e

Browse files
authored
Mount agent-upgrade credentials default location in filesystem (#1044)
1 parent 4f13a6d commit 3aeb42e

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

source/Octopus.Tentacle/Kubernetes/KubernetesRawScriptPodCreator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ protected override IList<V1Volume> CreateVolumes(StartKubernetesScriptCommandV1
8080
{
8181
ClaimName = KubernetesConfig.PodVolumeClaimName
8282
}
83-
}
83+
},
84+
CreateAgentUpgradeSecretVolume(),
8485
};
8586
}
8687

source/Octopus.Tentacle/Kubernetes/KubernetesScriptPodCreator.cs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async Task CreatePod(StartKubernetesScriptCommandV1 command, IScriptWorkspace wo
181181
.WhereNotNull()
182182
.Select(secretName => new V1LocalObjectReference(secretName))
183183
.ToList();
184-
184+
185185
var pod = new V1Pod
186186
{
187187
Metadata = new V1ObjectMeta
@@ -240,7 +240,29 @@ protected virtual IList<V1Volume> CreateVolumes(StartKubernetesScriptCommandV1 c
240240
{
241241
ClaimName = KubernetesConfig.PodVolumeClaimName
242242
}
243-
}
243+
},
244+
CreateAgentUpgradeSecretVolume(),
245+
};
246+
}
247+
248+
protected V1Volume CreateAgentUpgradeSecretVolume()
249+
{
250+
return new()
251+
{
252+
Name = "agent-upgrade",
253+
Secret = new V1SecretVolumeSource
254+
{
255+
SecretName = "agent-upgrade-secret",
256+
Items = new List<V1KeyToPath>()
257+
{
258+
new()
259+
{
260+
Key = ".dockerconfigjson",
261+
Path = "config.json"
262+
}
263+
},
264+
Optional = true,
265+
},
244266
};
245267
}
246268

@@ -290,7 +312,11 @@ protected async Task<V1Container> CreateScriptContainer(StartKubernetesScriptCom
290312
commandString
291313
}
292314
.ToList(),
293-
VolumeMounts = new List<V1VolumeMount> { new(homeDir, "tentacle-home") },
315+
VolumeMounts = new List<V1VolumeMount>
316+
{
317+
new(homeDir, "tentacle-home"),
318+
new ("/root/.config/helm/registry/", "agent-upgrade")
319+
},
294320
Env = new List<V1EnvVar>
295321
{
296322
new(KubernetesConfig.NamespaceVariableName, KubernetesConfig.Namespace),
@@ -428,4 +454,4 @@ V1Affinity ParseScriptPodAffinity(InMemoryTentacleScriptLog tentacleScriptLog)
428454
};
429455
}
430456
}
431-
}
457+
}

0 commit comments

Comments
 (0)