Skip to content

Commit

Permalink
Validate no more than one http trigger given (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
sahare92 committed Jan 29, 2020
1 parent 8dd5794 commit a037027
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/platform/abstract/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,22 @@ func (ap *Platform) ValidateCreateFunctionOptions(createFunctionOptions *platfor
return errors.New("Project doesn't exist")
}

// Verify _trigger's MaxWorkers value is making sense
// Verify trigger's MaxWorkers value is making sense, and that there's no more than one http trigger
var httpTriggerExists bool
for triggerName, _trigger := range createFunctionOptions.FunctionConfig.Spec.Triggers {
if _trigger.MaxWorkers > trigger.MaxWorkersLimit {
return errors.Errorf("MaxWorkers value for %s trigger (%d) exceeds the limit of %d",
triggerName,
_trigger.MaxWorkers,
trigger.MaxWorkersLimit)
}
if _trigger.Kind == "http" {
if !httpTriggerExists {
httpTriggerExists = true
continue
}
return errors.New("There's more than one http trigger (unsupported)")
}
}

return nil
Expand Down

0 comments on commit a037027

Please sign in to comment.