Skip to content

Commit 0c69897

Browse files
authored
Merge pull request #110 from sp-yduck/feature/clientconfig
use cached client
2 parents df02fa2 + e89c246 commit 0c69897

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

cloud/scope/clients.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func newComputeService(ctx context.Context, cluster *infrav1.ProxmoxCluster, crC
6363
TokenID: string(secret.Data["PROXMOX_TOKENID"]),
6464
Secret: string(secret.Data["PROXMOX_SECRET"]),
6565
}
66-
67-
return proxmox.NewService(serverRef.Endpoint, authConfig, true)
66+
clientConfig := proxmox.ClientConfig{
67+
InsecureSkipVerify: true,
68+
}
69+
param := proxmox.NewParams(serverRef.Endpoint, authConfig, clientConfig)
70+
return proxmox.GetOrCreateService(param)
6871
}

cloud/services/compute/storage/reconcile.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ func (s *Service) deleteStorage(ctx context.Context) error {
103103

104104
func generateVMStorageOptions(scope Scope) api.StorageCreateOptions {
105105
storageSpec := scope.Storage()
106+
mkdir := true
106107
options := api.StorageCreateOptions{
107108
Storage: storageSpec.Name,
108109
StorageType: "dir",
109110
Content: "snippets",
110-
Mkdir: true,
111+
Mkdir: &mkdir,
111112
Path: storageSpec.Path,
112113
}
113114
return options

cloud/services/compute/storage/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ var _ = BeforeSuite(func() {
3737
TokenID: tokenid,
3838
Secret: secret,
3939
}
40+
param := proxmox.NewParams(url, authConfig, proxmox.ClientConfig{InsecureSkipVerify: true})
4041
var err error
41-
proxmoxSvc, err = proxmox.NewService(url, authConfig, true)
42+
proxmoxSvc, err = proxmox.GetOrCreateService(param)
4243
Expect(err).NotTo(HaveOccurred())
4344
}
4445
})

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/onsi/ginkgo/v2 v2.13.0
88
github.com/onsi/gomega v1.28.1
99
github.com/pkg/errors v0.9.1
10-
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110
10+
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274
1111
gopkg.in/yaml.v3 v3.0.1
1212
k8s.io/api v0.27.2
1313
k8s.io/apimachinery v0.27.2
@@ -45,7 +45,7 @@ require (
4545
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
4646
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
4747
github.com/fsnotify/fsnotify v1.6.0 // indirect
48-
github.com/go-logr/logr v1.2.4 // indirect
48+
github.com/go-logr/logr v1.3.0 // indirect
4949
github.com/go-logr/zapr v1.2.4 // indirect
5050
github.com/go-openapi/jsonpointer v0.19.6 // indirect
5151
github.com/go-openapi/jsonreference v0.20.1 // indirect

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
149149
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
150150
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
151151
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
152-
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
153152
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
153+
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
154+
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
154155
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
155156
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
156157
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
@@ -416,8 +417,8 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
416417
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
417418
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
418419
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
419-
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110 h1:TJqu6ZnBbz7rL+ZTMX7RyNUoKhAGlBpbAREb2M/ANMo=
420-
github.com/sp-yduck/proxmox-go v0.0.0-20230807140547-f03780ca1110/go.mod h1:XtUQue7w5tuB6c7xputkhnN+A3EZbzDWq+uXmlkOPfQ=
420+
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274 h1:XhsJkLNMEreFwJh88jimmxrfW5yeH/a2t30GdhPxles=
421+
github.com/sp-yduck/proxmox-go v0.0.0-20231028112758-ef366c611274/go.mod h1:iEI7ilRwyUaWvoxuXs/30UJ2f8Z2TWXCW1cZ3QeU2JY=
421422
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
422423
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
423424
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=

0 commit comments

Comments
 (0)