/
configschema.go
311 lines (306 loc) · 12.6 KB
/
configschema.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
// Copyright 2023 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package controller
import (
"fmt"
"github.com/juju/romulus"
"github.com/juju/schema"
"gopkg.in/juju/environschema.v1"
)
var configChecker = schema.FieldMap(schema.Fields{
AgentRateLimitMax: schema.ForceInt(),
AgentRateLimitRate: schema.TimeDuration(),
AuditingEnabled: schema.Bool(),
AuditLogCaptureArgs: schema.Bool(),
AuditLogMaxSize: schema.String(),
AuditLogMaxBackups: schema.ForceInt(),
AuditLogExcludeMethods: schema.List(schema.String()),
APIPort: schema.ForceInt(),
APIPortOpenDelay: schema.TimeDuration(),
ControllerAPIPort: schema.ForceInt(),
ControllerName: schema.String(),
StatePort: schema.ForceInt(),
LoginTokenRefreshURL: schema.String(),
IdentityURL: schema.String(),
IdentityPublicKey: schema.String(),
SetNUMAControlPolicyKey: schema.Bool(),
AutocertURLKey: schema.String(),
AutocertDNSNameKey: schema.String(),
AllowModelAccessKey: schema.Bool(),
MongoMemoryProfile: schema.String(),
JujuDBSnapChannel: schema.String(),
MaxDebugLogDuration: schema.TimeDuration(),
MaxTxnLogSize: schema.String(),
MaxPruneTxnBatchSize: schema.ForceInt(),
MaxPruneTxnPasses: schema.ForceInt(),
AgentLogfileMaxBackups: schema.ForceInt(),
AgentLogfileMaxSize: schema.String(),
ModelLogfileMaxBackups: schema.ForceInt(),
ModelLogfileMaxSize: schema.String(),
ModelLogsSize: schema.String(),
PruneTxnQueryCount: schema.ForceInt(),
PruneTxnSleepTime: schema.TimeDuration(),
PublicDNSAddress: schema.String(),
JujuHASpace: schema.String(),
JujuManagementSpace: schema.String(),
CAASOperatorImagePath: schema.String(),
CAASImageRepo: schema.String(),
Features: schema.List(schema.String()),
MeteringURL: schema.String(),
MaxCharmStateSize: schema.ForceInt(),
MaxAgentStateSize: schema.ForceInt(),
MigrationMinionWaitMax: schema.TimeDuration(),
ApplicationResourceDownloadLimit: schema.ForceInt(),
ControllerResourceDownloadLimit: schema.ForceInt(),
QueryTracingEnabled: schema.Bool(),
QueryTracingThreshold: schema.TimeDuration(),
JujudControllerSnapSource: schema.String(),
}, schema.Defaults{
AgentRateLimitMax: schema.Omit,
AgentRateLimitRate: schema.Omit,
APIPort: DefaultAPIPort,
APIPortOpenDelay: DefaultAPIPortOpenDelay,
ControllerAPIPort: schema.Omit,
ControllerName: schema.Omit,
AuditingEnabled: DefaultAuditingEnabled,
AuditLogCaptureArgs: DefaultAuditLogCaptureArgs,
AuditLogMaxSize: fmt.Sprintf("%vM", DefaultAuditLogMaxSizeMB),
AuditLogMaxBackups: DefaultAuditLogMaxBackups,
AuditLogExcludeMethods: DefaultAuditLogExcludeMethods,
StatePort: DefaultStatePort,
LoginTokenRefreshURL: schema.Omit,
IdentityURL: schema.Omit,
IdentityPublicKey: schema.Omit,
SetNUMAControlPolicyKey: DefaultNUMAControlPolicy,
AutocertURLKey: schema.Omit,
AutocertDNSNameKey: schema.Omit,
AllowModelAccessKey: schema.Omit,
MongoMemoryProfile: DefaultMongoMemoryProfile,
JujuDBSnapChannel: DefaultJujuDBSnapChannel,
MaxDebugLogDuration: DefaultMaxDebugLogDuration,
MaxTxnLogSize: fmt.Sprintf("%vM", DefaultMaxTxnLogCollectionMB),
MaxPruneTxnBatchSize: DefaultMaxPruneTxnBatchSize,
MaxPruneTxnPasses: DefaultMaxPruneTxnPasses,
AgentLogfileMaxBackups: DefaultAgentLogfileMaxBackups,
AgentLogfileMaxSize: fmt.Sprintf("%vM", DefaultAgentLogfileMaxSize),
ModelLogfileMaxBackups: DefaultModelLogfileMaxBackups,
ModelLogfileMaxSize: fmt.Sprintf("%vM", DefaultModelLogfileMaxSize),
ModelLogsSize: fmt.Sprintf("%vM", DefaultModelLogsSizeMB),
PruneTxnQueryCount: DefaultPruneTxnQueryCount,
PruneTxnSleepTime: DefaultPruneTxnSleepTime,
PublicDNSAddress: schema.Omit,
JujuHASpace: schema.Omit,
JujuManagementSpace: schema.Omit,
CAASOperatorImagePath: schema.Omit,
CAASImageRepo: schema.Omit,
Features: schema.Omit,
MeteringURL: romulus.DefaultAPIRoot,
MaxCharmStateSize: DefaultMaxCharmStateSize,
MaxAgentStateSize: DefaultMaxAgentStateSize,
MigrationMinionWaitMax: DefaultMigrationMinionWaitMax,
ApplicationResourceDownloadLimit: schema.Omit,
ControllerResourceDownloadLimit: schema.Omit,
QueryTracingEnabled: DefaultQueryTracingEnabled,
QueryTracingThreshold: DefaultQueryTracingThreshold,
JujudControllerSnapSource: DefaultJujudControllerSnapSource,
})
// ConfigSchema holds information on all the fields defined by
// the config package.
var ConfigSchema = environschema.Fields{
ApplicationResourceDownloadLimit: {
Description: "The maximum number of concurrent resources downloads per application",
Type: environschema.Tint,
},
ControllerResourceDownloadLimit: {
Description: "The maximum number of concurrent resources downloads across all the applications on the controller",
Type: environschema.Tint,
},
AgentRateLimitMax: {
Description: "The maximum size of the token bucket used to ratelimit agent connections",
Type: environschema.Tint,
},
AgentRateLimitRate: {
Description: "The time taken to add a new token to the ratelimit bucket",
Type: environschema.Tstring,
},
AuditingEnabled: {
Description: "Determines if the controller records auditing information",
Type: environschema.Tbool,
},
AuditLogCaptureArgs: {
Description: `Determines if the audit log contains the arguments passed to API methods`,
Type: environschema.Tbool,
},
AuditLogMaxSize: {
Description: "The maximum size for the current controller audit log file",
Type: environschema.Tstring,
},
AuditLogMaxBackups: {
Type: environschema.Tint,
Description: "The number of old audit log files to keep (compressed)",
},
AuditLogExcludeMethods: {
Type: environschema.Tlist,
Description: "The list of Facade.Method names that aren't interesting for audit logging purposes.",
},
APIPort: {
Type: environschema.Tint,
Description: "The port used for api connections",
},
APIPortOpenDelay: {
Type: environschema.Tstring,
Description: `The duration that the controller will wait
between when the controller has been deemed to be ready to open
the api-port and when the api-port is actually opened
(only used when a controller-api-port value is set).`,
},
ControllerAPIPort: {
Type: environschema.Tint,
Description: `An optional port that may be set for controllers
that have a very heavy load. If this port is set, this port is used by
the controllers to talk to each other - used for the local API connection
as well as the pubsub forwarders, and the raft workers. If this value is
set, the api-port isn't opened until the controllers have started properly.`,
},
StatePort: {
Type: environschema.Tint,
Description: `The port used for mongo connections`,
},
LoginTokenRefreshURL: {
Type: environschema.Tstring,
Description: `The url of the jwt well known endpoint`,
},
IdentityURL: {
Type: environschema.Tstring,
Description: `The url of the identity manager`,
},
IdentityPublicKey: {
Type: environschema.Tstring,
Description: `The public key of the identity manager`,
},
SetNUMAControlPolicyKey: {
Type: environschema.Tbool,
Description: `Determines if the NUMA control policy is set`,
},
AutocertURLKey: {
Type: environschema.Tstring,
Description: `The URL used to obtain official TLS certificates when a client connects to the API`,
},
AutocertDNSNameKey: {
Type: environschema.Tstring,
Description: `The DNS name of the controller`,
},
AllowModelAccessKey: {
Type: environschema.Tbool,
Description: `Determines if the controller allows users to
connect to models they have been authorized for even when
they don't have any access rights to the controller itself`,
},
MongoMemoryProfile: {
Type: environschema.Tstring,
Description: `Sets mongo memory profile`,
},
JujuDBSnapChannel: {
Type: environschema.Tstring,
Description: `Sets channel for installing mongo snaps when bootstrapping on focal or later`,
},
MaxDebugLogDuration: {
Type: environschema.Tstring,
Description: `The maximum duration that a debug-log session is allowed to run`,
},
MaxTxnLogSize: {
Type: environschema.Tstring,
Description: `The maximum size the of capped txn log collection`,
},
MaxPruneTxnBatchSize: {
Type: environschema.Tint,
Description: `(deprecated) The maximum number of transactions evaluated in one go when pruning`,
},
MaxPruneTxnPasses: {
Type: environschema.Tint,
Description: `(deprecated) The maximum number of batches processed when pruning`,
},
AgentLogfileMaxBackups: {
Type: environschema.Tint,
Description: "The number of old agent log files to keep (compressed)",
},
AgentLogfileMaxSize: {
Type: environschema.Tstring,
Description: `The maximum size of the agent log file`,
},
ModelLogfileMaxBackups: {
Type: environschema.Tint,
Description: "The number of old model log files to keep (compressed)",
},
ModelLogfileMaxSize: {
Type: environschema.Tstring,
Description: `The maximum size of the log file written out by the controller on behalf of workers running for a model`,
},
ModelLogsSize: {
Type: environschema.Tstring,
Description: `The size of the capped collections used to hold the logs for the models`,
},
PruneTxnQueryCount: {
Type: environschema.Tint,
Description: `The number of transactions to read in a single query`,
},
PruneTxnSleepTime: {
Type: environschema.Tstring,
Description: `The amount of time to sleep between processing each batch query`,
},
PublicDNSAddress: {
Type: environschema.Tstring,
Description: `Public DNS address (with port) of the controller.`,
},
JujuHASpace: {
Type: environschema.Tstring,
Description: `The network space within which the MongoDB replica-set should communicate`,
},
JujuManagementSpace: {
Type: environschema.Tstring,
Description: `The network space that agents should use to communicate with controllers`,
},
CAASOperatorImagePath: {
Type: environschema.Tstring,
Description: `(deprecated) The url of the docker image used for the application operator.
Use "caas-image-repo" instead.`,
},
CAASImageRepo: {
Type: environschema.Tstring,
Description: `The docker repo to use for the jujud operator and mongo images`,
},
Features: {
Type: environschema.Tlist,
Description: `A list of runtime changeable features to be updated`,
},
MeteringURL: {
Type: environschema.Tstring,
Description: `The url for metrics`,
},
MaxCharmStateSize: {
Type: environschema.Tint,
Description: `The maximum size (in bytes) of charm-specific state that units can store to the controller`,
},
MaxAgentStateSize: {
Type: environschema.Tint,
Description: `The maximum size (in bytes) of internal state data that agents can store to the controller`,
},
MigrationMinionWaitMax: {
Type: environschema.Tstring,
Description: `The maximum during model migrations that the migration worker will wait for agents to report on phases of the migration`,
},
QueryTracingEnabled: {
Type: environschema.Tbool,
Description: `Enable query tracing for the dqlite driver`,
},
QueryTracingThreshold: {
Type: environschema.Tstring,
Description: `The minimum duration of a query for it to be traced. The lower the
threshold, the more queries will be output. A value of 0 means all queries
will be output if tracing is enabled.`,
},
JujudControllerSnapSource: {
Type: environschema.Tstring,
Description: `The source for the jujud-controller snap.`,
},
}