Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ namespace Octopus.Tentacle.Contracts
{
public class KubernetesAgentAuthContext
{
public KubernetesAgentAuthContext(string spaceSlug, string projectSlug, string environmentSlug, string? tenantSlug, string stepSlug)
public KubernetesAgentAuthContext(
string spaceSlug,
string projectSlug,
string? projectGroupSlug,
string environmentSlug,
string? tenantSlug,
string stepSlug)
{
SpaceSlug = spaceSlug;
ProjectSlug = projectSlug;
ProjectGroupSlug = projectGroupSlug;
EnvironmentSlug = environmentSlug;
TenantSlug = tenantSlug;
StepSlug = stepSlug;
}

public string SpaceSlug { get; }
public string ProjectSlug { get; }
public string? ProjectGroupSlug { get; } // This is only nullable for backwards compatibility
public string EnvironmentSlug { get; }
public string? TenantSlug { get; }
public string StepSlug { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Newtonsoft.Json;
using Octopus.Tentacle.Configuration;
using Octopus.Tentacle.Configuration.Instances;
using Octopus.Tentacle.Contracts;
using Octopus.Tentacle.Contracts.KubernetesScriptServiceV1;
using Octopus.Tentacle.Core.Diagnostics;
using Octopus.Tentacle.Core.Services.Scripts.Locking;
Expand Down Expand Up @@ -434,7 +433,7 @@ V1Affinity ParseScriptPodAffinity(InMemoryTentacleScriptLog tentacleScriptLog)
KubernetesConfig.PodAnnotationsJsonVariableName,
"pod annotations");

Dictionary<string, string>? GetScriptPodAnnotations(InMemoryTentacleScriptLog tentacleScriptLog, StartKubernetesScriptCommandV1 command)
Dictionary<string, string> GetScriptPodAnnotations(InMemoryTentacleScriptLog tentacleScriptLog, StartKubernetesScriptCommandV1 command)
{
var annotations = ParseScriptPodAnnotations(tentacleScriptLog) ?? new Dictionary<string, string>();
annotations.AddRange(GetAuthContext(command));
Expand Down Expand Up @@ -478,6 +477,13 @@ static Dictionary<string, string> GetAuthContext(StartKubernetesScriptCommandV1
? HashValue(command.AuthContext.ProjectSlug)
: command.AuthContext.ProjectSlug;

if (command.AuthContext.ProjectGroupSlug is not null)
{
dict[$"{KubernetesConfig.AgentLabelNamespace}/project-group"] = hash
? HashValue(command.AuthContext.ProjectGroupSlug)
: command.AuthContext.ProjectGroupSlug;
}

dict[$"{KubernetesConfig.AgentLabelNamespace}/environment"] = hash
? HashValue(command.AuthContext.EnvironmentSlug)
: command.AuthContext.EnvironmentSlug;
Expand Down