@@ -28,7 +28,6 @@ import (
28
28
"fmt"
29
29
"net"
30
30
"net/url"
31
- "strconv"
32
31
"strings"
33
32
"time"
34
33
@@ -65,10 +64,12 @@ const (
65
64
66
65
RenewBeforeKey string = "csi.cert-manager.io/renew-before"
67
66
ReusePrivateKey string = "csi.cert-manager.io/reuse-private-key"
67
+ )
68
68
69
- // fs-user is used to optionally set the UID ownership of the volume's files.
70
- // Useful when running containers with a specified user.
71
- FsUserKey string = "csi.cert-manager.io/fs-user"
69
+ var (
70
+ // fs-group is used to optionally set the GID ownership of the volume's
71
+ // files. Useful when running containers with a specified user and group.
72
+ FsGroupKey string = "csi.cert-manager.io/fs-group"
72
73
)
73
74
74
75
var (
@@ -102,6 +103,8 @@ func main() {
102
103
panic ("failed to setup filesystem: " + err .Error ())
103
104
}
104
105
106
+ store .FSGroupVolumeAttributeKey = & FsGroupKey
107
+
105
108
d , err := driver .New (* endpoint , log , driver.Options {
106
109
DriverName : "csi.cert-manager.io" ,
107
110
DriverVersion : "v0.0.1" ,
@@ -255,21 +258,11 @@ func (w *writer) writeKeypair(meta metadata.Metadata, key crypto.PrivateKey, cha
255
258
return fmt .Errorf ("calculating next issuance time: %w" , err )
256
259
}
257
260
258
- var fsUser * int64
259
- fsUserStr , ok := meta .VolumeContext [FsUserKey ]
260
- if ok {
261
- i , err := strconv .ParseInt (fsUserStr , 10 , 64 )
262
- if err != nil {
263
- return fmt .Errorf ("failed to parse %q, value must be a valid integer: %w" , FsUserKey , err )
264
- }
265
- fsUser = & i
266
- }
267
-
268
- if err := w .store .WriteFiles (meta .VolumeID , map [string ][]byte {
261
+ if err := w .store .WriteFiles (meta , map [string ][]byte {
269
262
pkFile : keyPEM ,
270
263
crtFile : chain ,
271
264
caFile : ca ,
272
- }, fsUser ); err != nil {
265
+ }); err != nil {
273
266
return fmt .Errorf ("writing data: %w" , err )
274
267
}
275
268
0 commit comments