From 8fd795536ff0275f9bbf607ad7c7f9210c1a7eed Mon Sep 17 00:00:00 2001
From: nam <nam.nguyen@mongodb.com>
Date: Tue, 7 May 2024 18:10:03 +0200
Subject: [PATCH] default to stdout in readinessProbe, wip configuration for it

---
 api/v1/mongodbcommunity_types.go | 8 ++++++++
 pkg/readiness/config/config.go   | 2 +-
 release.json                     | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/api/v1/mongodbcommunity_types.go b/api/v1/mongodbcommunity_types.go
index 0f7128713..b5c7701bb 100644
--- a/api/v1/mongodbcommunity_types.go
+++ b/api/v1/mongodbcommunity_types.go
@@ -104,6 +104,9 @@ type MongoDBCommunitySpec struct {
 	// AgentConfiguration sets options for the MongoDB automation agent
 	// +optional
 	AgentConfiguration AgentConfiguration `json:"agent,omitempty"`
+	// AgentConfiguration sets options for the MongoDB readiness probe
+	// +optional
+	ReadinessProbeConfiguration ReadinessProbeConfiguration `json:"readiness,omitempty"`
 
 	// AdditionalMongodConfig is additional configuration that can be passed to
 	// each data-bearing mongod at runtime. Uses the same structure as the mongod
@@ -377,6 +380,11 @@ type AgentConfiguration struct {
 	SystemLog *automationconfig.SystemLog `json:"systemLog,omitempty"`
 }
 
+type ReadinessProbeConfiguration struct {
+	// +optional
+	LogFile string `json:"logFile"` // if this is set, we should set LOG_FILE_PATH for the readinessProbe env var
+}
+
 // StatefulSetSpecWrapper is a wrapper around StatefulSetSpec with a custom implementation
 // of MarshalJSON and UnmarshalJSON which delegate to the underlying Spec to avoid CRD pollution.
 
diff --git a/pkg/readiness/config/config.go b/pkg/readiness/config/config.go
index d520faf7e..0e267910e 100644
--- a/pkg/readiness/config/config.go
+++ b/pkg/readiness/config/config.go
@@ -16,7 +16,7 @@ const (
 	DefaultAgentHealthStatusFilePath = "/var/log/mongodb-mms-automation/agent-health-status.json"
 	AgentHealthStatusFilePathEnv     = "AGENT_STATUS_FILEPATH"
 
-	defaultLogPath              = "/var/log/mongodb-mms-automation/readiness.log"
+	defaultLogPath              = "/dev/stdout"
 	podNamespaceEnv             = "POD_NAMESPACE"
 	automationConfigSecretEnv   = "AUTOMATION_CONFIG_MAP" //nolint
 	logPathEnv                  = "LOG_FILE_PATH"
diff --git a/release.json b/release.json
index 217d7c1e3..dfe0eeb3b 100644
--- a/release.json
+++ b/release.json
@@ -2,7 +2,7 @@
   "golang-builder-image": "golang:1.21",
   "operator": "0.9.0",
   "version-upgrade-hook": "1.0.8",
-  "readiness-probe": "1.0.18",
+  "readiness-probe": "1.0.19",
   "agent": "107.0.1.8507-1",
   "agent-tools-version": "100.9.4"
 }
\ No newline at end of file