Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maqiuyujoyce
Copy link
Collaborator

Change description

Fixes #3830

Tests you have done

  • [N/A] Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from maqiuyujoyce. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@maqiuyujoyce maqiuyujoyce changed the title Avoid fetch resource config for direct resources Avoid fetching resource config for direct resources Mar 4, 2025
Copy link
Collaborator

@jingyih jingyih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Mar 4, 2025
@@ -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" {
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag 1.129.2 breaks PrivilegedAccessManagerEntitlement reconciliation
4 participants