Skip to content

Commit

Permalink
Mount agent-upgrade credentials default location in filesystem (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
rain-on authored Nov 26, 2024
1 parent 4f13a6d commit 3aeb42e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ protected override IList<V1Volume> CreateVolumes(StartKubernetesScriptCommandV1
{
ClaimName = KubernetesConfig.PodVolumeClaimName
}
}
},
CreateAgentUpgradeSecretVolume(),
};
}

Expand Down
34 changes: 30 additions & 4 deletions source/Octopus.Tentacle/Kubernetes/KubernetesScriptPodCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async Task CreatePod(StartKubernetesScriptCommandV1 command, IScriptWorkspace wo
.WhereNotNull()
.Select(secretName => new V1LocalObjectReference(secretName))
.ToList();

var pod = new V1Pod
{
Metadata = new V1ObjectMeta
Expand Down Expand Up @@ -240,7 +240,29 @@ protected virtual IList<V1Volume> CreateVolumes(StartKubernetesScriptCommandV1 c
{
ClaimName = KubernetesConfig.PodVolumeClaimName
}
}
},
CreateAgentUpgradeSecretVolume(),
};
}

protected V1Volume CreateAgentUpgradeSecretVolume()
{
return new()
{
Name = "agent-upgrade",
Secret = new V1SecretVolumeSource
{
SecretName = "agent-upgrade-secret",
Items = new List<V1KeyToPath>()
{
new()
{
Key = ".dockerconfigjson",
Path = "config.json"
}
},
Optional = true,
},
};
}

Expand Down Expand Up @@ -290,7 +312,11 @@ protected async Task<V1Container> CreateScriptContainer(StartKubernetesScriptCom
commandString
}
.ToList(),
VolumeMounts = new List<V1VolumeMount> { new(homeDir, "tentacle-home") },
VolumeMounts = new List<V1VolumeMount>
{
new(homeDir, "tentacle-home"),
new ("/root/.config/helm/registry/", "agent-upgrade")
},
Env = new List<V1EnvVar>
{
new(KubernetesConfig.NamespaceVariableName, KubernetesConfig.Namespace),
Expand Down Expand Up @@ -428,4 +454,4 @@ V1Affinity ParseScriptPodAffinity(InMemoryTentacleScriptLog tentacleScriptLog)
};
}
}
}
}

0 comments on commit 3aeb42e

Please sign in to comment.