This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathregistration_validation_provider.go
53 lines (43 loc) · 1.96 KB
/
registration_validation_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Interface for configurable values used in entity registration and validation
package runtime
import (
"context"
"github.com/lyft/flyteadmin/pkg/runtime/interfaces"
"github.com/lyft/flytestdlib/config"
"github.com/lyft/flytestdlib/logger"
)
const registration = "registration"
var registrationValidationConfig = config.MustRegisterSection(registration, &interfaces.RegistrationValidationConfig{})
// Implementation of an interfaces.TaskResourceConfiguration
type RegistrationValidationProvider struct{}
func (p *RegistrationValidationProvider) GetWorkflowNodeLimit() int {
if registrationValidationConfig != nil {
return registrationValidationConfig.GetConfig().(*interfaces.RegistrationValidationConfig).MaxWorkflowNodes
}
logger.Warning(context.Background(), "failed to find max workflow node values in config. Returning 0")
return 0
}
func (p *RegistrationValidationProvider) GetMaxLabelEntries() int {
if registrationValidationConfig != nil {
return registrationValidationConfig.GetConfig().(*interfaces.RegistrationValidationConfig).MaxLabelEntries
}
logger.Warning(context.Background(), "failed to find max label entries in config. Returning 0")
return 0
}
func (p *RegistrationValidationProvider) GetMaxAnnotationEntries() int {
if registrationValidationConfig != nil {
return registrationValidationConfig.GetConfig().(*interfaces.RegistrationValidationConfig).MaxAnnotationEntries
}
logger.Warning(context.Background(), "failed to find max annotation entries in config. Returning 0")
return 0
}
func (p *RegistrationValidationProvider) GetWorkflowSizeLimit() string {
if registrationValidationConfig != nil {
return registrationValidationConfig.GetConfig().(*interfaces.RegistrationValidationConfig).WorkflowSizeLimit
}
logger.Warning(context.Background(), "failed to findworkflow size limit in config. Returning ''")
return ""
}
func NewRegistrationValidationProvider() interfaces.RegistrationValidationConfiguration {
return &RegistrationValidationProvider{}
}