Skip to content

Commit

Permalink
Glusterfs: Return spec.pv.spec.glusterfs.readonly
Browse files Browse the repository at this point in the history
Before it only checked spec.ReadOnly, but now it checks spec.pv.spec.glusterfs.readonly
flag. This patch also correct a bug in old code where it returned mounter true
even when pv is false.

This is a follow up PR based on comment#
kubernetes#60195 (comment)

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
  • Loading branch information
humblec committed Nov 9, 2018
1 parent 8825843 commit d0fdf9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/volume/glusterfs/glusterfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func getVolumeInfo(spec *volume.Spec) (string, bool, error) {

} else if spec.PersistentVolume != nil &&
spec.PersistentVolume.Spec.Glusterfs != nil {
return spec.PersistentVolume.Spec.Glusterfs.Path, spec.ReadOnly, nil
return spec.PersistentVolume.Spec.Glusterfs.Path, spec.PersistentVolume.Spec.Glusterfs.ReadOnly, nil
}
return "", false, fmt.Errorf("Spec does not reference a Glusterfs volume type")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/volume/glusterfs/glusterfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestPluginPersistentVolume(t *testing.T) {
},
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
Glusterfs: &v1.GlusterfsPersistentVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
Glusterfs: &v1.GlusterfsPersistentVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: true},
},
},
}
Expand All @@ -181,7 +181,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
},
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
Glusterfs: &v1.GlusterfsPersistentVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
Glusterfs: &v1.GlusterfsPersistentVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: true},
},
ClaimRef: &v1.ObjectReference{
Name: "claimA",
Expand Down

0 comments on commit d0fdf9d

Please sign in to comment.