Skip to content

Commit 16b2aa7

Browse files
refactor: add storageClass parameters for kerberos auth
1 parent ab4a863 commit 16b2aa7

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

pkg/nfs/controllerserver.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
140140
case pvcNamespaceKey:
141141
case pvcNameKey:
142142
case pvNameKey:
143+
case paramKrbPrincipal:
144+
case paramKrbPasswordSecret:
143145
// no op
144146
case mountPermissionsField:
145147
if v != "" {

pkg/nfs/nfs.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,21 @@ const (
7373
// The base directory must be a direct child of the root directory.
7474
// The root directory is omitted from the string, for example:
7575
// "base" instead of "/base"
76-
paramShare = "share"
77-
paramSubDir = "subdir"
78-
paramOnDelete = "ondelete"
79-
mountOptionsField = "mountoptions"
80-
mountPermissionsField = "mountpermissions"
81-
pvcNameKey = "csi.storage.k8s.io/pvc/name"
82-
pvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
83-
pvNameKey = "csi.storage.k8s.io/pv/name"
84-
pvcNameMetadata = "${pvc.metadata.name}"
85-
pvcNamespaceMetadata = "${pvc.metadata.namespace}"
86-
pvNameMetadata = "${pv.metadata.name}"
76+
paramShare = "share"
77+
paramSubDir = "subdir"
78+
// Kerberos principal to use when mounting with `-o sec=krb5*`
79+
paramKrbPrincipal = "authprincipal"
80+
// name of a secret containing the Kerberos password to use when authenticating
81+
paramKrbPasswordSecret = "authpasswordsecret"
82+
paramOnDelete = "ondelete"
83+
mountOptionsField = "mountoptions"
84+
mountPermissionsField = "mountpermissions"
85+
pvcNameKey = "csi.storage.k8s.io/pvc/name"
86+
pvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
87+
pvNameKey = "csi.storage.k8s.io/pv/name"
88+
pvcNameMetadata = "${pvc.metadata.name}"
89+
pvcNamespaceMetadata = "${pvc.metadata.namespace}"
90+
pvNameMetadata = "${pv.metadata.name}"
8791
)
8892

8993
func NewDriver(options *DriverOptions) *Driver {

pkg/nfs/nodeserver.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func (ns *NodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishV
6868
}
6969

7070
var server, baseDir, subDir string
71+
var krbPwd, krbPrinc string
7172
subDirReplaceMap := map[string]string{}
7273

7374
mountPermissions := ns.Driver.mountPermissions
@@ -79,6 +80,12 @@ func (ns *NodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishV
7980
baseDir = v
8081
case paramSubDir:
8182
subDir = v
83+
case paramKrbPrincipal:
84+
krbPrinc = v
85+
case paramKrbPasswordSecret:
86+
if v != "" {
87+
krbPwd = req.GetSecrets()[v]
88+
}
8289
case pvcNamespaceKey:
8390
subDirReplaceMap[pvcNamespaceMetadata] = v
8491
case pvcNameKey:

0 commit comments

Comments
 (0)