-
Notifications
You must be signed in to change notification settings - Fork 89
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 a new configuration option for required field generation #381
Add a new configuration option for required field generation #381
Conversation
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
811aab6
to
bdfbe67
Compare
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, left some comments for you to consider.
…iredFields - Deprecate config.MarkAsRequired in favor of a new configuration function on *config.Resource that still accepts a slice to mark multiple fields as required without doing and invervention in native field schema. Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
fb16c91
to
f25329f
Compare
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
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.
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
The tests in GCP are successful: crossplane-contrib/provider-upjet-gcp#490 (comment) |
Successfully created backport PR #383 for |
Description of your changes
This PR adds a new configuration option for required field generation. The name of this new configuration API is
RequiredFields
and it is included to theResource
.This change aims to generate fields as
Required
when needed, without interfering with the underlying provider schema. Before, for generating a field asRequired
, we used the MarkAsRequired function. This function directly intervenes in the schema and sets theComputed
andOptional
values of the relevant field equal tofalse
. Schema interventions may have the power to directly affect the internal operations of the underlying provider. This may lead to unexpected behavioral changes. We recently observed the mentioned situation in this issue.In this issue, it was observed that the behavior of resources that schema was intervened (using
MarkAsRequired
) changed after the underlying provider version bump, directly related to this schema intervention. This behavioral change directly blocks the provisioning of resources and even causes existing resources beunsynced
. This reveals the extent of the dangers of schema interventions.Of course, there are such needs for generation. However, such needs can be solved without schema intervention. This change paves the way for a field that is not required in the underlying provider schema to be generated as 'Required', with a high-level configuration API, without any schema intervention.
This PR also proposes the deprecation of
MarkAsRequired
API.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
Tested generation in provider-gcp by removing MarkAsRequired and adding the following configuration: