Skip to content

Commit

Permalink
Updated Kubernetes pod creation to use sh -c to bypass selinux issues (
Browse files Browse the repository at this point in the history
…#982)

Co-authored-by: Alastair Pitts <APErebus@users.noreply.github.com>
  • Loading branch information
liam-mackie and APErebus authored Aug 6, 2024
1 parent 8a45a56 commit f1e9679
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions source/Octopus.Tentacle/Kubernetes/KubernetesScriptPodCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,24 @@ protected async Task<V1Container> CreateScriptContainer(StartKubernetesScriptCom

var resourceRequirements = GetScriptPodResourceRequirements(tentacleScriptLog);

var commandString = string.Join(" ", new[] {
$"{homeDir}/Work/{command.ScriptTicket.TaskId}/bootstrapRunner",
Path.Combine(homeDir, workspacePath),
Path.Combine(homeDir, workspacePath, scriptName)
}.Concat(scriptArguments ?? Array.Empty<string>())
.Select(x => $"\"{x}\""));

return new V1Container
{
Name = podName,
Image = command.PodImageConfiguration?.Image ?? await containerResolver.GetContainerImageForCluster(),
Command = new List<string> { $"{homeDir}/Work/{command.ScriptTicket.TaskId}/bootstrapRunner" },
ImagePullPolicy = KubernetesConfig.ScriptPodPullPolicy,
Command = new List<string> { "sh" },
Args = new List<string>
{
Path.Combine(homeDir, workspacePath),
Path.Combine(homeDir, workspacePath, scriptName)
}.Concat(scriptArguments ?? Array.Empty<string>())
"-c",
commandString
}
.ToList(),
VolumeMounts = new List<V1VolumeMount> { new(homeDir, "tentacle-home") },
Env = new List<V1EnvVar>
Expand Down

0 comments on commit f1e9679

Please sign in to comment.