Skip to content

Commit 7d97757

Browse files
authored
Merge pull request #304 from andyzhangx/mountoptions-doc
doc: add cost saving mount options
2 parents b57e29e + 83d82b9 commit 7d97757

File tree

6 files changed

+14
-104
lines changed

6 files changed

+14
-104
lines changed

deploy/example/storageclass-blobfuse-existing-container.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ parameters:
1111
server: SERVER_ADDRESS # optional, provide a new address to replace default "accountname.blob.core.windows.net"
1212
reclaimPolicy: Retain # if set as "Delete" container would be removed after pvc deletion
1313
volumeBindingMode: Immediate
14+
mountOptions:
15+
- -o allow_other
16+
- --file-cache-timeout-in-seconds=120
17+
- --use-attr-cache=true
18+
- -o attr_timeout=120
19+
- -o entry_timeout=120
20+
- -o negative_timeout=120

deploy/example/storageclass-blobfuse-mountoptions.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

deploy/example/storageclass-blobfuse.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ parameters:
88
skuName: Standard_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS
99
reclaimPolicy: Retain # if set as "Delete" container would be removed after pvc deletion
1010
volumeBindingMode: Immediate
11+
mountOptions:
12+
- -o allow_other
13+
- --file-cache-timeout-in-seconds=120
14+
- --use-attr-cache=true
15+
- -o attr_timeout=120
16+
- -o entry_timeout=120
17+
- -o negative_timeout=120

docs/driver-parameters.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
44
### Dynamic Provisioning
55
> [blobfuse example](../deploy/example/storageclass-blobfuse.yaml)
6-
7-
> [blobfuse mountOptions example](../deploy/example/storageclass-blobfuse-mountoptions.yaml)
86
97
> [nfs example](../deploy/example/storageclass-blob-nfs.yaml)
108

pkg/blob/blob.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ const (
4545
separator = "#"
4646
volumeIDTemplate = "%s#%s#%s"
4747
secretNameTemplate = "azure-storage-account-%s-secret"
48-
fileMode = "file_mode"
49-
dirMode = "dir_mode"
50-
vers = "vers"
51-
defaultFileMode = "0777"
52-
defaultDirMode = "0777"
53-
defaultVers = "3.0"
5448
serverNameField = "server"
5549
tagsField = "tags"
5650
protocolField = "protocol"
@@ -178,45 +172,6 @@ func GetContainerInfo(id string) (string, string, string, error) {
178172
return segments[0], segments[1], segments[2], nil
179173
}
180174

181-
// check whether mountOptions contains file_mode, dir_mode, vers, if not, append default mode
182-
func appendDefaultMountOptions(mountOptions []string) []string {
183-
fileModeFlag := false
184-
dirModeFlag := false
185-
versFlag := false
186-
187-
for _, mountOption := range mountOptions {
188-
if strings.HasPrefix(mountOption, fileMode) {
189-
fileModeFlag = true
190-
}
191-
if strings.HasPrefix(mountOption, dirMode) {
192-
dirModeFlag = true
193-
}
194-
if strings.HasPrefix(mountOption, vers) {
195-
versFlag = true
196-
}
197-
}
198-
199-
allMountOptions := mountOptions
200-
if !fileModeFlag {
201-
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%s", fileMode, defaultFileMode))
202-
}
203-
204-
if !dirModeFlag {
205-
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%s", dirMode, defaultDirMode))
206-
}
207-
208-
if !versFlag {
209-
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%s", vers, defaultVers))
210-
}
211-
212-
/* todo: looks like fsGroup is not included in CSI
213-
if !gidFlag && fsGroup != nil {
214-
allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%d", gid, *fsGroup))
215-
}
216-
*/
217-
return allMountOptions
218-
}
219-
220175
// A container name must be a valid DNS name, conforming to the following naming rules:
221176
// 1. Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
222177
// 2. Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names.

pkg/blob/blob_test.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -137,50 +137,6 @@ func TestRun(t *testing.T) {
137137
}
138138
}
139139

140-
func TestAppendDefaultMountOptions(t *testing.T) {
141-
tests := []struct {
142-
options []string
143-
expected []string
144-
}{
145-
{
146-
options: []string{"dir_mode=0777"},
147-
expected: []string{"dir_mode=0777",
148-
fmt.Sprintf("%s=%s", fileMode, defaultFileMode),
149-
fmt.Sprintf("%s=%s", vers, defaultVers)},
150-
},
151-
{
152-
options: []string{"file_mode=0777"},
153-
expected: []string{"file_mode=0777",
154-
fmt.Sprintf("%s=%s", dirMode, defaultDirMode),
155-
fmt.Sprintf("%s=%s", vers, defaultVers)},
156-
},
157-
{
158-
options: []string{"vers=2.1"},
159-
expected: []string{"vers=2.1",
160-
fmt.Sprintf("%s=%s", fileMode, defaultFileMode),
161-
fmt.Sprintf("%s=%s", dirMode, defaultDirMode)},
162-
},
163-
{
164-
options: []string{""},
165-
expected: []string{"", fmt.Sprintf("%s=%s",
166-
fileMode, defaultFileMode),
167-
fmt.Sprintf("%s=%s", dirMode, defaultDirMode),
168-
fmt.Sprintf("%s=%s", vers, defaultVers)},
169-
},
170-
{
171-
options: []string{"file_mode=0777", "dir_mode=0777"},
172-
expected: []string{"file_mode=0777", "dir_mode=0777", fmt.Sprintf("%s=%s", vers, defaultVers)},
173-
},
174-
}
175-
176-
for _, test := range tests {
177-
result := appendDefaultMountOptions(test.options)
178-
if !reflect.DeepEqual(result, test.expected) {
179-
t.Errorf("input: %q, appendDefaultMountOptions result: %q, expected: %q", test.options, result, test.expected)
180-
}
181-
}
182-
}
183-
184140
func TestGetContainerInfo(t *testing.T) {
185141
tests := []struct {
186142
options string

0 commit comments

Comments
 (0)