-
Notifications
You must be signed in to change notification settings - Fork 74
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
Switch to the new API for marking as required
the fields for some resources
#490
Switch to the new API for marking as required
the fields for some resources
#490
Conversation
Signed-off-by: Sergen Yalçın <[email protected]>
/test-examples="examples/compute/instance.yaml" |
/test-examples="examples/compute/instancegroup.yaml" |
/test-examples="examples/cloudscheduler/job.yaml" |
/test-examples="examples/composer/environment.yaml" |
/test-examples="examples/compute/autoscaler.yaml" |
/test-examples="examples/compute/resourcepolicy.yaml" |
/test-examples="examples/datacatalog/entrygroup.yaml" |
/test-examples="examples/compute/networkendpointgroup.yaml" |
/test-examples="examples/compute/regionautoscaler.yaml" |
/test-examples="examples/compute/regioninstancegroupmanager.yaml" |
/test-examples="examples/compute/targetpool.yaml" |
…ix the example manifest of Environment.composer Signed-off-by: Sergen Yalçın <[email protected]>
/test-examples="examples/composer/environment.yaml" |
/test-examples="examples/compute/autoscaler.yaml" |
Signed-off-by: Sergen Yalçın <[email protected]>
4097229
to
b9c3ab8
Compare
@@ -399,10 +399,6 @@ func Configure(p *config.Provider) { //nolint: gocyclo | |||
config.MarkAsRequired(r.TerraformResource, "region") | |||
}) | |||
|
|||
p.AddResourceConfigurator("google_compute_region_per_instance_config", func(r *config.Resource) { |
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.
Does this resource no longer exist? Is this unnecessary?
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 deleted this statement because this configuration does not have an effect. The region
field is generated as a Reference
field, and we mark the reference fields as Optional
regardless of their status in the scheme. Also, as can be seen, even though the configuration was deleted, no diff occurred after generation. This shows that this configuration block has no function.
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.
Thank you for the explanation.
@@ -13,9 +13,3 @@ metadata: | |||
spec: | |||
forProvider: | |||
region: us-east1 | |||
config: |
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.
Why did we have to remove this configuration?
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 checked the registry documentation, and this usage is no longer valid. Also, there was a basic usage in the example of registry. I changed this example to a basic one to avoid leading the user to the view that the config block is required. In this context, we can consider providing different example manifests for different purposes and use cases, which we discussed before.
When the relevant configuration is used in this form, error messages related to the cloud provider's own version change are seen. This points to a behavioral change in the cloud provider for the relevant resource. The relevant behavior change is not mentioned in the underlying provider documentation. In this context, we cannot rely on the relevant documentation to detect such behavioral changes in future underlying provider version updates. However, it may be possible to try to detect changes in the underlying provider's dependency on cloud providers.
Hi @sergenyalcin, |
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.
Thanks @sergenyalcin, lgtm.
Backport failed for Please cherry-pick the changes locally. git fetch origin release-1.0
git worktree add -d .worktree/backport-490-to-release-1.0 origin/release-1.0
cd .worktree/backport-490-to-release-1.0
git checkout -b backport-490-to-release-1.0
ancref=$(git merge-base be3db998f3d0479f02d24e2b10e3a6ef1ea45394 b9c3ab8a6b920162b31f7b039a734fc58e35dae2)
git cherry-pick -x $ancref..b9c3ab8a6b920162b31f7b039a734fc58e35dae2 |
Description of your changes
This PR switches to the new API for
marking as required
the fields. The new API will mark as required the fields during the generation without any native resource schema change. For mor details of this new API please see this PR. The base strategies we decided in this PR:config.MarkAsRequired
still modifies the native schema (no change in its implementation) but it's now deprecated in favor ofconfig.Resource.MarkAsRequired
.Fixes #472
The root cause of #472 is native schema change of the
zone
andregion
field. The newCustomizeDiff
functions of the underlying provider, DefaultProviderRegion and DefaultProviderZone, checks theComputed
fields of the resource schemas and gives some decisions according to the values. At this point, because of manipulating the resource schema (what we must not do), we observe this issue. By this change, we will revert the schema changes for the affected resources. The affected resources were determined according to the two following rules:MarkAsRequired
forzone
orregion
fields.CustomizeDiff
functions.Switched to the new API for the following resources:
Environment.composer
Job.cloudscheduler
Autoscaler.compute
Instance.compute
InstanceGroup.compute
InstanceGroupManager.compute
NetworkEndpointGroup.compute
ResourcePolicy.compute
TargetPool.compute
RegionInstanceGroupManager.compute
RegionAutoScaler.compute
ServiceAttachment.compute
EntryGroup.datacatalog
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Instance.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8343310426Job.cloudscheduler
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8343708323InstanceGroup.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8343704491ResourcePolicy.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8343851010EntryGroup.datacatalog
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8343873861RegionAutoScaler.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8344124389NetworkEndpointGroup.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8344103249RegionInstanceGroupManager.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8344548614ServiceAttachment.compute
: Manually (because of manual intervention need)TargetPool.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8344649274Autoscaler.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8345034404InstanceGroupManager.compute
: https://github.com/crossplane-contrib/provider-upjet-gcp/actions/runs/8345034404Environment.composer
: Manually (because of service account permission issues)