Skip to content

Commit 5e9dce9

Browse files
committed
fix debug-level propogation
Signed-off-by: Jim Lindeman <lindj@us.ibm.com>
1 parent 441950b commit 5e9dce9

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

provisioner/ibm-s3fs-provisioner.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,13 @@ func (p *IBMS3fsProvisioner) Provision(ctx context.Context, options controller.P
754754
sc.UseXattr = pvc.UseXattr
755755
}
756756

757-
if pvc.DebugLevel != "" {
757+
if pvc.DebugLevel != nil && pvc.DebugLevel != "" {
758758
sc.DebugLevel = pvc.DebugLevel
759759
}
760+
if sc.DebugLevel == "" {
761+
// Give a default of 'warn' vs. making s3fs-fuse error out with dbglevel=""
762+
sc.DebugLevel = "warn"
763+
}
760764

761765
if pvc.CurlDebug {
762766
sc.CurlDebug = pvc.CurlDebug

provisioner/ibm-s3fs-provisioner_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,15 @@ func Test_Provision_PVCAnnotations_DebugLevel(t *testing.T) {
15381538
assert.Equal(t, "info", pv.Spec.FlexVolume.Options[optionDebugLevel])
15391539
}
15401540

1541+
func Test_Provision_PVCAnnotations_Preserve_SC_DebugLevel(t *testing.T) {
1542+
p := getProvisioner()
1543+
v := getVolumeOptions()
1544+
v.StorageClass.Parameters["ibm.io/debug-level"] = "info"
1545+
pv, _, err := p.Provision(context.Background(), v)
1546+
assert.NoError(t, err)
1547+
assert.Equal(t, "info", pv.Spec.FlexVolume.Options[optionDebugLevel])
1548+
}
1549+
15411550
func Test_Provision_PVCAnnotations_CurlDebug(t *testing.T) {
15421551
p := getProvisioner()
15431552
v := getVolumeOptions()

0 commit comments

Comments
 (0)