Skip to content

Commit

Permalink
seagate-exos-x-api-go library v2 compatibility updates (#98)
Browse files Browse the repository at this point in the history
fix: Updates for compatibility with api-lib v2

* Use ContextBasicAuth for array logins
* Use api lib version 2.0.3 and update related imports
* Update base container images for go1.20 and ubi8
* Update go version to 1.20
  • Loading branch information
David-T-White committed Nov 29, 2023
1 parent fb48a17 commit aa72c7f
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 424 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# line, or for args to be updated in this file prior to building. See
# the ARG section below.

FROM registry.access.redhat.com/ubi7/go-toolset:1.19 AS build
FROM registry.access.redhat.com/ubi8/go-toolset:1.20 AS build

USER root
ENV PATH="${PATH}:/opt/rh/go-toolset-1.19/root/usr/bin/"
Expand All @@ -26,7 +26,7 @@ RUN ls -l /

########################################################################

FROM registry.access.redhat.com/ubi7
FROM registry.access.redhat.com/ubi8

ARG version=v1.8.2
ARG vcs_ref=1a46e346f0094ef80951e5c4c9ef315785b0e2c2
Expand Down
36 changes: 18 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module github.com/Seagate/seagate-exos-x-csi

go 1.19
go 1.20

require (
github.com/Seagate/csi-lib-iscsi v1.0.3
github.com/Seagate/csi-lib-sas v1.0.2
github.com/Seagate/seagate-exos-x-api-go v1.0.18
github.com/Seagate/seagate-exos-x-api-go/v2 v2.0.3
github.com/container-storage-interface/spec v1.8.0
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
github.com/kubernetes-csi/csi-test v0.0.0-20191016154743-6931aedb3df0
github.com/onsi/gomega v1.27.6
github.com/onsi/gomega v1.28.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.1
github.com/prometheus/client_golang v1.17.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
k8s.io/klog/v2 v2.100.1
)

Expand All @@ -25,23 +25,23 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/namsral/flag v1.7.4-pre // indirect
github.com/nxadm/tail v1.4.4 // indirect
github.com/onsi/ginkgo v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

//replace github.com/Seagate/seagate-exos-x-api-go => ./seagate-exos-x-api-go
//replace github.com/Seagate/seagate-exos-x-api-go/v2 => ./seagate-exos-x-api-go
// replace github.com/Seagate/csi-lib-iscsi => ../csi-lib-iscsi
// replace github.com/Seagate/csi-lib-sas => ../csi-lib-sas
435 changes: 39 additions & 396 deletions go.sum

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"sync"
"syscall"

storageapi "github.com/Seagate/seagate-exos-x-api-go/pkg/v1"
storageapi "github.com/Seagate/seagate-exos-x-api-go/v2/pkg/api"
"github.com/Seagate/seagate-exos-x-api-go/v2/pkg/client"
"github.com/Seagate/seagate-exos-x-csi/pkg/common"
"github.com/Seagate/seagate-exos-x-csi/pkg/node_service"
pb "github.com/Seagate/seagate-exos-x-csi/pkg/node_service/node_servicepb"
Expand Down Expand Up @@ -226,7 +227,7 @@ func (controller *Controller) beginRoutine(ctx *DriverCtx, methodName string) er
}

func (controller *Controller) endRoutine() {
controller.client.CloseConnections()
controller.client.HTTPClient.CloseIdleConnections()
}

func (controller *Controller) configureClient(credentials map[string]string) error {
Expand All @@ -251,9 +252,14 @@ func (controller *Controller) configureClient(credentials map[string]string) err
return nil
}

klog.InfoS("login to API", "address", apiAddr, "username", username)
//these stored credentials are still used for the session valid check
controller.client.StoreCredentials(apiAddr, "", username, password)
err := controller.client.Login()

ctx := context.WithValue(context.Background(), client.ContextBasicAuth, client.BasicAuth{
UserName: username,
Password: password,
})
err := controller.client.Login(ctx)
if err != nil {
return status.Error(codes.Unauthenticated, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"strings"

storageapitypes "github.com/Seagate/seagate-exos-x-api-go/pkg/common"
storageapi "github.com/Seagate/seagate-exos-x-api-go/pkg/v1"
storageapi "github.com/Seagate/seagate-exos-x-api-go/v2/pkg/api"
storageapitypes "github.com/Seagate/seagate-exos-x-api-go/v2/pkg/common"

"github.com/Seagate/seagate-exos-x-csi/pkg/common"
"github.com/Seagate/seagate-exos-x-csi/pkg/storage"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

storageapitypes "github.com/Seagate/seagate-exos-x-api-go/pkg/common"
storageapitypes "github.com/Seagate/seagate-exos-x-api-go/v2/pkg/common"

"github.com/Seagate/seagate-exos-x-csi/pkg/common"
"github.com/container-storage-interface/spec/lib/go/csi"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"math"
"strconv"

storageapitypes "github.com/Seagate/seagate-exos-x-api-go/pkg/common"
storageapitypes "github.com/Seagate/seagate-exos-x-api-go/v2/pkg/common"
"github.com/Seagate/seagate-exos-x-csi/pkg/common"
"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc/codes"
Expand Down

0 comments on commit aa72c7f

Please sign in to comment.