Skip to content

Commit fbce6bd

Browse files
committed
Fix typecheck errors
1 parent b51cbb1 commit fbce6bd

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

pkg/volume/volume.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ limitations under the License.
1717
package volume
1818

1919
import (
20+
"sync/atomic"
2021
"time"
2122

2223
v1 "k8s.io/api/core/v1"
2324
"k8s.io/apimachinery/pkg/api/resource"
2425
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
"k8s.io/apimachinery/pkg/types"
2627
"k8s.io/client-go/tools/record"
28+
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
2729
)
2830

2931
// Volume represents a directory used by pods or hosts on a node. All method
@@ -134,6 +136,19 @@ type MounterArgs struct {
134136
Recorder record.EventRecorder
135137
}
136138

139+
type VolumeOwnership struct {
140+
mounter Mounter
141+
dir string
142+
fsGroup *int64
143+
fsGroupChangePolicy *v1.PodFSGroupChangePolicy
144+
completionCallback func(volumetypes.CompleteFuncParam)
145+
146+
// for monitoring progress of permission change operation
147+
pod *v1.Pod
148+
fileCounter atomic.Int64
149+
recorder record.EventRecorder
150+
}
151+
137152
// Mounter interface provides methods to set up/mount the volume.
138153
type Mounter interface {
139154
// Uses Interface to provide the path for Docker binds.

pkg/volume/volume_linux.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"context"
2424
"fmt"
2525
"path/filepath"
26-
"sync/atomic"
2726
"syscall"
2827

2928
"os"
@@ -44,19 +43,7 @@ const (
4443
progressReportDuration = 60 * time.Second
4544
)
4645

47-
type VolumeOwnership struct {
48-
mounter Mounter
49-
dir string
50-
fsGroup *int64
51-
fsGroupChangePolicy *v1.PodFSGroupChangePolicy
52-
completionCallback func(types.CompleteFuncParam)
53-
54-
// for monitoring progress of permission change operation
55-
pod *v1.Pod
56-
fileCounter atomic.Int64
57-
recorder record.EventRecorder
58-
}
59-
46+
// NewVolumeOwnership returns an interface that can be used to recursively change volume permissions and ownership
6047
func NewVolumeOwnership(mounter Mounter, dir string, fsGroup *int64, fsGroupChangePolicy *v1.PodFSGroupChangePolicy, completeFunc func(types.CompleteFuncParam)) *VolumeOwnership {
6148
vo := &VolumeOwnership{
6249
mounter: mounter,

pkg/volume/volume_unsupported.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,19 @@ package volume
2121

2222
import (
2323
v1 "k8s.io/api/core/v1"
24+
"k8s.io/client-go/tools/record"
2425
"k8s.io/kubernetes/pkg/volume/util/types"
2526
)
2627

27-
// SetVolumeOwnership sets the ownership of a volume to the specified user and group.
28-
// It typically modifies the user and group ownership of the volume's file system.
29-
func SetVolumeOwnership(mounter Mounter, dir string, fsGroup *int64, fsGroupChangePolicy *v1.PodFSGroupChangePolicy, completeFunc func(types.CompleteFuncParam)) error {
28+
// NewVolumeOwnership returns an interface that can be used to recursively change volume permissions and ownership
29+
func NewVolumeOwnership(mounter Mounter, dir string, fsGroup *int64, fsGroupChangePolicy *v1.PodFSGroupChangePolicy, completeFunc func(types.CompleteFuncParam)) *VolumeOwnership {
30+
return nil
31+
}
32+
33+
func (vo *VolumeOwnership) AddProgressNotifier(pod *v1.Pod, recorder record.EventRecorder) *VolumeOwnership {
34+
return vo
35+
}
36+
37+
func (vo *VolumeOwnership) ChangePermissions() error {
3038
return nil
3139
}

0 commit comments

Comments
 (0)