-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add use_shallow_replication
field for Compute Gallery/SIG builds, fix replica count type
#337
Conversation
Maybe a config check should be added that source image/vm and image gallery replication destination region must be the same otherwise publishing will fail with an error? |
@@ -215,7 +217,7 @@ type Config struct { | |||
// The number of replicas of the Image Version to be created per region. This | |||
// property would take effect for a region when regionalReplicaCount is not specified. | |||
// Replica count must be between 1 and 100, but 50 replicas should be sufficient for most use cases. | |||
SharedGalleryImageVersionReplicaCount int32 `mapstructure:"shared_image_gallery_replica_count" required:"false"` | |||
SharedGalleryImageVersionReplicaCount int64 `mapstructure:"shared_image_gallery_replica_count" required:"false"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new SDK this value is an int64, because this was being parsed as an int32, stored in the state bag, and then in step_publish_to_shared_image_gallery
it was retrieved as an int64, this int would be incorrectly registered, leading to #341
da111e7
to
7cf0c40
Compare
@@ -4,25 +4,26 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran packer fmt on these two templates after changing fields
@maxilampert I agree that sounds like a good change, I think we should add it in a different PR though as this already changes a few things. |
@JenGoldstrich @maxilampert does this mean that in order for shallow replication to work the replication_regions attribute can not contain a region that is not the same as the source image? If so, what is the difference between using shallow replication mode and not specifying a replication at all? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. I left a few suggestions and questions about the feature. I know there is a small bug fix rolled into this change which we can break out if needed.
docs-partials/builder/azure/arm/SharedImageGalleryDestination-not-required.mdx
Outdated
Show resolved
Hide resolved
@JenGoldstrich @nywilken Yes correct source and destination must be the same and there can be no additional regions. |
a073050
to
ee73d8e
Compare
…plica count at int64 to fix it being parsed as the wrong number Fix sig replica count - use shallow replication in acc test - fix units Make generate Add tests Update docs-partials/builder/azure/arm/SharedImageGalleryDestination-not-required.mdx Co-authored-by: Wilken Rivera <dev@wilkenrivera.com> Update builder/azure/arm/step_publish_to_shared_image_gallery.go Co-authored-by: Wilken Rivera <dev@wilkenrivera.com> Implement the rest of Wilken's suggested changes Add validation, fix acceptance tests with new name for shallow replication field make generate Fix make generate Fix make generate after rebasing on main Add comments and tests
ff7d7b6
to
c5fdc78
Compare
@maxilampert so I don't think we'll need to validate that specifically because the resulting image version is determined by the build location, if the source image and the build location differ the build will fail during VM publishing As to the difference between Shallow replication & full replication to 1 region, the main difference is that images using shallow replication can not have their replication information updated after the fact, whereas full replicated images can always go update their replica counts/regions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few suggestions on the documentation and a few small nits but otherwise looks good. Approving in advance to unblock the merge when you've applied the suggestions.
Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
…bit simpler, be stricter about requiring replica count = 1 rather than > 1 for shallow replication
use_shallow_replication
field for Compute Gallery/SIG builds, fix replica count type
Adds flag to allow SIG builds to use shallow replication https://learn.microsoft.com/en-us/azure/virtual-machines/shared-image-galleries?tabs=azure-cli#shallow-replication
Fix a bug where ReplicaCount was cast as int32 then an int64 leading to the wrong value being sent to the API
Closes #313
Closes #341