hotfix: fix clone sync init no permission (#307)

This commit is contained in:
naison
2024-07-24 18:44:15 +08:00
committed by GitHub
parent bbf3914f1e
commit a48750c048
3 changed files with 21 additions and 7 deletions

View File

@@ -221,7 +221,7 @@ func writePIDToFile(isSudo bool) error {
func rotateLog(l *lumberjack.Logger, isSudo bool) {
sec := time.Duration(0)
if isSudo {
sec = time.Second
sec = 2 * time.Second
}
for {
nowTime := time.Now()

View File

@@ -34,6 +34,7 @@ import (
"k8s.io/kubectl/pkg/polymorphichelpers"
"k8s.io/kubectl/pkg/util/podutils"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"github.com/wencaiwulue/kubevpn/v2/pkg/config"
"github.com/wencaiwulue/kubevpn/v2/pkg/inject"
@@ -362,6 +363,16 @@ func (d *CloneOptions) DoClone(ctx context.Context, kubeconfigJsonBytes []byte)
MountPath: d.RemoteDir,
},
},
// only for:
// panic: mkdir /.kubevpn: permission denied │
// │
// goroutine 1 [running]: │
// github.com/wencaiwulue/kubevpn/v2/pkg/config.init.1() │
// /go/src/github.com/wencaiwulue/kubevpn/pkg/config/const.go:34 +0x1ae
SecurityContext: &v1.SecurityContext{
RunAsUser: ptr.To[int64](0),
RunAsGroup: ptr.To[int64](0),
},
}
spec.Spec.Containers = append(containers, *container, *containerSync)
//set spec

View File

@@ -78,12 +78,15 @@ func StartClient(ctx context.Context, localDir string, localAddr, remoteAddr str
var folder []config.FolderConfiguration
folder = append(folder, config.FolderConfiguration{
ID: dir,
Label: label,
FilesystemType: fs.FilesystemTypeBasic,
Path: localDir,
Type: config.FolderTypeSendReceive,
Paused: false,
ID: dir,
Label: label,
FilesystemType: fs.FilesystemTypeBasic,
Path: localDir,
Type: config.FolderTypeSendReceive,
Paused: false,
FSWatcherEnabled: true,
FSWatcherDelayS: 0.01,
RescanIntervalS: 2,
Devices: []config.FolderDeviceConfiguration{
{DeviceID: localID},
{DeviceID: remoteID},