Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit 9309166

Browse files
authored
Read agent API Key on startup (#781)
1 parent cd411b9 commit 9309166

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

controllers/construct/mongodbstatefulset.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package construct
22

33
import (
44
"fmt"
5-
"github.com/stretchr/objx"
65
"os"
76
"strings"
87

8+
"github.com/stretchr/objx"
9+
910
"github.com/mongodb/mongodb-kubernetes-operator/pkg/automationconfig"
1011
"github.com/mongodb/mongodb-kubernetes-operator/pkg/kube/container"
1112
"github.com/mongodb/mongodb-kubernetes-operator/pkg/kube/persistentvolumeclaim"
@@ -51,6 +52,7 @@ const (
5152
automationAgentOptions = " -skipMongoStart -noDaemonize -useLocalMongoDbTools"
5253

5354
MongodbUserCommand = `current_uid=$(id -u)
55+
AGENT_API_KEY="$(cat /mongodb-automation/agent-api-key/agentApiKey)"
5456
declare -r current_uid
5557
if ! grep -q "${current_uid}" /etc/passwd ; then
5658
sed -e "s/^mongodb:/builder:/" /etc/passwd > /tmp/passwd

0 commit comments

Comments
 (0)