From 3499bd15c987f8da7da1f00501b9f6a7485fd6dc Mon Sep 17 00:00:00 2001 From: "w.montaz" Date: Mon, 23 Sep 2024 14:43:13 +0200 Subject: [PATCH] [CRITEO] Change NODE_NAME to node IP for RGW pod definition Required for the dahsbaord to correctly access RGW after update to Ceph Quincy. --- pkg/operator/ceph/object/spec.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/object/spec.go b/pkg/operator/ceph/object/spec.go index 95e3f81ea896..d3184444145e 100644 --- a/pkg/operator/ceph/object/spec.go +++ b/pkg/operator/ceph/object/spec.go @@ -337,6 +337,28 @@ func (c *clusterConfig) makeDaemonContainer(rgwConfig *rgwConfig) (v1.Container, return v1.Container{}, errors.Wrap(err, "failed to generate default readiness probe") } + // The following replaces NODE_NAME with the IP of the host + // The reason for that is that the mgr dashboard uses metadata 'hostname' for the rgw + // as listed in `ceph service dump`. When it is not an IP, the hostnames has to be defined + // in the zonegroup allowed hostnames. Which is not possible for kub hostnames. + // This information is directly put by the RGW at registration to the mgr + // (see ceph src/common/utils.cc collect_sys_info), and is derived from NODE_NAME env variable + envVars := controller.DaemonEnvVars(c.clusterSpec) + updatedEnvVars := []v1.EnvVar{} + + for _, envVar := range envVars { + if envVar.Name != "NODE_NAME" { + updatedEnvVars = append(updatedEnvVars, envVar) + } + } + + nodeNameAsIP := v1.EnvVar{ + Name: "NODE_NAME", + ValueFrom: &v1.EnvVarSource{FieldRef: &v1.ObjectFieldSelector{FieldPath: "status.hostIP"}}, + } + + updatedEnvVars = append(updatedEnvVars, nodeNameAsIP) + container := v1.Container{ Name: "rgw", Image: c.clusterSpec.CephVersion.Image, @@ -359,7 +381,7 @@ func (c *clusterConfig) makeDaemonContainer(rgwConfig *rgwConfig) (v1.Container, controller.DaemonVolumeMounts(c.DataPathMap, rgwConfig.ResourceName, c.clusterSpec.DataDirHostPath), c.mimeTypesVolumeMount(), ), - Env: controller.DaemonEnvVars(c.clusterSpec), + Env: updatedEnvVars, Resources: c.store.Spec.Gateway.Resources, StartupProbe: startupProbe, LivenessProbe: noLivenessProbe(),