From e12bbd6f7cd3a72ccafd4faf6f7c95390a226ff5 Mon Sep 17 00:00:00 2001 From: Michael Vollman Date: Tue, 17 Sep 2019 16:05:41 -0400 Subject: [PATCH] ceph: fix encrypted osd startup Encrypted OSDs are failing because ceph-volume is unable to determine how to contact the monitors. Setting the CEPH_CONF env variable for OSD pods fixes this issue. (#3846) Signed-off-by: Michael Vollman --- pkg/operator/ceph/cluster/osd/spec.go | 6 ++++++ pkg/operator/ceph/cluster/osd/spec_test.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index 413339057..b1a300f16 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -158,6 +158,12 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo) (*apps.Dep {Name: "ROOK_OSD_UUID", Value: osd.UUID}, {Name: "ROOK_OSD_ID", Value: osdID}, {Name: "ROOK_OSD_STORE_TYPE", Value: storeType}, + {Name: "ROOK_CEPH_MON_HOST", + ValueFrom: &v1.EnvVarSource{ + SecretKeyRef: &v1.SecretKeySelector{LocalObjectReference: v1.LocalObjectReference{ + Name: "rook-ceph-config"}, + Key: "mon_host"}}}, + {Name: "CEPH_ARGS", Value: "-m $(ROOK_CEPH_MON_HOST)"}, }...) configEnvVars := append(c.getConfigEnvVars(osdProps.storeConfig, dataDir, osdProps.crushHostname, osdProps.location), []v1.EnvVar{ tiniEnvVar, diff --git a/pkg/operator/ceph/cluster/osd/spec_test.go b/pkg/operator/ceph/cluster/osd/spec_test.go index 775f36b82..f241bd3f4 100644 --- a/pkg/operator/ceph/cluster/osd/spec_test.go +++ b/pkg/operator/ceph/cluster/osd/spec_test.go @@ -233,7 +233,7 @@ func TestStorageSpecDevicesAndDirectories(t *testing.T) { assert.Equal(t, "/var/lib/rook", cont.VolumeMounts[0].MountPath) assert.Equal(t, "/etc/ceph", cont.VolumeMounts[1].MountPath) - assert.Equal(t, (7 + len(k8sutil.ClusterDaemonEnvVars(c.cephVersion.Image))), len(cont.Env)) + assert.Equal(t, (9 + len(k8sutil.ClusterDaemonEnvVars(c.cephVersion.Image))), len(cont.Env)) require.Equal(t, 2, len(podSpec.InitContainers)) initCont = podSpec.InitContainers[0]