-
Notifications
You must be signed in to change notification settings - Fork 247
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
Avoid fetching resource config for direct resources #3840
base: master
Are you sure you want to change the base?
Avoid fetching resource config for direct resources #3840
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
/lgtm
@@ -290,15 +290,15 @@ func getQualifiedFieldName(prefix string, fieldName string) string { | |||
} | |||
|
|||
func validateImmutableFieldsForTFBasedResource(obj, oldObj *unstructured.Unstructured, spec, oldSpec map[string]interface{}, smLoader *servicemappingloader.ServiceMappingLoader, tfResourceMap map[string]*tfschema.Resource) admission.Response { | |||
isDirect := supportedgvks.IsDirectByGVK(obj.GroupVersionKind()) | |||
if isDirect && obj.GetKind() != "SQLInstance" { |
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.
Do we have test coverage to verify this change? I suggest we don't hard-code the kind in the webhook because there is no test coverage for the legacy logic here.
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 think it's ok to remove the special case for SQLInstance here. We can allow the field mutations, and report errors (if any) back from the GCP API.
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 for confirming, @jasonvigil ! Glad that we can eventually drop this hard-coded line.
@maqiuyujoyce Could you remove the code and add a test coverage to verify the change fixes the reported issue?
Change description
Fixes #3830
Tests you have done
make ready-pr
to ensure this PR is ready for review.