Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6fb90f8

Browse files
harsh-pxpault84
authored and
pault84
committedJun 11, 2021
vendor update
Signed-off-by: Harsh Desai <[email protected]> Signed-off-by: pault84 <[email protected]>
1 parent 11178fb commit 6fb90f8

31 files changed

+3752
-42
lines changed
 

‎Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ build-kdmp:
121121
-X github.com/portworx/kdmp/pkg/version.buildDate=${BUILD_DATE}" \
122122
$(BASE_DIR)/cmd/kdmp
123123

124+
build-encryptor:
125+
@echo "Build encryptor"
126+
@cd cmd/3ncryptor/ && go build -o ../../bin/3ncryptor -ldflags="-s" .
127+
124128
container-kdmp:
125129
@echo "Build kdmp docker image"
126130
docker build --tag $(DOCKER_IMAGE) .

‎cmd/3ncryptor/3ncryptor.go

+500-16
Large diffs are not rendered by default.

‎cmd/3ncryptor/sdk/sdk.go

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package sdk
2+
3+
import (
4+
"crypto/tls"
5+
"fmt"
6+
"net"
7+
"net/url"
8+
"os"
9+
10+
httpclient "github.com/libopenstorage/openstorage/api/client"
11+
volumeclient "github.com/libopenstorage/openstorage/api/client/volume"
12+
"github.com/libopenstorage/openstorage/volume"
13+
"github.com/sirupsen/logrus"
14+
)
15+
16+
var (
17+
schedVolDriver volume.VolumeDriver
18+
token string
19+
UseTLS bool
20+
tokenEndPoint string
21+
tlsConfig *tls.Config
22+
)
23+
24+
// InitVolDriver inits vol driver
25+
func InitVolDriver(host string, port string, auth_token string) error {
26+
if len(auth_token) != 0 {
27+
token = auth_token
28+
}
29+
30+
schedClient, err := getNewVolumeclient(host, port, "pxd")
31+
if err != nil {
32+
logrus.Errorf("Error while initializing PX CLI for scheduler")
33+
os.Exit(-1)
34+
}
35+
36+
schedVolDriver = volumeclient.VolumeDriver(schedClient)
37+
return nil
38+
}
39+
40+
func getNewVolumeclient(endpoint, port, driverName string) (*httpclient.Client, error) {
41+
return getNewAuthVolumeclient(endpoint, port, token, driverName)
42+
}
43+
44+
// GetNewAuthVolumeclient create volume api client with auth token
45+
func getNewAuthVolumeclient(endpoint, port, bearerToken, driverName string) (*httpclient.Client, error) {
46+
if len(endpoint) > 0 && len(port) > 0 {
47+
endpoint = buildHTTPSEndpoint(endpoint, port)
48+
} else if len(tokenEndPoint) > 0 {
49+
endpoint = tokenEndPoint
50+
}
51+
52+
driverVersion := "v1"
53+
54+
if driverName == "" {
55+
driverName = "pxd"
56+
}
57+
58+
var (
59+
clnt *httpclient.Client
60+
err error
61+
)
62+
if len(bearerToken) != 0 {
63+
clnt, err = volumeclient.NewAuthDriverClient(endpoint, driverName, driverVersion, bearerToken, "", driverName)
64+
} else {
65+
clnt, err = volumeclient.NewDriverClient(endpoint, driverName, driverVersion, driverName)
66+
}
67+
if err != nil {
68+
return nil, err
69+
}
70+
71+
if UseTLS && !IsUnixDomainSocket(endpoint) {
72+
clnt.SetTLS(tlsConfig)
73+
}
74+
75+
return clnt, nil
76+
}
77+
78+
// BuildHTTPSEndpoint create http endpoint URL
79+
func buildHTTPSEndpoint(host string, port string) string {
80+
if IsUnixDomainSocket(host) {
81+
return host
82+
}
83+
endpoint := &url.URL{}
84+
endpoint.Scheme = "http"
85+
endpoint.Host = fmt.Sprintf("%s:%s", host, port)
86+
87+
if UseTLS {
88+
endpoint.Scheme = "https"
89+
}
90+
return endpoint.String()
91+
}
92+
93+
// IsUnixDomainSocket is a helper method that checks if the host is a unix DS endpoint in the format unix://<path>
94+
func IsUnixDomainSocket(host string) bool {
95+
// Check if it is a unix:// URL
96+
u, err := url.Parse(host)
97+
if err == nil {
98+
// Check if host just has an IP
99+
if u.Scheme == "unix" {
100+
return true
101+
}
102+
if !u.IsAbs() && net.ParseIP(host) == nil {
103+
return true
104+
}
105+
}
106+
return false
107+
}
108+
109+
func GetVolumeDriver() volume.VolumeDriver {
110+
return schedVolDriver
111+
}

‎go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
github.com/spf13/pflag v1.0.5
1616
github.com/stretchr/testify v1.4.0
1717
github.com/urfave/cli v1.22.2
18+
golang.org/x/mod v0.4.2 // indirect
1819
golang.org/x/tools v0.0.0-20200408132156-9ee5ef7a2c0d // indirect
1920
k8s.io/api v0.17.0
2021
k8s.io/apiextensions-apiserver v0.16.6

‎go.sum

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ github.com/brancz/gojsontoyaml v0.0.0-20190425155809-e8bd32d46b3d/go.mod h1:IyUJ
8181
github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
8282
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
8383
github.com/cenk/backoff v2.0.0+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE=
84+
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
8485
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
8586
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
8687
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -759,6 +760,8 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU
759760
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
760761
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
761762
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
763+
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
764+
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
762765
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
763766
golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
764767
golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=

‎vendor/github.com/cenkalti/backoff/.gitignore

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/.travis.yml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/LICENSE

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/README.md

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/backoff.go

+66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/context.go

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/exponential.go

+153
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/retry.go

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/ticker.go

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/cenkalti/backoff/tries.go

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/api/client/client.go

+177
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/api/client/request.go

+355
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/api/client/volume/client.go

+819
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/api/client/volume/volume.go

+97
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/api/errors/errors.go

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/pkg/options/options.go

+84
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/README.md

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/cloudbackup.go

+64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/errors.go

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/volume.go

+296
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/volume_driver_registry.go

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/github.com/libopenstorage/openstorage/volume/volume_not_supported.go

+233
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/golang.org/x/mod/module/module.go

+129-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/golang.org/x/mod/semver/semver.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/golang.org/x/mod/sumdb/dirhash/hash.go

+132
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vendor/modules.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/PuerkitoBio/urlesc
1111
github.com/asaskevich/govalidator
1212
# github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
1313
github.com/beorn7/perks/quantile
14+
# github.com/cenkalti/backoff v2.1.1+incompatible
15+
github.com/cenkalti/backoff
1416
# github.com/cheynewallace/tabby v1.1.0
1517
github.com/cheynewallace/tabby
1618
# github.com/coreos/go-oidc v2.1.0+incompatible
@@ -105,7 +107,12 @@ github.com/kubernetes-incubator/external-storage/snapshot/pkg/apis/crd/v1
105107
github.com/kubernetes-incubator/external-storage/snapshot/pkg/client
106108
# github.com/libopenstorage/openstorage v8.0.0+incompatible
107109
github.com/libopenstorage/openstorage/api
110+
github.com/libopenstorage/openstorage/api/client
111+
github.com/libopenstorage/openstorage/api/client/volume
112+
github.com/libopenstorage/openstorage/api/errors
108113
github.com/libopenstorage/openstorage/pkg/auth
114+
github.com/libopenstorage/openstorage/pkg/options
115+
github.com/libopenstorage/openstorage/volume
109116
# github.com/libopenstorage/openstorage-sdk-clients v0.69.27
110117
github.com/libopenstorage/openstorage-sdk-clients/sdk/golang
111118
# github.com/libopenstorage/stork v1.3.0-beta1.0.20200630005842-9255e7a98775
@@ -196,9 +203,10 @@ golang.org/x/crypto/ed25519
196203
golang.org/x/crypto/ed25519/internal/edwards25519
197204
golang.org/x/crypto/pbkdf2
198205
golang.org/x/crypto/ssh/terminal
199-
# golang.org/x/mod v0.2.0
206+
# golang.org/x/mod v0.4.2
200207
golang.org/x/mod/module
201208
golang.org/x/mod/semver
209+
golang.org/x/mod/sumdb/dirhash
202210
# golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
203211
golang.org/x/net/context
204212
golang.org/x/net/context/ctxhttp

0 commit comments

Comments
 (0)
Please sign in to comment.