@@ -207,7 +207,7 @@ func BuildMongoDBReplicaSetStatefulSetModificationFunction(mdb MongoDBStatefulSe
207
207
208
208
agentLogLevel := mdbv1 .LogLevelInfo
209
209
if mdb .GetAgentLogLevel () != "" {
210
- agentLogLevel = string ( mdb .GetAgentLogLevel () )
210
+ agentLogLevel = mdb .GetAgentLogLevel ()
211
211
}
212
212
213
213
agentLogFile := automationconfig .DefaultAgentLogFile
@@ -256,17 +256,17 @@ func BaseAgentCommand() string {
256
256
257
257
// AutomationAgentCommand withAgentAPIKeyExport detects whether we want to deploy this agent with the agent api key exported
258
258
// it can be used to register the agent with OM.
259
- func AutomationAgentCommand (withAgentAPIKeyExport bool , logLevel string , logFile string , maxLogFileDurationHours int ) []string {
259
+ func AutomationAgentCommand (withAgentAPIKeyExport bool , logLevel mdbv1. LogLevel , logFile string , maxLogFileDurationHours int ) []string {
260
260
// This is somewhat undocumented at https://www.mongodb.com/docs/ops-manager/current/reference/mongodb-agent-settings/
261
261
// Not setting the -logFile option make the mongodb-agent log to stdout. Setting -logFile /dev/stdout will result in
262
262
// an error by the agent trying to open /dev/stdout-verbose and still trying to do log rotation.
263
263
// To keep consistent with old behavior not setting the logFile in the config does not log to stdout but keeps
264
264
// the default logFile as defined by DefaultAgentLogFile. Setting the logFile explictly to "/dev/stdout" will log to stdout.
265
265
agentLogOptions := ""
266
266
if logFile == "/dev/stdout" {
267
- agentLogOptions += " -logLevel " + logLevel
267
+ agentLogOptions += " -logLevel " + string ( logLevel )
268
268
} else {
269
- agentLogOptions += " -logFile " + logFile + " -logLevel " + logLevel + " -maxLogFileDurationHrs " + strconv .Itoa (maxLogFileDurationHours )
269
+ agentLogOptions += " -logFile " + logFile + " -logLevel " + string ( logLevel ) + " -maxLogFileDurationHrs " + strconv .Itoa (maxLogFileDurationHours )
270
270
}
271
271
272
272
if withAgentAPIKeyExport {
@@ -275,7 +275,7 @@ func AutomationAgentCommand(withAgentAPIKeyExport bool, logLevel string, logFile
275
275
return []string {"/bin/bash" , "-c" , MongodbUserCommand + BaseAgentCommand () + " -cluster=" + clusterFilePath + automationAgentOptions + agentLogOptions }
276
276
}
277
277
278
- func mongodbAgentContainer (automationConfigSecretName string , volumeMounts []corev1.VolumeMount , logLevel string , logFile string , maxLogFileDurationHours int , agentImage string ) container.Modification {
278
+ func mongodbAgentContainer (automationConfigSecretName string , volumeMounts []corev1.VolumeMount , logLevel mdbv1. LogLevel , logFile string , maxLogFileDurationHours int , agentImage string ) container.Modification {
279
279
_ , containerSecurityContext := podtemplatespec .WithDefaultSecurityContextsModifications ()
280
280
return container .Apply (
281
281
container .WithName (AgentName ),
@@ -284,7 +284,7 @@ func mongodbAgentContainer(automationConfigSecretName string, volumeMounts []cor
284
284
container .WithReadinessProbe (DefaultReadiness ()),
285
285
container .WithResourceRequirements (resourcerequirements .Defaults ()),
286
286
container .WithVolumeMounts (volumeMounts ),
287
- container .WithCommand (AutomationAgentCommand (false , logFile , logLevel , maxLogFileDurationHours )),
287
+ container .WithCommand (AutomationAgentCommand (false , logLevel , logFile , maxLogFileDurationHours )),
288
288
containerSecurityContext ,
289
289
container .WithEnvs (
290
290
corev1.EnvVar {
0 commit comments