trigger type from annotations

feature/policy_from_annotations
Karolis Rusenas 2018-11-07 23:16:57 +00:00
parent e4027db612
commit 60988005cc
1 changed files with 9 additions and 1 deletions

View File

@ -6,10 +6,18 @@ import (
// GetTriggerPolicy - checks for trigger label, if not set - returns
// default trigger type
func GetTriggerPolicy(labels map[string]string) types.TriggerType {
func GetTriggerPolicy(labels map[string]string, annotations map[string]string) types.TriggerType {
triggerAnn, ok := annotations[types.KeelTriggerLabel]
if ok {
return types.ParseTrigger(triggerAnn)
}
// checking labels
trigger, ok := labels[types.KeelTriggerLabel]
if ok {
return types.ParseTrigger(trigger)
}
return types.TriggerTypeDefault
}