Skip to content

Commit 0eb9214

Browse files
authored
Merge pull request #519 from Rakshith-R/worktree-audience-flag
Add --audience flag to snapshot-metadata sidecar container
2 parents 5dd6fb6 + 8ff95c4 commit 0eb9214

4 files changed

Lines changed: 55 additions & 1 deletion

File tree

docs/features/rbd-snapshot-metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Users need to perform the following manual setup:
124124

125125
> **Note:**
126126
> - `address`: Should point to the service created in step 2, replace `<service-name>`, `<driver-namespace>`, and `<service-port>` with your actual values from step 2
127-
> - `audience`: Recommended to use the CSI driver name for consistency
127+
> - `audience`: Must be set to your RBD driver name (e.g., `rbd.csi.ceph.com`) as configured in the Driver CR name (step 5)
128128
> - `caCert`: Base64-encoded CA certificate bundle
129129

130130
## Ceph-CSI Operator Responsibilities

internal/controller/driver_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ func (r *driverReconcile) reconcileControllerPluginDeployment() error {
975975
utils.CsiAddressContainerArg,
976976
utils.SnapshotMetadataTlsCertArg,
977977
utils.SnapshotMetadataTlsKeyArg,
978+
utils.SnapshotMetadataAudienceArg(r.driver.Name),
978979
},
979980
),
980981
Ports: []corev1.ContainerPort{

internal/utils/csi.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ var SnapshotMetadataGrpcServicePortArg = fmt.Sprintf("--port=%d", SnapshotMetada
409409
var SnapshotMetadataTlsCertArg = "--tls-cert=/tmp/certificates/tls.crt"
410410
var SnapshotMetadataTlsKeyArg = "--tls-key=/tmp/certificates/tls.key"
411411

412+
func SnapshotMetadataAudienceArg(driverName string) string {
413+
return fmt.Sprintf("--audience=%s", driverName)
414+
}
415+
412416
func LogVerbosityContainerArg(level int) string {
413417
return fmt.Sprintf("--v=%d", Clamp(level, 0, 5))
414418
}

internal/utils/csi_test.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2026.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package utils
18+
19+
import (
20+
"testing"
21+
22+
"github.com/stretchr/testify/assert"
23+
)
24+
25+
func TestSnapshotMetadataAudienceArg(t *testing.T) {
26+
tests := []struct {
27+
name string
28+
driverName string
29+
expected string
30+
}{
31+
{
32+
name: "rbd driver",
33+
driverName: "rbd.csi.ceph.com",
34+
expected: "--audience=rbd.csi.ceph.com",
35+
},
36+
{
37+
name: "prefixed rbd driver",
38+
driverName: "myprefix.rbd.csi.ceph.com",
39+
expected: "--audience=myprefix.rbd.csi.ceph.com",
40+
},
41+
}
42+
43+
for _, tt := range tests {
44+
t.Run(tt.name, func(t *testing.T) {
45+
result := SnapshotMetadataAudienceArg(tt.driverName)
46+
assert.Equal(t, tt.expected, result)
47+
})
48+
}
49+
}

0 commit comments

Comments
 (0)