Skip to content

Commit

Permalink
mgr: run the watch side car config on /etc/ceph
Browse files Browse the repository at this point in the history
We don't need to use /var/lib/rook for the ceph config and keyring, so
let's use /etc/ceph which has the right permissions too. Also, we need
to run with the ceph user since the rook image defaults to the "rook"
user.

Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Dec 10, 2021
1 parent 9299e32 commit d370654
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/rook/ceph/mgr.go
Expand Up @@ -68,6 +68,7 @@ func runMgrSidecar(cmd *cobra.Command, args []string) error {
rook.SetLogLevel()

context := createContext()
context.ConfigDir = client.DefaultConfigDir
clusterInfo.Monitors = mon.ParseMonEndpoints(cfg.monEndpoints)
rook.LogStartupInfo(mgrSidecarCmd.Flags())

Expand Down
3 changes: 3 additions & 0 deletions pkg/daemon/ceph/client/config.go
Expand Up @@ -91,6 +91,9 @@ func GenerateConnectionConfig(context *clusterd.Context, cluster *ClusterInfo) (
// some subset of settings.
func GenerateConnectionConfigWithSettings(context *clusterd.Context, clusterInfo *ClusterInfo, settings *CephConfig) (string, error) {
root := path.Join(context.ConfigDir, clusterInfo.Namespace)
if context.ConfigDir == DefaultConfigDir {
root = context.ConfigDir
}
keyringPath := path.Join(root, fmt.Sprintf("%s.keyring", clusterInfo.CephCred.Username))
err := writeKeyring(CephKeyring(clusterInfo.CephCred), keyringPath)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/operator/ceph/cluster/mgr/spec.go
Expand Up @@ -227,12 +227,16 @@ func (c *Cluster) makeMgrSidecarContainer(mgrConfig *mgrConfig) v1.Container {
{Name: "ROOK_CEPH_VERSION", Value: "ceph version " + c.clusterInfo.CephVersion.String()},
}

runAsCeph := int64(167)
return v1.Container{
Args: []string{"ceph", "mgr", "watch-active"},
Name: "watch-active",
Image: c.rookVersion,
Env: envVars,
Resources: cephv1.GetMgrSidecarResources(c.spec.Resources),
SecurityContext: &v1.SecurityContext{
RunAsUser: &runAsCeph,
},
}
}

Expand Down

0 comments on commit d370654

Please sign in to comment.