Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.19.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e test 1.19

on: [push, pull_request]
on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.20.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e test 1.20

on: [push, pull_request]
on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.21.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e test 1.21

on: [push, pull_request]
on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.22.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e test 1.22

on: [push, pull_request]
on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kuttl-e2e-test-1.23.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: e2e test 1.23

on: [push, pull_request]
on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: Lint Full Codebase
#############################
# Start the job on all push #
#############################
on: [ push, pull_request ]
on: [ push ]

###############
# Set the Job #
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test and build image

on: [push, pull_request]
on: [ push ]

env:
OPERATOR_IMAGE: storageos/portal-manager:develop
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
with:
go-version: '1.16.2'
- name: Run go tidy
run: make tidy && git diff --exit-code && test -z "$(git ls-files --exclude-standard --others | tee /dev/fd/2)"
run: make tidy && git diff --shortstat --exit-code
- name: Run go test
run: make test
- name: Run go build
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.14.0
github.com/pkg/errors v0.9.1
github.com/storageos/api-manager v1.2.4-0.20220118115836-e29d4b100752
github.com/storageos/go-api/v2 v2.6.1-0.20220117165820-8e9a07096ee3
github.com/storageos/api-manager v1.2.5
github.com/storageos/go-api v0.0.0-20220209143821-59d68c680d51
github.com/storageos/operator v0.0.0-20211123123218-a7e0120a25e0
go.uber.org/zap v1.18.1
google.golang.org/protobuf v1.26.0
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,11 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
github.com/storageos/api-manager v1.2.4-0.20220118115836-e29d4b100752 h1:AcPKXPHmf/U2fPsG63Tf/gYGn1sk2DWs8hALMTiHbxg=
github.com/storageos/api-manager v1.2.4-0.20220118115836-e29d4b100752/go.mod h1:Hk1c5k6hV4vl8voq9I64uaMv0Lq1Wx66UhcYq6BDRDQ=
github.com/storageos/api-manager v1.2.5 h1:HWfQr0ZekPLu+ENkBg5wIbPhTsNAPlyyXqXz2c/p6JY=
github.com/storageos/api-manager v1.2.5/go.mod h1:Hk1c5k6hV4vl8voq9I64uaMv0Lq1Wx66UhcYq6BDRDQ=
github.com/storageos/go-api v0.0.0-20220209143821-59d68c680d51 h1:cKvYX7NQy8CokGq662uMl0UWd1sYcH12jkpJhqUgVfs=
github.com/storageos/go-api v0.0.0-20220209143821-59d68c680d51/go.mod h1:8nTfqI+/wEmSs+gk/U1ZljZ+GnduPqi0HwIVXep9pjk=
github.com/storageos/go-api/v2 v2.4.0/go.mod h1:FpEkX+56ILt5L8Jt7pnXM1BRzFQ5YPkMSeZijTGcw5U=
github.com/storageos/go-api/v2 v2.6.1-0.20220117165820-8e9a07096ee3 h1:1Nqvc2tC6qapCvCKBQIstZlCrBb7CgCFoLilIdAekos=
github.com/storageos/go-api/v2 v2.6.1-0.20220117165820-8e9a07096ee3/go.mod h1:FpEkX+56ILt5L8Jt7pnXM1BRzFQ5YPkMSeZijTGcw5U=
github.com/storageos/operator v0.0.0-20211123123218-a7e0120a25e0 h1:ykW9EnGbzzuNIJZ0JV7SK2kwj1cOCuZw8DyWxnHCJc8=
github.com/storageos/operator v0.0.0-20211123123218-a7e0120a25e0/go.mod h1:iACLwB+MlUrU2dcgl6E6n5maRjWLGuJ8t6O2qsxC3/I=
Expand Down Expand Up @@ -863,8 +864,9 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc=
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ EOF
cat <<EOF > "${file}"
name: e2e test ${major}

on: [push, pull_request]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we not performing e2e tests for PRs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i'm right @nolancon in the old way it had executed two times, once commit had pushed and one pr had created. Now it runs only once.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, but if a PR came from a fork then the test would not run I think? 🤔 I know that we can't fork this repo because it's private, but presumably it will be public eventually. I often create PRs to our public repos from my own fork. Maybe I'm confusing things... it's not a big deal regardless 🤷‍♂️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's exactly as @mhmxs said.
About the second concern, even if you fork a project you do it with the intention of making changes so when you do them and follow up with a commit+push the workflows will run.
In other words, what you described will indeed cause the workflows on our repo to not run but they will have run on the forked project.
IMO 99.99% of the contributions will be ours and thus this is not a concern. WDYT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's fair enough. It probably makes more sense for us to be creating PRs that don't come from our own forked repos anyway.. just a habit I have from other OS projects I guess.

on: [ push ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const (
// manager. It can be used for filtering events.
EventSourceName = "storageos-portal-manager"

// portalURLEnv is the Portal API tenant ID environment variable.
// tenantIDEnv is the Portal API tenant ID environment variable.
tenantIDEnv = "TENANT_ID"

// portalURLEnv is the Portal API URL environment variable.
Expand Down
29 changes: 15 additions & 14 deletions pkg/storageos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import (

"github.com/go-logr/logr"
"github.com/pkg/errors"
stosapiv2 "github.com/storageos/go-api/v2"
stosapi "github.com/storageos/go-api/autogenerated"
stosapierrors "github.com/storageos/go-api/errors"
)

// ControlPlane is the subset of the StorageOS control plane ControlPlane that
// portal manager requires.
type ControlPlane interface {
RefreshJwt(context.Context) (stosapiv2.UserSession, *http.Response, error)
AuthenticateUser(context.Context, stosapiv2.AuthUserData) (stosapiv2.UserSession, *http.Response, error)
GetCluster(context.Context) (stosapiv2.Cluster, *http.Response, error)
RefreshJwt(context.Context) (stosapi.UserSession, *http.Response, error)
AuthenticateUser(context.Context, stosapi.AuthUserData) (stosapi.UserSession, *http.Response, error)
GetCluster(context.Context) (stosapi.Cluster, *http.Response, error)
}

// Client provides access to the StorageOS API.
Expand Down Expand Up @@ -100,7 +101,7 @@ func (c *Client) GetCluster() (string, error) {
func (c *Client) initAuthenticatedClient() error {
c.logger.V(3).Info("Initialize autheticated client...")

config := stosapiv2.NewConfiguration()
config := stosapi.NewConfiguration()

u, err := url.Parse(c.endpoint)
if err != nil {
Expand All @@ -122,7 +123,7 @@ func (c *Client) initAuthenticatedClient() error {
c.logger.V(5).Info("Config", "config", config)

// Get a wrappered API client.
client := stosapiv2.NewAPIClient(config)
client := stosapi.NewAPIClient(config)
c.api = client.DefaultApi

// Authenticate and return context with credentials and client.
Expand Down Expand Up @@ -176,7 +177,7 @@ func (c *Client) Refresh(ctx context.Context, reset chan struct{}, interval time
c.logger.V(2).Info("failed to refresh storageos api credentials", "error", ErrNoAuthToken)
continue
}
c.ctx = context.WithValue(c.ctx, stosapiv2.ContextAccessToken, token)
c.ctx = context.WithValue(c.ctx, stosapi.ContextAccessToken, token)
c.logger.V(3).Info("refreshed storageos api token")
case <-reset:
c.logger.V(5).Info("processing request to reset storageos api client")
Expand All @@ -202,12 +203,12 @@ func (c *Client) resetClient() (context.Context, error) {
defer cancel()

// Initial basic auth to retrieve the jwt token.
_, resp, err := c.api.AuthenticateUser(ctx, stosapiv2.AuthUserData{
_, resp, err := c.api.AuthenticateUser(ctx, stosapi.AuthUserData{
Username: c.username,
Password: c.password,
})
if err != nil {
return nil, stosapiv2.MapAPIError(err, resp)
return nil, stosapierrors.MapAPIError(err, resp)
}
defer resp.Body.Close()

Expand All @@ -216,7 +217,7 @@ func (c *Client) resetClient() (context.Context, error) {
if token == "" {
return nil, ErrNoAuthToken
}
return context.WithValue(context.Background(), stosapiv2.ContextAccessToken, token), nil
return context.WithValue(context.Background(), stosapi.ContextAccessToken, token), nil
}

// respAuthToken is a helper to pull the auth token out of a HTTP Response.
Expand All @@ -228,18 +229,18 @@ func respAuthToken(resp *http.Response) string {
return ""
}

func authenticate(client *stosapiv2.APIClient, username, password string) (context.Context, error) {
func authenticate(client *stosapi.APIClient, username, password string) (context.Context, error) {
// Create context just for the login.
ctx, cancel := context.WithTimeout(context.Background(), AuthenticationTimeout)
defer cancel()

// Initial basic auth to retrieve the jwt token.
_, resp, err := client.DefaultApi.AuthenticateUser(ctx, stosapiv2.AuthUserData{
_, resp, err := client.DefaultApi.AuthenticateUser(ctx, stosapi.AuthUserData{
Username: username,
Password: password,
})
if err != nil {
return nil, stosapiv2.MapAPIError(err, resp)
return nil, stosapierrors.MapAPIError(err, resp)
}
defer resp.Body.Close()

Expand All @@ -248,5 +249,5 @@ func authenticate(client *stosapiv2.APIClient, username, password string) (conte
if token == "" {
return nil, ErrNoAuthToken
}
return context.WithValue(context.Background(), stosapiv2.ContextAccessToken, token), nil
return context.WithValue(context.Background(), stosapi.ContextAccessToken, token), nil
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading