You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// SetTmpPath sets the path used to store temporary files that are passed to kubectl code. These temporary files are usually cluster credentials or kubernetes manifests. See 'utils/io/io.go' for details.
Copy file name to clipboardExpand all lines: pkg/utils/io/io.go
+16-6
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,31 @@
1
1
package io
2
2
3
-
import (
4
-
"os"
5
-
)
3
+
import"os"
6
4
7
5
var (
8
-
// TempDir is set to '/dev/shm' if exists, otherwise is "", which defaults to os.TempDir() when passed to os.CreateTemp()
9
-
TempDirstring
6
+
// TempDir is set to '/dev/shm' if it exists, otherwise is "", which defaults to os.TempDir() when passed to os.CreateTemp()
7
+
devShmTempPathstring
10
8
)
11
9
12
10
funcinit() {
13
11
fileInfo, err:=os.Stat("/dev/shm")
14
12
iferr==nil&&fileInfo.IsDir() {
15
-
TempDir="/dev/shm"
13
+
devShmTempPath="/dev/shm"
16
14
}
17
15
}
18
16
17
+
// TempPathUseDevShmIfAvailable will return '/dev/shm' if it is available on the system, otherwise it will return "", which defaults to os.TempDir() when passed to os.CreateTemp()
18
+
//
19
+
// The result of this function is used to store temporary files that are passed to kubectl code. These temporary files are usually cluster credentials or kubernetes manifests.
20
+
//
21
+
// NOTE: There are tradeoffs to using this function: '/dev/shm' is backed by RAM, and thus has limited size.
22
+
// - Since it is backed by RAM, this has the advantage of ensuring that sensitive data (such as credentials) are kept off disk (absent disk caching of memory)
23
+
// - However, due to the limited size, '/dev/shm' may run out of disk space, and/or is more vulnerable to slow leaks of files over time.
24
+
// You may instead consider using a disk-backed storage path like "", which os.CreateTemp() will default to e.g. '/tmp'.
Copy file name to clipboardExpand all lines: pkg/utils/kube/ctl.go
+4-1
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,8 @@ type KubectlCmd struct {
45
45
Log logr.Logger
46
46
Tracer tracing.Tracer
47
47
OnKubectlRunOnKubectlRunFunc
48
+
// TmpPath is used to store temporary files that are passed to kubectl code. These temporary files are usually cluster credentials or kubernetes manifests. See 'utils/io/io.go' for details.
Copy file name to clipboardExpand all lines: pkg/utils/kube/resource_ops.go
+6-4
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,8 @@ type kubectlResourceOperations struct {
52
52
onKubectlRunOnKubectlRunFunc
53
53
fact cmdutil.Factory
54
54
openAPISchema openapi.Resources
55
+
// tmpPath is used to store temporary files that are passed to kubectl code. These temporary files are usually cluster credentials or kubernetes manifests. See 'utils/io/io.go' for details.
0 commit comments