-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (41 loc) · 1.02 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"io/ioutil"
"log"
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"k8s.io/client-go/kubernetes"
"rorycrispin.co.uk/kubefs/resources"
)
var cli *kubernetes.Clientset
func main() {
mntDir, err := ioutil.TempDir("", "xoyo")
mntDir = "/tmp/kubefs"
if err != nil {
panic(fmt.Errorf("Failed to mount | %w", err))
}
// cli, err := kube.GetK8sDiscoveryClient("eng-instances")
// if err != nil {
// panic(err)
// }
// kube.GetApiResources(cli)
// _, err = kube.ListResourceNames(context.TODO(), "cert-manager.io", "v1", "certificates", "eng-instances", "eng-dev")
// if err != nil {
// panic(err)
// }
root := resources.NewRootContextNode()
server, err := fs.Mount(mntDir, root, &fs.Options{
MountOptions: fuse.MountOptions{
Debug: true,
AllowOther: false,
},
})
if err != nil {
log.Panic(err)
}
log.Printf("Mounted on %s", mntDir)
log.Printf("Unmount by calling 'fusermount -u %s'", mntDir)
// Wait until unmount before exiting
server.Wait()
}