Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph: fixing ClientID of log-collector for RGW instance #8889

Merged
merged 1 commit into from Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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))
}
30 changes: 30 additions & 0 deletions pkg/operator/ceph/object/spec_test.go
Expand Up @@ -379,3 +379,33 @@ func TestCheckRGWKMS(t *testing.T) {
assert.True(t, b)
assert.NoError(t, err)
}

func TestGetDaemonName(t *testing.T) {
parth-gr marked this conversation as resolved.
Show resolved Hide resolved
context := &clusterd.Context{Clientset: test.New(t, 3)}
store := simpleStore()
tests := []struct {
storeName string
testDaemonName string
daemonID string
}{
{"default", "ceph-client.rgw.default.a", "a"},
{"my-store", "ceph-client.rgw.my.store.b", "b"},
}
for _, tt := range tests {
t.Run(tt.storeName, func(t *testing.T) {
c := &clusterConfig{
context: context,
store: store,
}
c.store.Name = tt.storeName
daemonName := fmt.Sprintf("%s-%s", c.store.Name, tt.daemonID)
resourceName := fmt.Sprintf("%s-%s", AppName, daemonName)
rgwconfig := &rgwConfig{
ResourceName: resourceName,
DaemonID: daemonName,
}
daemon := getDaemonName(rgwconfig)
assert.Equal(t, tt.testDaemonName, daemon)
})
}
}