From 23396f54e0ec8edbf90539d2ed00b8723a27da5d Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 13 Mar 2024 10:01:47 +0100 Subject: [PATCH] Revert "Adds support for command overrides to container recipes." This reverts commit d1a70d2465590098eebec15a06329b9c56f2050a. --- Framework/KubernetesWorkflow/K8sController.cs | 9 +-------- .../KubernetesWorkflow/Recipe/CommandOverride.cs | 12 ------------ .../KubernetesWorkflow/Recipe/ContainerRecipe.cs | 4 +--- .../Recipe/ContainerRecipeFactory.cs | 9 +-------- 4 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 Framework/KubernetesWorkflow/Recipe/CommandOverride.cs diff --git a/Framework/KubernetesWorkflow/K8sController.cs b/Framework/KubernetesWorkflow/K8sController.cs index 8af6fd8..bfea181 100644 --- a/Framework/KubernetesWorkflow/K8sController.cs +++ b/Framework/KubernetesWorkflow/K8sController.cs @@ -498,17 +498,10 @@ namespace KubernetesWorkflow Ports = CreateContainerPorts(recipe), Env = CreateEnv(recipe), VolumeMounts = CreateContainerVolumeMounts(recipe), - Resources = CreateResourceLimits(recipe), - Command = CreateCommandList(recipe) + Resources = CreateResourceLimits(recipe) }; } - private IList CreateCommandList(ContainerRecipe recipe) - { - if (recipe.CommandOverride == null || !recipe.CommandOverride.Command.Any()) return null!; - return recipe.CommandOverride.Command.ToList(); - } - private V1ResourceRequirements CreateResourceLimits(ContainerRecipe recipe) { return new V1ResourceRequirements diff --git a/Framework/KubernetesWorkflow/Recipe/CommandOverride.cs b/Framework/KubernetesWorkflow/Recipe/CommandOverride.cs deleted file mode 100644 index 7821c81..0000000 --- a/Framework/KubernetesWorkflow/Recipe/CommandOverride.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace KubernetesWorkflow.Recipe -{ - public class CommandOverride - { - public CommandOverride(params string[] command) - { - Command = command; - } - - public string[] Command { get; } - } -} diff --git a/Framework/KubernetesWorkflow/Recipe/ContainerRecipe.cs b/Framework/KubernetesWorkflow/Recipe/ContainerRecipe.cs index 78fcb63..fb7c8a4 100644 --- a/Framework/KubernetesWorkflow/Recipe/ContainerRecipe.cs +++ b/Framework/KubernetesWorkflow/Recipe/ContainerRecipe.cs @@ -2,14 +2,13 @@ { 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; NameOverride = nameOverride; Image = image; Resources = resources; SchedulingAffinity = schedulingAffinity; - CommandOverride = commandOverride; SetCriticalPriority = setCriticalPriority; ExposedPorts = exposedPorts; InternalPorts = internalPorts; @@ -36,7 +35,6 @@ public string? NameOverride { get; } public ContainerResources Resources { get; } public SchedulingAffinity SchedulingAffinity { get; } - public CommandOverride CommandOverride { get; } public bool SetCriticalPriority { get; } public string Image { get; } public Port[] ExposedPorts { get; } diff --git a/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs b/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs index 6b6ae2d..931013d 100644 --- a/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs +++ b/Framework/KubernetesWorkflow/Recipe/ContainerRecipeFactory.cs @@ -14,7 +14,6 @@ namespace KubernetesWorkflow.Recipe private RecipeComponentFactory factory = null!; private ContainerResources resources = new ContainerResources(); private SchedulingAffinity schedulingAffinity = new SchedulingAffinity(); - private CommandOverride commandOverride = new CommandOverride(); private bool setCriticalPriority; public ContainerRecipe CreateRecipe(int index, int containerNumber, RecipeComponentFactory factory, StartupConfig config) @@ -25,7 +24,7 @@ namespace KubernetesWorkflow.Recipe 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(), internalPorts.ToArray(), envVars.ToArray(), @@ -44,7 +43,6 @@ namespace KubernetesWorkflow.Recipe this.factory = null!; resources = new ContainerResources(); schedulingAffinity = new SchedulingAffinity(); - commandOverride = new CommandOverride(); setCriticalPriority = false; return recipe; @@ -132,11 +130,6 @@ namespace KubernetesWorkflow.Recipe schedulingAffinity = new SchedulingAffinity(notIn); } - protected void OverrideCommand(params string[] command) - { - commandOverride = new CommandOverride(command); - } - protected void SetSystemCriticalPriority() { setCriticalPriority = true;