@@ -21,11 +21,15 @@ import (
21
21
"time"
22
22
)
23
23
24
+ type OperatorConfig struct {
25
+ AppWrapper * AppWrapperConfig `json:"appWrapper,omitempty"`
26
+ CertManagement * CertManagementConfig `json:"certManagement,omitempty"`
27
+ }
28
+
24
29
type AppWrapperConfig struct {
25
- ManageJobsWithoutQueueName bool `json:"manageJobsWithoutQueueName,omitempty"`
26
- StandaloneMode bool `json:"standaloneMode,omitempty"`
27
- FaultTolerance FaultToleranceConfig `json:"faultTolerance,omitempty"`
28
- CertManagement CertManagementConfig `json:"certManagement,omitempty"`
30
+ ManageJobsWithoutQueueName bool `json:"manageJobsWithoutQueueName,omitempty"`
31
+ StandaloneMode bool `json:"standaloneMode,omitempty"`
32
+ FaultTolerance * FaultToleranceConfig `json:"faultTolerance,omitempty"`
29
33
}
30
34
31
35
type FaultToleranceConfig struct {
@@ -48,33 +52,23 @@ type CertManagementConfig struct {
48
52
WebhookSecretName string `json:"webhookSecretName,omitempty"`
49
53
}
50
54
51
- // NewConfig constructs an AppWrapperConfig and fills in default values
52
- func NewConfig ( namespace string ) * AppWrapperConfig {
55
+ // NewAppWrapperConfig constructs an AppWrapperConfig and fills in default values
56
+ func NewAppWrapperConfig ( ) * AppWrapperConfig {
53
57
return & AppWrapperConfig {
54
58
ManageJobsWithoutQueueName : true ,
55
59
StandaloneMode : false ,
56
- FaultTolerance : FaultToleranceConfig {
60
+ FaultTolerance : & FaultToleranceConfig {
57
61
WarmupGracePeriod : 5 * time .Minute ,
58
62
FailureGracePeriod : 1 * time .Minute ,
59
63
ResetPause : 90 * time .Second ,
60
64
RetryLimit : 3 ,
61
65
DeletionGracePeriod : 10 * time .Minute ,
62
66
GracePeriodCeiling : 24 * time .Hour ,
63
67
},
64
- CertManagement : CertManagementConfig {
65
- Namespace : namespace ,
66
- CertificateDir : "/tmp/k8s-webhook-server/serving-certs" ,
67
- CertificateName : "appwrapper-ca" ,
68
- CertificateOrg : "appwrapper" ,
69
- MutatingWebhookConfigName : "appwrapper-mutating-webhook-configuration" ,
70
- ValidatingWebhookConfigName : "appwrapper-validating-webhook-configuration" ,
71
- WebhookServiceName : "appwrapper-webhook-service" ,
72
- WebhookSecretName : "appwrapper-webhook-server-cert" ,
73
- },
74
68
}
75
69
}
76
70
77
- func ValidateConfig (config * AppWrapperConfig ) error {
71
+ func ValidateAppWrapperConfig (config * AppWrapperConfig ) error {
78
72
if config .FaultTolerance .DeletionGracePeriod > config .FaultTolerance .GracePeriodCeiling {
79
73
return fmt .Errorf ("DelectionGracePeriod %v exceeds GracePeriodCeiling %v" ,
80
74
config .FaultTolerance .DeletionGracePeriod , config .FaultTolerance .GracePeriodCeiling )
@@ -94,3 +88,17 @@ func ValidateConfig(config *AppWrapperConfig) error {
94
88
95
89
return nil
96
90
}
91
+
92
+ // NewCertManagermentConfig constructs a CertManagementConfig and fills in default values
93
+ func NewCertManagementConfig (namespace string ) * CertManagementConfig {
94
+ return & CertManagementConfig {
95
+ Namespace : namespace ,
96
+ CertificateDir : "/tmp/k8s-webhook-server/serving-certs" ,
97
+ CertificateName : "appwrapper-ca" ,
98
+ CertificateOrg : "appwrapper" ,
99
+ MutatingWebhookConfigName : "appwrapper-mutating-webhook-configuration" ,
100
+ ValidatingWebhookConfigName : "appwrapper-validating-webhook-configuration" ,
101
+ WebhookServiceName : "appwrapper-webhook-service" ,
102
+ WebhookSecretName : "appwrapper-webhook-server-cert" ,
103
+ }
104
+ }
0 commit comments