|
5 | 5 | "fmt" |
6 | 6 | "math/rand" |
7 | 7 | "net/http" |
| 8 | + "os" |
8 | 9 | "strings" |
9 | 10 | "time" |
10 | 11 |
|
@@ -239,105 +240,107 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput |
239 | 240 | logrus.Debugf("BlobContainer.ID=%s", *blobContainer.ID) |
240 | 241 |
|
241 | 242 | // Upload the image to the container |
242 | | - _, err = CreatePageBlob(ctx, &CreatePageBlobInput{ |
243 | | - StorageURL: storageURL, |
244 | | - BlobURL: blobURL, |
245 | | - ImageURL: imageURL, |
246 | | - ImageLength: imageLength, |
247 | | - StorageAccountName: storageAccountName, |
248 | | - StorageAccountKeys: storageAccountKeys, |
249 | | - CloudConfiguration: cloudConfiguration, |
250 | | - }) |
251 | | - if err != nil { |
252 | | - return err |
253 | | - } |
254 | | - |
255 | | - // Create image gallery |
256 | | - createImageGalleryOutput, err := CreateImageGallery(ctx, &CreateImageGalleryInput{ |
257 | | - SubscriptionID: subscriptionID, |
258 | | - ResourceGroupName: resourceGroupName, |
259 | | - GalleryName: galleryName, |
260 | | - Region: platform.Region, |
261 | | - Tags: tags, |
262 | | - TokenCredential: tokenCredential, |
263 | | - CloudConfiguration: cloudConfiguration, |
264 | | - }) |
265 | | - if err != nil { |
266 | | - return err |
267 | | - } |
| 243 | + if _, ok := os.LookupEnv("OPENSHIFT_INSTALL_SKIP_IMAGE_UPLOAD"); !ok { |
| 244 | + _, err = CreatePageBlob(ctx, &CreatePageBlobInput{ |
| 245 | + StorageURL: storageURL, |
| 246 | + BlobURL: blobURL, |
| 247 | + ImageURL: imageURL, |
| 248 | + ImageLength: imageLength, |
| 249 | + StorageAccountName: storageAccountName, |
| 250 | + StorageAccountKeys: storageAccountKeys, |
| 251 | + CloudConfiguration: cloudConfiguration, |
| 252 | + }) |
| 253 | + if err != nil { |
| 254 | + return err |
| 255 | + } |
268 | 256 |
|
269 | | - computeClientFactory := createImageGalleryOutput.ComputeClientFactory |
| 257 | + // Create image gallery |
| 258 | + createImageGalleryOutput, err := CreateImageGallery(ctx, &CreateImageGalleryInput{ |
| 259 | + SubscriptionID: subscriptionID, |
| 260 | + ResourceGroupName: resourceGroupName, |
| 261 | + GalleryName: galleryName, |
| 262 | + Region: platform.Region, |
| 263 | + Tags: tags, |
| 264 | + TokenCredential: tokenCredential, |
| 265 | + CloudConfiguration: cloudConfiguration, |
| 266 | + }) |
| 267 | + if err != nil { |
| 268 | + return err |
| 269 | + } |
270 | 270 |
|
271 | | - // Create gallery images |
272 | | - _, err = CreateGalleryImage(ctx, &CreateGalleryImageInput{ |
273 | | - ResourceGroupName: resourceGroupName, |
274 | | - GalleryName: galleryName, |
275 | | - GalleryImageName: galleryImageName, |
276 | | - Region: platform.Region, |
277 | | - Tags: tags, |
278 | | - TokenCredential: tokenCredential, |
279 | | - CloudConfiguration: cloudConfiguration, |
280 | | - OSType: armcompute.OperatingSystemTypesLinux, |
281 | | - OSState: armcompute.OperatingSystemStateTypesGeneralized, |
282 | | - HyperVGeneration: armcompute.HyperVGenerationV1, |
283 | | - Publisher: "RedHat", |
284 | | - Offer: "rhcos", |
285 | | - SKU: "basic", |
286 | | - ComputeClientFactory: computeClientFactory, |
287 | | - }) |
288 | | - if err != nil { |
289 | | - return err |
290 | | - } |
| 271 | + computeClientFactory := createImageGalleryOutput.ComputeClientFactory |
| 272 | + |
| 273 | + // Create gallery images |
| 274 | + _, err = CreateGalleryImage(ctx, &CreateGalleryImageInput{ |
| 275 | + ResourceGroupName: resourceGroupName, |
| 276 | + GalleryName: galleryName, |
| 277 | + GalleryImageName: galleryImageName, |
| 278 | + Region: platform.Region, |
| 279 | + Tags: tags, |
| 280 | + TokenCredential: tokenCredential, |
| 281 | + CloudConfiguration: cloudConfiguration, |
| 282 | + OSType: armcompute.OperatingSystemTypesLinux, |
| 283 | + OSState: armcompute.OperatingSystemStateTypesGeneralized, |
| 284 | + HyperVGeneration: armcompute.HyperVGenerationV1, |
| 285 | + Publisher: "RedHat", |
| 286 | + Offer: "rhcos", |
| 287 | + SKU: "basic", |
| 288 | + ComputeClientFactory: computeClientFactory, |
| 289 | + }) |
| 290 | + if err != nil { |
| 291 | + return err |
| 292 | + } |
291 | 293 |
|
292 | | - _, err = CreateGalleryImage(ctx, &CreateGalleryImageInput{ |
293 | | - ResourceGroupName: resourceGroupName, |
294 | | - GalleryName: galleryName, |
295 | | - GalleryImageName: galleryGen2ImageName, |
296 | | - Region: platform.Region, |
297 | | - Tags: tags, |
298 | | - TokenCredential: tokenCredential, |
299 | | - CloudConfiguration: cloudConfiguration, |
300 | | - OSType: armcompute.OperatingSystemTypesLinux, |
301 | | - OSState: armcompute.OperatingSystemStateTypesGeneralized, |
302 | | - HyperVGeneration: armcompute.HyperVGenerationV1, |
303 | | - Publisher: "RedHat-gen2", |
304 | | - Offer: "rhcos-gen2", |
305 | | - SKU: "gen2", |
306 | | - ComputeClientFactory: computeClientFactory, |
307 | | - }) |
308 | | - if err != nil { |
309 | | - return err |
310 | | - } |
| 294 | + _, err = CreateGalleryImage(ctx, &CreateGalleryImageInput{ |
| 295 | + ResourceGroupName: resourceGroupName, |
| 296 | + GalleryName: galleryName, |
| 297 | + GalleryImageName: galleryGen2ImageName, |
| 298 | + Region: platform.Region, |
| 299 | + Tags: tags, |
| 300 | + TokenCredential: tokenCredential, |
| 301 | + CloudConfiguration: cloudConfiguration, |
| 302 | + OSType: armcompute.OperatingSystemTypesLinux, |
| 303 | + OSState: armcompute.OperatingSystemStateTypesGeneralized, |
| 304 | + HyperVGeneration: armcompute.HyperVGenerationV1, |
| 305 | + Publisher: "RedHat-gen2", |
| 306 | + Offer: "rhcos-gen2", |
| 307 | + SKU: "gen2", |
| 308 | + ComputeClientFactory: computeClientFactory, |
| 309 | + }) |
| 310 | + if err != nil { |
| 311 | + return err |
| 312 | + } |
311 | 313 |
|
312 | | - // Create gallery image versions |
313 | | - _, err = CreateGalleryImageVersion(ctx, &CreateGalleryImageVersionInput{ |
314 | | - ResourceGroupName: resourceGroupName, |
315 | | - StorageAccountID: *storageAccount.ID, |
316 | | - GalleryName: galleryName, |
317 | | - GalleryImageName: galleryImageName, |
318 | | - GalleryImageVersionName: galleryImageVersionName, |
319 | | - Region: platform.Region, |
320 | | - BlobURL: blobURL, |
321 | | - RegionalReplicaCount: int32(1), |
322 | | - ComputeClientFactory: computeClientFactory, |
323 | | - }) |
324 | | - if err != nil { |
325 | | - return err |
326 | | - } |
| 314 | + // Create gallery image versions |
| 315 | + _, err = CreateGalleryImageVersion(ctx, &CreateGalleryImageVersionInput{ |
| 316 | + ResourceGroupName: resourceGroupName, |
| 317 | + StorageAccountID: *storageAccount.ID, |
| 318 | + GalleryName: galleryName, |
| 319 | + GalleryImageName: galleryImageName, |
| 320 | + GalleryImageVersionName: galleryImageVersionName, |
| 321 | + Region: platform.Region, |
| 322 | + BlobURL: blobURL, |
| 323 | + RegionalReplicaCount: int32(1), |
| 324 | + ComputeClientFactory: computeClientFactory, |
| 325 | + }) |
| 326 | + if err != nil { |
| 327 | + return err |
| 328 | + } |
327 | 329 |
|
328 | | - _, err = CreateGalleryImageVersion(ctx, &CreateGalleryImageVersionInput{ |
329 | | - ResourceGroupName: resourceGroupName, |
330 | | - StorageAccountID: *storageAccount.ID, |
331 | | - GalleryName: galleryName, |
332 | | - GalleryImageName: galleryGen2ImageName, |
333 | | - GalleryImageVersionName: galleryGen2ImageVersionName, |
334 | | - Region: platform.Region, |
335 | | - BlobURL: blobURL, |
336 | | - RegionalReplicaCount: int32(1), |
337 | | - ComputeClientFactory: computeClientFactory, |
338 | | - }) |
339 | | - if err != nil { |
340 | | - return err |
| 330 | + _, err = CreateGalleryImageVersion(ctx, &CreateGalleryImageVersionInput{ |
| 331 | + ResourceGroupName: resourceGroupName, |
| 332 | + StorageAccountID: *storageAccount.ID, |
| 333 | + GalleryName: galleryName, |
| 334 | + GalleryImageName: galleryGen2ImageName, |
| 335 | + GalleryImageVersionName: galleryGen2ImageVersionName, |
| 336 | + Region: platform.Region, |
| 337 | + BlobURL: blobURL, |
| 338 | + RegionalReplicaCount: int32(1), |
| 339 | + ComputeClientFactory: computeClientFactory, |
| 340 | + }) |
| 341 | + if err != nil { |
| 342 | + return err |
| 343 | + } |
341 | 344 | } |
342 | 345 |
|
343 | 346 | networkClientFactory, err := armnetwork.NewClientFactory(subscriptionID, session.TokenCreds, |
|
0 commit comments