Skip to content

Commit 9996580

Browse files
authored
Reimplemented DirectPV API in operator console (#2207)
- Updated API to use latest directpv library Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 7036d13 commit 9996580

30 files changed

+4193
-91
lines changed

.golangci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ linters-settings:
44

55
misspell:
66
locale: US
7-
7+
88
goheader:
99
values:
1010
regexp:
@@ -40,15 +40,15 @@ service:
4040
issues:
4141
exclude-use-default: false
4242
exclude:
43-
- should have a package comment
44-
# TODO(y4m4): Remove once all exported ident. have comments!
45-
- comment on exported function
46-
- comment on exported type
47-
- should have comment
48-
- use leading k in Go names
49-
- comment on exported const
43+
- should have a package comment
44+
# TODO(y4m4): Remove once all exported ident. have comments!
45+
- comment on exported function
46+
- comment on exported type
47+
- should have comment
48+
- use leading k in Go names
49+
- comment on exported const
5050
run:
5151
skip-dirs:
5252
- pkg/clientgen
5353
- pkg/apis/networking.gke.io
54-
- restapi/operations
54+
- restapi/operations

cluster/cluster.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package cluster
1818

1919
import (
20+
directpvclient "github.com/minio/directpv/pkg/client"
2021
operator "github.com/minio/operator/pkg/client/clientset/versioned"
2122
"k8s.io/client-go/kubernetes"
2223
"k8s.io/client-go/rest"
@@ -63,3 +64,13 @@ func OperatorClient(token string) (*operator.Clientset, error) {
6364
func K8sClient(token string) (*kubernetes.Clientset, error) {
6465
return kubernetes.NewForConfig(GetK8sConfig(token))
6566
}
67+
68+
// DirectPV interfaces required to fetch information
69+
70+
func DirectPVDriveInterface(token string) (*directpvclient.DirectCSIDriveInterface, error) {
71+
return directpvclient.DirectCSIDriveInterfaceForConfig(GetK8sConfig(token))
72+
}
73+
74+
func DirectPVVolumeInterface(token string) (*directpvclient.DirectCSIVolumeInterface, error) {
75+
return directpvclient.DirectCSIVolumeInterfaceForConfig(GetK8sConfig(token))
76+
}

go.mod

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ require (
2020
github.com/jessevdk/go-flags v1.5.0
2121
github.com/klauspost/compress v1.15.1
2222
github.com/minio/cli v1.22.0
23+
github.com/minio/directpv v1.4.4-0.20220805090942-948ca4731651
2324
github.com/minio/highwayhash v1.0.2
2425
github.com/minio/kes v0.19.2
2526
github.com/minio/madmin-go v1.4.3
@@ -38,13 +39,20 @@ require (
3839
golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
3940
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
4041
gopkg.in/yaml.v2 v2.4.0
41-
k8s.io/api v0.23.5
42-
k8s.io/apimachinery v0.23.5
43-
k8s.io/client-go v0.23.5
42+
k8s.io/api v0.24.3
43+
k8s.io/apimachinery v0.24.3
44+
k8s.io/client-go v0.24.3
4445
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
4546
)
4647

4748
require (
49+
cloud.google.com/go v0.81.0 // indirect
50+
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
51+
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
52+
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
53+
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
54+
github.com/Azure/go-autorest/logger v0.2.1 // indirect
55+
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
4856
github.com/VividCortex/ewma v1.2.0 // indirect
4957
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
5058
github.com/beorn7/perks v1.0.1 // indirect
@@ -59,8 +67,11 @@ require (
5967
github.com/davecgh/go-spew v1.1.1 // indirect
6068
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
6169
github.com/docker/go-units v0.4.0 // indirect
70+
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
6271
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
6372
github.com/fatih/structs v1.1.0 // indirect
73+
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
74+
github.com/fsnotify/fsnotify v1.5.1 // indirect
6475
github.com/gdamore/encoding v1.0.0 // indirect
6576
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 // indirect
6677
github.com/go-logr/logr v1.2.2 // indirect
@@ -72,13 +83,16 @@ require (
7283
github.com/goccy/go-json v0.9.4 // indirect
7384
github.com/gogo/protobuf v1.3.2 // indirect
7485
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
86+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
7587
github.com/golang/protobuf v1.5.2 // indirect
88+
github.com/google/gnostic v0.5.7-v3refs // indirect
7689
github.com/google/go-cmp v0.5.7 // indirect
7790
github.com/google/gofuzz v1.2.0 // indirect
7891
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
79-
github.com/googleapis/gnostic v0.5.5 // indirect
8092
github.com/hashicorp/errwrap v1.1.0 // indirect
8193
github.com/hashicorp/go-multierror v1.1.1 // indirect
94+
github.com/hashicorp/hcl v1.0.0 // indirect
95+
github.com/imdario/mergo v0.3.12 // indirect
8296
github.com/inconshreveable/mousetrap v1.0.0 // indirect
8397
github.com/josharian/intern v1.0.0 // indirect
8498
github.com/json-iterator/go v1.1.12 // indirect
@@ -91,12 +105,14 @@ require (
91105
github.com/lestrrat-go/option v1.0.0 // indirect
92106
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
93107
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
108+
github.com/magiconair/properties v1.8.5 // indirect
94109
github.com/mailru/easyjson v0.7.7 // indirect
95110
github.com/mattn/go-colorable v0.1.12 // indirect
96111
github.com/mattn/go-ieproxy v0.0.1 // indirect
97112
github.com/mattn/go-isatty v0.0.14 // indirect
98113
github.com/mattn/go-runewidth v0.0.13 // indirect
99114
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
115+
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect
100116
github.com/minio/colorjson v1.0.2 // indirect
101117
github.com/minio/filepath v1.0.0 // indirect
102118
github.com/minio/md5-simd v1.1.2 // indirect
@@ -108,16 +124,18 @@ require (
108124
github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect
109125
github.com/muesli/reflow v0.3.0 // indirect
110126
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739 // indirect
127+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
111128
github.com/navidys/tvxwidgets v0.1.0 // indirect
112129
github.com/oklog/ulid v1.3.1 // indirect
113130
github.com/olekukonko/tablewriter v0.0.5 // indirect
131+
github.com/pelletier/go-toml v1.9.3 // indirect
114132
github.com/philhofer/fwd v1.1.2-0.20210722190033-5c56ac6d0bb9 // indirect
115133
github.com/pkg/errors v0.9.1 // indirect
116134
github.com/pkg/xattr v0.4.5 // indirect
117135
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
118136
github.com/posener/complete v1.2.3 // indirect
119137
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
120-
github.com/prometheus/client_golang v1.12.1 // indirect
138+
github.com/prometheus/client_golang v1.12.2 // indirect
121139
github.com/prometheus/client_model v0.2.0 // indirect
122140
github.com/prometheus/common v0.33.0 // indirect
123141
github.com/prometheus/procfs v0.7.3 // indirect
@@ -127,6 +145,12 @@ require (
127145
github.com/rjeczalik/notify v0.9.2 // indirect
128146
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
129147
github.com/sirupsen/logrus v1.8.1 // indirect
148+
github.com/spf13/afero v1.6.0 // indirect
149+
github.com/spf13/cast v1.3.1 // indirect
150+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
151+
github.com/spf13/pflag v1.0.5 // indirect
152+
github.com/spf13/viper v1.8.1 // indirect
153+
github.com/subosito/gotenv v1.2.0 // indirect
130154
github.com/tidwall/match v1.1.1 // indirect
131155
github.com/tidwall/pretty v1.2.0 // indirect
132156
github.com/tinylib/msgp v1.1.7-0.20211026165309-e818a1881b0e // indirect
@@ -136,7 +160,7 @@ require (
136160
go.etcd.io/etcd/api/v3 v3.5.2 // indirect
137161
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
138162
go.etcd.io/etcd/client/v3 v3.5.2 // indirect
139-
go.mongodb.org/mongo-driver v1.8.4 // indirect
163+
go.mongodb.org/mongo-driver v1.9.1 // indirect
140164
go.uber.org/atomic v1.9.0 // indirect
141165
go.uber.org/multierr v1.8.0 // indirect
142166
go.uber.org/zap v1.21.0 // indirect
@@ -153,8 +177,9 @@ require (
153177
gopkg.in/inf.v0 v0.9.1 // indirect
154178
gopkg.in/ini.v1 v1.66.4 // indirect
155179
gopkg.in/yaml.v3 v3.0.1 // indirect
156-
k8s.io/klog/v2 v2.40.1 // indirect
157-
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
180+
k8s.io/apiextensions-apiserver v0.24.3 // indirect
181+
k8s.io/klog/v2 v2.60.1 // indirect
182+
k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8 // indirect
158183
sigs.k8s.io/controller-runtime v0.11.1 // indirect
159184
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
160185
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect

0 commit comments

Comments
 (0)