Skip to content

Commit 29fd804

Browse files
Merge pull request openshift#8493 from shiftstack/gophercloud_v2
OSASINFRA-3465: openstack: Update Gophercloud to v2
2 parents aea78fb + 42e471e commit 29fd804

File tree

307 files changed

+8286
-5108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+8286
-5108
lines changed

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ require (
5050
github.com/google/go-cmp v0.6.0
5151
github.com/google/uuid v1.6.0
5252
github.com/googleapis/gax-go/v2 v2.12.3
53-
github.com/gophercloud/gophercloud v1.7.0
54-
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56
53+
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.3
54+
github.com/gophercloud/utils/v2 v2.0.0-20240606071537-ccde17eee9f1
5555
github.com/h2non/filetype v1.0.12
5656
github.com/hashicorp/go-multierror v1.1.1
5757
github.com/hashicorp/go-version v1.6.0
@@ -96,11 +96,11 @@ require (
9696
github.com/ulikunitz/xz v0.5.12
9797
github.com/vincent-petithory/dataurl v1.0.0
9898
github.com/vmware/govmomi v0.34.2
99-
golang.org/x/crypto v0.23.0
99+
golang.org/x/crypto v0.24.0
100100
golang.org/x/oauth2 v0.20.0
101101
golang.org/x/sync v0.7.0
102-
golang.org/x/sys v0.20.0
103-
golang.org/x/term v0.20.0
102+
golang.org/x/sys v0.21.0
103+
golang.org/x/term v0.21.0
104104
google.golang.org/api v0.176.0
105105
google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c
106106
google.golang.org/grpc v1.63.2
@@ -185,6 +185,7 @@ require (
185185
github.com/go-playground/locales v0.14.1 // indirect
186186
github.com/go-playground/universal-translator v0.18.1 // indirect
187187
github.com/gobuffalo/flect v1.0.2 // indirect
188+
github.com/gofrs/uuid/v5 v5.2.0 // indirect
188189
github.com/gogo/protobuf v1.3.2 // indirect
189190
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
190191
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -199,7 +200,6 @@ require (
199200
github.com/hashicorp/errwrap v1.1.0 // indirect
200201
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
201202
github.com/hashicorp/go-retryablehttp v0.7.6 // indirect
202-
github.com/hashicorp/go-uuid v1.0.3 // indirect
203203
github.com/hashicorp/terraform-json v0.14.0 // indirect
204204
github.com/hexops/gotextdiff v1.0.3 // indirect
205205
github.com/imdario/mergo v0.3.16 // indirect
@@ -271,9 +271,9 @@ require (
271271
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
272272
golang.org/x/mod v0.17.0 // indirect
273273
golang.org/x/net v0.25.0 // indirect
274-
golang.org/x/text v0.15.0 // indirect
274+
golang.org/x/text v0.16.0 // indirect
275275
golang.org/x/time v0.5.0 // indirect
276-
golang.org/x/tools v0.21.0 // indirect
276+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
277277
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
278278
google.golang.org/appengine v1.6.8 // indirect
279279
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect

go.sum

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,8 @@ github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY9
15811581
github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
15821582
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
15831583
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
1584+
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
1585+
github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
15841586
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
15851587
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
15861588
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
@@ -1724,11 +1726,10 @@ github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2c
17241726
github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
17251727
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
17261728
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
1727-
github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
1728-
github.com/gophercloud/gophercloud v1.7.0 h1:fyJGKh0LBvIZKLvBWvQdIgkaV5yTM3Jh9EYUh+UNCAs=
1729-
github.com/gophercloud/gophercloud v1.7.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
1730-
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 h1:sH7xkTfYzxIEgzq1tDHIMKRh1vThOEOGNsettdEeLbE=
1731-
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56/go.mod h1:VSalo4adEk+3sNkmVJLnhHoOyOYYS8sTWLG4mv5BKto=
1729+
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.3 h1:Gc1oFIROarJoIcvg63BsXrK6G+DPwYVs5gKlmvV2UC8=
1730+
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.3/go.mod h1:ZKbcGNjxFTSaP5wlvtLDdsppllD/UGGvXBPqcjeqA8Y=
1731+
github.com/gophercloud/utils/v2 v2.0.0-20240606071537-ccde17eee9f1 h1:9t270B3KerAainWtBglWrzSlv/+rK82C9ATNoDT6i8Y=
1732+
github.com/gophercloud/utils/v2 v2.0.0-20240606071537-ccde17eee9f1/go.mod h1:ULBNSp+DO9Vh2cPATLWXpMBqJaIq4MRrD5nDHdbHCOQ=
17321733
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
17331734
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
17341735
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@@ -1757,8 +1758,6 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9
17571758
github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
17581759
github.com/hashicorp/go-retryablehttp v0.7.6 h1:TwRYfx2z2C4cLbXmT8I5PgP/xmuqASDyiVuGYfs9GZM=
17591760
github.com/hashicorp/go-retryablehttp v0.7.6/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
1760-
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
1761-
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
17621761
github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
17631762
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
17641763
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
@@ -2257,7 +2256,6 @@ golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0
22572256
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
22582257
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
22592258
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
2260-
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
22612259
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
22622260
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
22632261
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
@@ -2271,8 +2269,8 @@ golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72
22712269
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
22722270
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
22732271
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
2274-
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
2275-
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
2272+
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
2273+
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
22762274
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
22772275
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
22782276
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -2518,8 +2516,8 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25182516
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25192517
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25202518
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2521-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
2522-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2519+
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
2520+
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25232521
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
25242522
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
25252523
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
@@ -2542,8 +2540,8 @@ golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
25422540
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
25432541
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
25442542
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
2545-
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
2546-
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
2543+
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
2544+
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
25472545
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
25482546
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
25492547
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -2564,8 +2562,8 @@ golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
25642562
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
25652563
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
25662564
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
2567-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
2568-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
2565+
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
2566+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
25692567
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
25702568
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
25712569
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -2639,8 +2637,8 @@ golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
26392637
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
26402638
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
26412639
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
2642-
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
2643-
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
2640+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
2641+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
26442642
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
26452643
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
26462644
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/asset/cluster/cluster.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *Cluster) Dependencies() []asset.Asset {
8080
}
8181
}
8282

83-
// Generate launches the cluster and generates the terraform state file on disk.
83+
// GenerateWithContext launches the cluster and generates the terraform state file on disk.
8484
func (c *Cluster) GenerateWithContext(ctx context.Context, parents asset.Parents) (err error) {
8585
if InstallDir == "" {
8686
logrus.Fatalf("InstallDir has not been set for the %q asset", c.Name())
@@ -115,11 +115,11 @@ func (c *Cluster) GenerateWithContext(ctx context.Context, parents asset.Parents
115115
logrus.Infof("Creating infrastructure resources...")
116116
switch platform {
117117
case typesaws.Name:
118-
if err := aws.PreTerraform(context.TODO(), clusterID.InfraID, installConfig); err != nil {
118+
if err := aws.PreTerraform(ctx, clusterID.InfraID, installConfig); err != nil {
119119
return err
120120
}
121121
case typesazure.Name, typesazure.StackTerraformName:
122-
if err := azure.PreTerraform(context.TODO(), clusterID.InfraID, installConfig); err != nil {
122+
if err := azure.PreTerraform(ctx, clusterID.InfraID, installConfig); err != nil {
123123
return err
124124
}
125125
case typesopenstack.Name:
@@ -130,7 +130,7 @@ func (c *Cluster) GenerateWithContext(ctx context.Context, parents asset.Parents
130130
break
131131
}
132132
}
133-
if err := openstack.PreTerraform(context.TODO(), tfvarsFile, installConfig, clusterID, rhcosImage); err != nil {
133+
if err := openstack.PreTerraform(ctx, tfvarsFile, installConfig, clusterID, rhcosImage); err != nil {
134134
return err
135135
}
136136
}

pkg/asset/cluster/tfvars/tfvars.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
753753
})
754754
case openstack.Name:
755755
data, err = openstacktfvars.TFVars(
756+
ctx,
756757
installConfig,
757758
mastersAsset,
758759
workersAsset,

pkg/asset/installconfig/installconfig.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func (a *InstallConfig) Dependencies() []asset.Asset {
6060
}
6161
}
6262

63-
// Generate generates the install-config.yaml file.
64-
func (a *InstallConfig) Generate(parents asset.Parents) error {
63+
// GenerateWithContext generates the install-config.yaml file.
64+
func (a *InstallConfig) GenerateWithContext(ctx context.Context, parents asset.Parents) error {
6565
sshPublicKey := &sshPublicKey{}
6666
baseDomain := &baseDomain{}
6767
clusterName := &clusterName{}
@@ -102,14 +102,15 @@ func (a *InstallConfig) Generate(parents asset.Parents) error {
102102

103103
defaults.SetInstallConfigDefaults(a.Config)
104104

105-
return a.finish("")
105+
return a.finish(ctx, "")
106106
}
107107

108108
// Load returns the installconfig from disk.
109109
func (a *InstallConfig) Load(f asset.FileFetcher) (found bool, err error) {
110+
ctx := context.TODO()
110111
found, err = a.LoadFromFile(f)
111112
if found && err == nil {
112-
if err := a.finish(installConfigFilename); err != nil {
113+
if err := a.finish(ctx, installConfigFilename); err != nil {
113114
return false, errors.Wrap(err, asset.InstallConfigError)
114115
}
115116
}
@@ -137,7 +138,7 @@ func (a *InstallConfig) finishAWS() error {
137138
return nil
138139
}
139140

140-
func (a *InstallConfig) finish(filename string) error {
141+
func (a *InstallConfig) finish(ctx context.Context, filename string) error {
141142
if a.Config.AWS != nil {
142143
a.AWS = aws.NewMetadata(a.Config.Platform.AWS.Region, a.Config.Platform.AWS.Subnets, a.Config.AWS.ServiceEndpoints)
143144
if err := a.finishAWS(); err != nil {
@@ -168,7 +169,7 @@ func (a *InstallConfig) finish(filename string) error {
168169
return errors.Wrapf(err, "invalid %q file", filename)
169170
}
170171

171-
if err := a.platformValidation(); err != nil {
172+
if err := a.platformValidation(ctx); err != nil {
172173
return err
173174
}
174175

@@ -178,7 +179,7 @@ func (a *InstallConfig) finish(filename string) error {
178179
// platformValidation runs validations that require connecting to the
179180
// underlying platform. In some cases, platforms also duplicate validations
180181
// that have already been checked by validation.ValidateInstallConfig().
181-
func (a *InstallConfig) platformValidation() error {
182+
func (a *InstallConfig) platformValidation(ctx context.Context) error {
182183
if a.Config.Platform.Azure != nil {
183184
if a.Config.Platform.Azure.IsARO() {
184185
// ARO performs platform validation in the Resource Provider before
@@ -192,7 +193,7 @@ func (a *InstallConfig) platformValidation() error {
192193
return icazure.Validate(client, a.Config)
193194
}
194195
if a.Config.Platform.GCP != nil {
195-
client, err := icgcp.NewClient(context.TODO())
196+
client, err := icgcp.NewClient(ctx)
196197
if err != nil {
197198
return err
198199
}
@@ -211,7 +212,7 @@ func (a *InstallConfig) platformValidation() error {
211212
return icibmcloud.Validate(client, a.Config)
212213
}
213214
if a.Config.Platform.AWS != nil {
214-
return aws.Validate(context.TODO(), a.AWS, a.Config)
215+
return aws.Validate(ctx, a.AWS, a.Config)
215216
}
216217
if a.Config.Platform.VSphere != nil {
217218
return icvsphere.Validate(a.Config)
@@ -220,7 +221,7 @@ func (a *InstallConfig) platformValidation() error {
220221
return icovirt.Validate(a.Config)
221222
}
222223
if a.Config.Platform.OpenStack != nil {
223-
return icopenstack.Validate(a.Config)
224+
return icopenstack.Validate(ctx, a.Config)
224225
}
225226
if a.Config.Platform.PowerVS != nil {
226227
return icpowervs.Validate(a.Config)
@@ -230,3 +231,9 @@ func (a *InstallConfig) platformValidation() error {
230231
}
231232
return field.ErrorList{}.ToAggregate()
232233
}
234+
235+
// Generate is implemented so this asset maintains compatibility with the Asset
236+
// interface. It should never be called.
237+
func (*InstallConfig) Generate(_ asset.Parents) (err error) {
238+
panic("InstallConfig.Generate was called instead of InstallConfig.GenerateWithContext")
239+
}

pkg/asset/installconfig/installconfig_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package installconfig
22

33
import (
4+
"context"
45
"errors"
56
"os"
67
"testing"
@@ -35,7 +36,7 @@ func TestInstallConfigGenerate_FillsInDefaults(t *testing.T) {
3536
pullSecret,
3637
platform,
3738
)
38-
if err := installConfig.Generate(parents); err != nil {
39+
if err := installConfig.GenerateWithContext(context.Background(), parents); err != nil {
3940
t.Errorf("unexpected error generating install config: %v", err)
4041
}
4142
expected := &types.InstallConfig{

pkg/asset/installconfig/openstack/openstack.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package openstack
33

44
import (
5+
"context"
56
"fmt"
67
"sort"
78
"strings"
@@ -17,7 +18,7 @@ const (
1718
)
1819

1920
// Platform collects OpenStack-specific configuration.
20-
func Platform() (*openstack.Platform, error) {
21+
func Platform(ctx context.Context) (*openstack.Platform, error) {
2122
cloudNames, err := getCloudNames()
2223
if err != nil {
2324
return nil, err
@@ -46,7 +47,7 @@ func Platform() (*openstack.Platform, error) {
4647
return nil, fmt.Errorf("failed UserInput: %w", err)
4748
}
4849

49-
networkNames, err := getExternalNetworkNames(cloud)
50+
networkNames, err := getExternalNetworkNames(ctx, cloud)
5051
if err != nil {
5152
return nil, err
5253
}
@@ -80,7 +81,7 @@ func Platform() (*openstack.Platform, error) {
8081

8182
var apiFloatingIP string
8283
if extNet != "" {
83-
floatingIPs, err := getFloatingIPs(cloud, extNet)
84+
floatingIPs, err := getFloatingIPs(ctx, cloud, extNet)
8485
if err != nil {
8586
return nil, err
8687
}
@@ -106,7 +107,7 @@ func Platform() (*openstack.Platform, error) {
106107
}
107108
}
108109

109-
flavorNames, err := getFlavorNames(cloud)
110+
flavorNames, err := getFlavorNames(ctx, cloud)
110111
if err != nil {
111112
return nil, err
112113
}

pkg/asset/installconfig/openstack/session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"sync"
77

8-
"github.com/gophercloud/utils/openstack/clientconfig"
8+
"github.com/gophercloud/utils/v2/openstack/clientconfig"
99
"github.com/sirupsen/logrus"
1010
"sigs.k8s.io/yaml"
1111

pkg/asset/installconfig/openstack/validate.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package openstack
22

33
import (
4+
"context"
45
"os"
56

67
"github.com/sirupsen/logrus"
@@ -14,13 +15,13 @@ import (
1415
)
1516

1617
// Validate validates the given installconfig for OpenStack platform
17-
func Validate(ic *types.InstallConfig) error {
18+
func Validate(ctx context.Context, ic *types.InstallConfig) error {
1819
if skip := os.Getenv("OPENSHIFT_INSTALL_SKIP_PREFLIGHT_VALIDATIONS"); skip == "1" {
1920
logrus.Warnf("OVERRIDE: pre-flight validation disabled.")
2021
return nil
2122
}
2223

23-
ci, err := validation.GetCloudInfo(ic)
24+
ci, err := validation.GetCloudInfo(ctx, ic)
2425
if err != nil {
2526
return err
2627
}

0 commit comments

Comments
 (0)