Skip to content

Commit c076908

Browse files
authored
Merge pull request #447 from andyzhangx/fsgrouppolicy
feat: support fsGroupPolicy for NFS
2 parents f1c761d + 2851a5a commit c076908

File tree

8 files changed

+56
-15
lines changed

8 files changed

+56
-15
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ E2E_HELM_OPTIONS ?= --set image.blob.pullPolicy=Always --set image.blob.reposito
3333
ifdef ENABLE_BLOBFUSE_PROXY
3434
override E2E_HELM_OPTIONS := $(E2E_HELM_OPTIONS) --set controller.logLevel=6 --set node.logLevel=6 --set node.enableBlobfuseProxy=true
3535
endif
36+
E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS}
3637
GINKGO_FLAGS = -ginkgo.v
3738
GO111MODULE = on
3839
GOPATH ?= $(shell go env GOPATH)
@@ -66,7 +67,7 @@ integration-test: blob
6667

6768
.PHONY: e2e-test
6869
e2e-test:
69-
if [ ! -z "$(EXTERNAL_E2E_TEST)" ]; then \
70+
if [ ! -z "$(EXTERNAL_E2E_TEST_BLOBFUSE)" ] || [ ! -z "$(EXTERNAL_E2E_TEST_NFS)" ]; then \
7071
bash ./test/external-e2e/run.sh;\
7172
else \
7273
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS};\

charts/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ From `v0.7.0`, driver name changed from `blobfuse.csi.azure.com` to `blob.csi.az
66
## Prerequisites
77
- [install Helm](https://helm.sh/docs/intro/quickstart/#install-helm)
88

9+
### Tips
10+
- `--set controller.runOnMaster=true` could make csi-azuredisk-controller only run on master node
11+
- `--set feature.enableFSGroupPolicy=true` could enable `fsGroupPolicy` on a k8s 1.20+ cluster
12+
- `--set controller.replicas=1` could set replica of csi-azuredisk-controller as `1`
13+
914
## install latest version
1015
```console
1116
helm repo add blob-csi-driver https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driver/master/charts
@@ -44,6 +49,7 @@ The following table lists the configurable parameters of the latest Azure Blob S
4449

4550
| Parameter | Description | Default |
4651
| ----------------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------- |
52+
| `feature.enableFSGroupPolicy` | enable `fsGroupPolicy` on a k8s 1.20+ cluster | `false` |
4753
| `image.blob.repository` | blob-csi-driver docker image | mcr.microsoft.com/k8s/csi/blob-csi |
4854
| `image.blob.tag` | blob-csi-driver docker image tag | latest |
4955
| `image.blob.pullPolicy` | blob-csi-driver image pull policy | IfNotPresent |
39 Bytes
Binary file not shown.

charts/latest/blob-csi-driver/templates/csi-blob-driver.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ metadata:
66
spec:
77
attachRequired: false
88
podInfoOnMount: true
9+
{{- if .Values.feature.enableFSGroupPolicy}}
10+
fsGroupPolicy: File
11+
{{- end}}
912
volumeLifecycleModes:
1013
- Persistent
1114
- Ephemeral

charts/latest/blob-csi-driver/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ node:
102102
livenessProbe:
103103
healthPort: 29633
104104

105+
feature:
106+
enableFSGroupPolicy: false
107+
105108
linux:
106109
kubelet: /var/lib/kubelet
107110
distro: debian

test/external-e2e/run.sh

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ setup_e2e_binaries() {
2828
curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.21.0/kubernetes-test-linux-amd64.tar.gz --output e2e-tests.tar.gz
2929
tar -xvf e2e-tests.tar.gz && rm e2e-tests.tar.gz
3030

31-
# install blob csi driver
31+
if [ ! -z ${EXTERNAL_E2E_TEST_NFS} ]; then
32+
# enable fsGroupPolicy (only available from k8s 1.20)
33+
export EXTRA_HELM_OPTIONS="--set feature.enableFSGroupPolicy=true"
34+
fi
35+
36+
# install csi driver
3237
make e2e-bootstrap
3338
make create-metrics-svc
3439
}
@@ -44,16 +49,20 @@ trap print_logs EXIT
4449

4550
mkdir -p /tmp/csi
4651

47-
echo "begin to run blobfuse tests ...."
48-
cp deploy/example/storageclass-blobfuse.yaml /tmp/csi/storageclass.yaml
49-
ginkgo -p --progress --v -focus='External.Storage.*blob.csi.azure.com' \
50-
-skip='\[Disruptive\]|\[Slow\]|allow exec of files on the volume|unmount after the subpath directory is deleted' kubernetes/test/bin/e2e.test -- \
51-
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver.yaml \
52-
--kubeconfig=$KUBECONFIG
53-
54-
echo "begin to run NFSv3 tests ...."
55-
cp deploy/example/storageclass-blob-nfs.yaml /tmp/csi/storageclass.yaml
56-
ginkgo -p --progress --v -focus='External.Storage.*blob.csi.azure.com' \
57-
-skip='\[Disruptive\]|\[Slow\]' kubernetes/test/bin/e2e.test -- \
58-
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver.yaml \
59-
--kubeconfig=$KUBECONFIG
52+
if [ ! -z ${EXTERNAL_E2E_TEST_BLOBFUSE} ]; then
53+
echo "begin to run blobfuse tests ...."
54+
cp deploy/example/storageclass-blobfuse.yaml /tmp/csi/storageclass.yaml
55+
ginkgo -p --progress --v -focus='External.Storage.*blob.csi.azure.com' \
56+
-skip='\[Disruptive\]|\[Slow\]|allow exec of files on the volume|unmount after the subpath directory is deleted' kubernetes/test/bin/e2e.test -- \
57+
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver-blobfuse.yaml \
58+
--kubeconfig=$KUBECONFIG
59+
fi
60+
61+
if [ ! -z ${EXTERNAL_E2E_TEST_NFS} ]; then
62+
echo "begin to run NFSv3 tests ...."
63+
cp deploy/example/storageclass-blob-nfs.yaml /tmp/csi/storageclass.yaml
64+
ginkgo -p --progress --v -focus='External.Storage.*blob.csi.azure.com' \
65+
-skip='\[Disruptive\]|\[Slow\]|pod created with an initial fsgroup, volume contents ownership changed in first pod, new pod with same fsgroup skips ownership changes to the volume contents' kubernetes/test/bin/e2e.test -- \
66+
-storage.testdriver=$PROJECT_ROOT/test/external-e2e/testdriver-nfs.yaml \
67+
--kubeconfig=$KUBECONFIG
68+
fi

test/external-e2e/testdriver-nfs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Manifest for Kubernetes external tests.
2+
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external
3+
4+
ShortName: blobfuse
5+
StorageClass:
6+
FromFile: /tmp/csi/storageclass.yaml
7+
DriverInfo:
8+
Name: blob.csi.azure.com
9+
Capabilities:
10+
persistence: true
11+
exec: true
12+
multipods: true
13+
RWX: true
14+
fsGroup: true
15+
topology: false
16+
controllerExpansion: true
17+
nodeExpansion: true
18+
volumeLimits: false
19+
snapshotDataSource: false

0 commit comments

Comments
 (0)