From 3a24a778036e81fcb6ead200db235252854ad3dd Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 25 Sep 2023 09:19:29 +0200 Subject: [PATCH] Adds option for partial matches of kube node names. --- Framework/KubernetesWorkflow/KnownLocations.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Framework/KubernetesWorkflow/KnownLocations.cs b/Framework/KubernetesWorkflow/KnownLocations.cs index da4cf19..85e52af 100644 --- a/Framework/KubernetesWorkflow/KnownLocations.cs +++ b/Framework/KubernetesWorkflow/KnownLocations.cs @@ -12,7 +12,7 @@ /// /// Returns the location object for a specific kubernetes node. Throws if it doesn't exist. /// - ILocation Get(string kubeNodeName); + ILocation Get(string kubeNodeName, bool allowPartialMatches = false); } public class KnownLocations : IKnownLocations @@ -34,8 +34,13 @@ return locations[index]; } - public ILocation Get(string kubeNodeName) + public ILocation Get(string kubeNodeName, bool allowPartialMatches = false) { + if (allowPartialMatches) + { + return locations.Single(l => l.NodeLabel != null && l.NodeLabel.Value.Contains(kubeNodeName)); + } + return locations.Single(l => l.NodeLabel != null && l.NodeLabel.Value == kubeNodeName); } }