Skip to content

Commit 45d9bb8

Browse files
committed
Change AzureCluster Webhook Validation for Shared & Compute Gallery
1 parent 8c6bd5f commit 45d9bb8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

api/v1beta1/azureimage_validation.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,21 @@ func validateSingleDetailsOnly(image *Image, fldPath *field.Path) field.ErrorLis
6464
}
6565

6666
// TODO: VISHU
67-
// Commenting this out since after CAPZ upgrade to v1.18.0, palette will be using both ComputeGallery & Shared Gallery
68-
// to support palette version upgrade and not cause node repave.
69-
// This function was causing to either allow one of them.
70-
//if image.SharedGallery != nil {
71-
// if imageDetailsFound {
72-
// allErrs = append(allErrs, field.Forbidden(fldPath.Child("SharedGallery"), "SharedGallery cannot be used as an image ID. Marketplace or ComputeGallery images has been specified"))
73-
// } else {
74-
// imageDetailsFound = true
75-
// }
76-
//}
77-
67+
// After CAPZ upgrade to v1.18.0, palette will be using both ComputeGallery & Shared Gallery.
68+
// The validation here has been modified to support both palette version upgrade while not causing node repave and to also support new cluster creations & new worker pool creations.
69+
// This can reverted back to the original validation once all clusters from palette have been upgraded.
7870
if image.ComputeGallery != nil {
7971
if imageDetailsFound {
8072
allErrs = append(allErrs, field.Forbidden(fldPath.Child("ComputeGallery"), "ComputeGallery cannot be used as an image ID. Marketplace or SharedGallery images has been specified"))
8173
} else {
8274
imageDetailsFound = true
8375
}
76+
} else if image.SharedGallery != nil {
77+
if imageDetailsFound {
78+
allErrs = append(allErrs, field.Forbidden(fldPath.Child("SharedGallery"), "SharedGallery cannot be used as an image ID. Marketplace or ComputeGallery images has been specified"))
79+
} else {
80+
imageDetailsFound = true
81+
}
8482
}
8583

8684
if !imageDetailsFound {

0 commit comments

Comments
 (0)