Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use cached client #110

Merged
merged 1 commit into from
Oct 28, 2023
Merged
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
7 changes: 5 additions & 2 deletions cloud/scope/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func newComputeService(ctx context.Context, cluster *infrav1.ProxmoxCluster, crC
TokenID: string(secret.Data["PROXMOX_TOKENID"]),
Secret: string(secret.Data["PROXMOX_SECRET"]),
}

return proxmox.NewService(serverRef.Endpoint, authConfig, true)
clientConfig := proxmox.ClientConfig{
InsecureSkipVerify: true,
}
param := proxmox.NewParams(serverRef.Endpoint, authConfig, clientConfig)
return proxmox.GetOrCreateService(param)
}
3 changes: 2 additions & 1 deletion cloud/services/compute/storage/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ func (s *Service) deleteStorage(ctx context.Context) error {

func generateVMStorageOptions(scope Scope) api.StorageCreateOptions {
storageSpec := scope.Storage()
mkdir := true
options := api.StorageCreateOptions{
Storage: storageSpec.Name,
StorageType: "dir",
Content: "snippets",
Mkdir: true,
Mkdir: &mkdir,
Path: storageSpec.Path,
}
return options
Expand Down
3 changes: 2 additions & 1 deletion cloud/services/compute/storage/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ var _ = BeforeSuite(func() {
TokenID: tokenid,
Secret: secret,
}
param := proxmox.NewParams(url, authConfig, proxmox.ClientConfig{InsecureSkipVerify: true})
var err error
proxmoxSvc, err = proxmox.NewService(url, authConfig, true)
proxmoxSvc, err = proxmox.GetOrCreateService(param)
Expect(err).NotTo(HaveOccurred())
}
})
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.28.1
github.com/pkg/errors v0.9.1
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
Expand Down Expand Up @@ -416,8 +417,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110 h1:TJqu6ZnBbz7rL+ZTMX7RyNUoKhAGlBpbAREb2M/ANMo=
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110/go.mod h1:XtUQue7w5tuB6c7xputkhnN+A3EZbzDWq+uXmlkOPfQ=
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274 h1:XhsJkLNMEreFwJh88jimmxrfW5yeH/a2t30GdhPxles=
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274/go.mod h1:iEI7ilRwyUaWvoxuXs/30UJ2f8Z2TWXCW1cZ3QeU2JY=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
Expand Down