Skip to content

Commit

Permalink
ceph: fixing ClientID of log-collector for RGW instance
Browse files Browse the repository at this point in the history
The Client_ID generated by operator was
different from the log rotate file created
The Clinet_ID= rgwceph.client.rook.ceph.rgw.my.store.a
and log file name= ceph-client.rgw.my.store.a.log
So changed the CLient_ID to ceph-client.rgw.my.store.a for
correct working and this follow the patterns how other modules
Client_ID is generated

Closes: #8692
Signed-off-by: parth-gr <paarora@redhat.com>
  • Loading branch information
parth-gr committed Oct 4, 2021
1 parent 08cb678 commit aa07551
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/operator/ceph/object/spec.go
Expand Up @@ -111,7 +111,7 @@ func (c *clusterConfig) makeRGWPodSpec(rgwConfig *rgwConfig) (v1.PodTemplateSpec
if c.clusterSpec.LogCollector.Enabled {
shareProcessNamespace := true
podSpec.ShareProcessNamespace = &shareProcessNamespace
podSpec.Containers = append(podSpec.Containers, *controller.LogCollectorContainer(strings.TrimPrefix(generateCephXUser(fmt.Sprintf("ceph-client.%s", rgwConfig.ResourceName)), "client."), c.clusterInfo.Namespace, *c.clusterSpec))
podSpec.Containers = append(podSpec.Containers, *controller.LogCollectorContainer(getDaemonName(rgwConfig), c.clusterInfo.Namespace, *c.clusterSpec))
}

// Replace default unreachable node toleration
Expand Down Expand Up @@ -611,3 +611,7 @@ func (c *clusterConfig) rgwTLSSecretType(secretName string) (v1.SecretType, erro
}
return "", errors.Wrapf(err, "no Kubernetes secrets referring TLS certificates found")
}

func getDaemonName(rgwConfig *rgwConfig) string {
return fmt.Sprintf("ceph-%s", generateCephXUser(rgwConfig.ResourceName))
}
27 changes: 27 additions & 0 deletions pkg/operator/ceph/object/spec_test.go
Expand Up @@ -379,3 +379,30 @@ func TestCheckRGWKMS(t *testing.T) {
assert.True(t, b)
assert.NoError(t, err)
}

func TestGetDaemonName(t *testing.T) {
context := &clusterd.Context{Clientset: test.New(t, 3)}
store := simpleStore()
c := &clusterConfig{
context: context,
store: store,
}
daemonName := fmt.Sprintf("%s-%s", c.store.Name, "a")
resourceName := fmt.Sprintf("%s-%s", AppName, daemonName)
rgwconfig := &rgwConfig{
ResourceName: resourceName,
DaemonID: daemonName,
}
daemon := getDaemonName(rgwconfig)
assert.Equal(t, "ceph-client.rgw.default.a", daemon)

c.store.Name = "my-store" // updating store name
daemonName = fmt.Sprintf("%s-%s", c.store.Name, "b")
resourceName = fmt.Sprintf("%s-%s", AppName, daemonName)
rgwconfig = &rgwConfig{
ResourceName: resourceName,
DaemonID: daemonName,
}
daemon = getDaemonName(rgwconfig)
assert.Equal(t, "ceph-client.rgw.my.store.b", daemon)
}

0 comments on commit aa07551

Please sign in to comment.