From 62f25ad33fe416a6a31d687e7f44603568c4f2a8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 Nov 2024 02:14:54 -0500 Subject: [PATCH] feat: give the trigger a default name if none is specified --- plugins/scheduler-k3s/functions.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/scheduler-k3s/functions.go b/plugins/scheduler-k3s/functions.go index 4913c8a3b..9c6c34b0c 100644 --- a/plugins/scheduler-k3s/functions.go +++ b/plugins/scheduler-k3s/functions.go @@ -585,7 +585,7 @@ func getAutoscaling(input GetAutoscalingInput) (ProcessAutoscaling, error) { } triggers := []ProcessAutoscalingTrigger{} - for _, trigger := range config.Triggers { + for idx, trigger := range config.Triggers { if trigger.Type == "" { return ProcessAutoscaling{}, fmt.Errorf("Autoscaling trigger type is required for trigger: index %d", idx) } @@ -603,7 +603,9 @@ func getAutoscaling(input GetAutoscalingInput) (ProcessAutoscaling, error) { metadata[key] = output.String() } - trigger := ProcessAutoscalingTrigger{ + if trigger.Name == "" { + trigger.Name = fmt.Sprintf("trigger-%s-%d", trigger.Type, idx+1) + } Name: trigger.Name, Type: trigger.Type, Metadata: metadata,