This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
/
config.go
50 lines (41 loc) · 1.54 KB
/
config.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
/*
* Copyright (c) 2018 Lyft. All rights reserved.
*/
package k8s
import (
v1 "k8s.io/api/core/v1"
"github.com/lyft/flyteplugins/go/tasks/pluginmachinery/workqueue"
"github.com/lyft/flytestdlib/config"
)
//go:generate pflags Config --default-var=defaultConfig
const configSectionKey = "k8s-array"
var (
defaultConfig = &Config{
MaxErrorStringLength: 1000,
MaxArrayJobSize: 5000,
OutputAssembler: workqueue.Config{
IndexCacheMaxItems: 100000,
MaxRetries: 5,
Workers: 10,
},
ErrorAssembler: workqueue.Config{
IndexCacheMaxItems: 100000,
MaxRetries: 5,
Workers: 10,
},
}
configSection = config.MustRegisterSection(configSectionKey, defaultConfig)
)
// Defines custom config for K8s Array plugin
type Config struct {
DefaultScheduler string `json:"scheduler" pflag:",Decides the scheduler to use when launching array-pods."`
MaxErrorStringLength int `json:"maxErrLength" pflag:",Determines the maximum length of the error string returned for the array."`
MaxArrayJobSize int64 `json:"maxArrayJobSize" pflag:",Maximum size of array job."`
NodeSelector map[string]string `json:"node-selector" pflag:"-,Defines a set of node selector labels to add to the pod."`
Tolerations []v1.Toleration `json:"tolerations" pflag:"-,Tolerations to be applied for k8s-array pods"`
OutputAssembler workqueue.Config
ErrorAssembler workqueue.Config
}
func GetConfig() *Config {
return configSection.GetConfig().(*Config)
}