@@ -199,11 +199,7 @@ async Task CreatePod(StartKubernetesScriptCommandV1 command, IScriptWorkspace wo
199
199
{
200
200
Name = podName ,
201
201
NamespaceProperty = KubernetesConfig . Namespace ,
202
- Labels = new Dictionary < string , string >
203
- {
204
- [ "octopus.com/serverTaskId" ] = command . TaskId ,
205
- [ "octopus.com/scriptTicketId" ] = command . ScriptTicket . TaskId
206
- } ,
202
+ Labels = GetScriptPodLabels ( tentacleScriptLog , command ) ,
207
203
Annotations = ParseScriptPodAnnotations ( tentacleScriptLog )
208
204
} ,
209
205
Spec = new V1PodSpec
@@ -419,6 +415,29 @@ V1Affinity ParseScriptPodAffinity(InMemoryTentacleScriptLog tentacleScriptLog)
419
415
KubernetesConfig . PodAnnotationsJsonVariableName ,
420
416
"pod annotations" ) ;
421
417
418
+ Dictionary < string , string > ? GetScriptPodLabels ( InMemoryTentacleScriptLog tentacleScriptLog , StartKubernetesScriptCommandV1 command )
419
+ {
420
+ var labels = new Dictionary < string , string >
421
+ {
422
+ [ "octopus.com/serverTaskId" ] = command . TaskId ,
423
+ [ "octopus.com/scriptTicketId" ] = command . ScriptTicket . TaskId
424
+ } ;
425
+ var extraLabels = ParseScriptPodJson < Dictionary < string , string > > (
426
+ tentacleScriptLog ,
427
+ KubernetesConfig . PodLabelsJson ,
428
+ KubernetesConfig . PodLabelsJsonVariableName ,
429
+ "pod labels" ) ;
430
+
431
+ if ( extraLabels != null )
432
+ {
433
+ labels . AddRange ( extraLabels ) ;
434
+ }
435
+
436
+ return labels ;
437
+ }
438
+
439
+
440
+
422
441
[ return : NotNullIfNotNull ( "defaultValue" ) ]
423
442
T ? ParseScriptPodJson < T > ( InMemoryTentacleScriptLog tentacleScriptLog , string ? json , string envVarName , string description , T ? defaultValue = null ) where T : class
424
443
{
0 commit comments