Revert "Adds support for command overrides to container recipes."

This reverts commit d1a70d2465.
This commit is contained in:
Ben 2024-03-13 10:01:47 +01:00
parent d1a70d2465
commit 23396f54e0
No known key found for this signature in database
GPG Key ID: 541B9D8C9F1426A1
4 changed files with 3 additions and 31 deletions

View File

@ -498,17 +498,10 @@ namespace KubernetesWorkflow
Ports = CreateContainerPorts(recipe), Ports = CreateContainerPorts(recipe),
Env = CreateEnv(recipe), Env = CreateEnv(recipe),
VolumeMounts = CreateContainerVolumeMounts(recipe), VolumeMounts = CreateContainerVolumeMounts(recipe),
Resources = CreateResourceLimits(recipe), Resources = CreateResourceLimits(recipe)
Command = CreateCommandList(recipe)
}; };
} }
private IList<string> CreateCommandList(ContainerRecipe recipe)
{
if (recipe.CommandOverride == null || !recipe.CommandOverride.Command.Any()) return null!;
return recipe.CommandOverride.Command.ToList();
}
private V1ResourceRequirements CreateResourceLimits(ContainerRecipe recipe) private V1ResourceRequirements CreateResourceLimits(ContainerRecipe recipe)
{ {
return new V1ResourceRequirements return new V1ResourceRequirements

View File

@ -1,12 +0,0 @@
namespace KubernetesWorkflow.Recipe
{
public class CommandOverride
{
public CommandOverride(params string[] command)
{
Command = command;
}
public string[] Command { get; }
}
}

View File

@ -2,14 +2,13 @@
{ {
public class ContainerRecipe public class ContainerRecipe
{ {
public ContainerRecipe(int number, string? nameOverride, string image, ContainerResources resources, SchedulingAffinity schedulingAffinity, CommandOverride commandOverride, bool setCriticalPriority, Port[] exposedPorts, Port[] internalPorts, EnvVar[] envVars, PodLabels podLabels, PodAnnotations podAnnotations, VolumeMount[] volumes, ContainerAdditionals additionals) public ContainerRecipe(int number, string? nameOverride, string image, ContainerResources resources, SchedulingAffinity schedulingAffinity, bool setCriticalPriority, Port[] exposedPorts, Port[] internalPorts, EnvVar[] envVars, PodLabels podLabels, PodAnnotations podAnnotations, VolumeMount[] volumes, ContainerAdditionals additionals)
{ {
Number = number; Number = number;
NameOverride = nameOverride; NameOverride = nameOverride;
Image = image; Image = image;
Resources = resources; Resources = resources;
SchedulingAffinity = schedulingAffinity; SchedulingAffinity = schedulingAffinity;
CommandOverride = commandOverride;
SetCriticalPriority = setCriticalPriority; SetCriticalPriority = setCriticalPriority;
ExposedPorts = exposedPorts; ExposedPorts = exposedPorts;
InternalPorts = internalPorts; InternalPorts = internalPorts;
@ -36,7 +35,6 @@
public string? NameOverride { get; } public string? NameOverride { get; }
public ContainerResources Resources { get; } public ContainerResources Resources { get; }
public SchedulingAffinity SchedulingAffinity { get; } public SchedulingAffinity SchedulingAffinity { get; }
public CommandOverride CommandOverride { get; }
public bool SetCriticalPriority { get; } public bool SetCriticalPriority { get; }
public string Image { get; } public string Image { get; }
public Port[] ExposedPorts { get; } public Port[] ExposedPorts { get; }

View File

@ -14,7 +14,6 @@ namespace KubernetesWorkflow.Recipe
private RecipeComponentFactory factory = null!; private RecipeComponentFactory factory = null!;
private ContainerResources resources = new ContainerResources(); private ContainerResources resources = new ContainerResources();
private SchedulingAffinity schedulingAffinity = new SchedulingAffinity(); private SchedulingAffinity schedulingAffinity = new SchedulingAffinity();
private CommandOverride commandOverride = new CommandOverride();
private bool setCriticalPriority; private bool setCriticalPriority;
public ContainerRecipe CreateRecipe(int index, int containerNumber, RecipeComponentFactory factory, StartupConfig config) public ContainerRecipe CreateRecipe(int index, int containerNumber, RecipeComponentFactory factory, StartupConfig config)
@ -25,7 +24,7 @@ namespace KubernetesWorkflow.Recipe
Initialize(config); Initialize(config);
var recipe = new ContainerRecipe(containerNumber, config.NameOverride, Image, resources, schedulingAffinity, commandOverride, setCriticalPriority, var recipe = new ContainerRecipe(containerNumber, config.NameOverride, Image, resources, schedulingAffinity, setCriticalPriority,
exposedPorts.ToArray(), exposedPorts.ToArray(),
internalPorts.ToArray(), internalPorts.ToArray(),
envVars.ToArray(), envVars.ToArray(),
@ -44,7 +43,6 @@ namespace KubernetesWorkflow.Recipe
this.factory = null!; this.factory = null!;
resources = new ContainerResources(); resources = new ContainerResources();
schedulingAffinity = new SchedulingAffinity(); schedulingAffinity = new SchedulingAffinity();
commandOverride = new CommandOverride();
setCriticalPriority = false; setCriticalPriority = false;
return recipe; return recipe;
@ -132,11 +130,6 @@ namespace KubernetesWorkflow.Recipe
schedulingAffinity = new SchedulingAffinity(notIn); schedulingAffinity = new SchedulingAffinity(notIn);
} }
protected void OverrideCommand(params string[] command)
{
commandOverride = new CommandOverride(command);
}
protected void SetSystemCriticalPriority() protected void SetSystemCriticalPriority()
{ {
setCriticalPriority = true; setCriticalPriority = true;