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

fix privateendpoints panic and diff #4014

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

nojnhuh
Copy link
Contributor

@nojnhuh nojnhuh commented Sep 19, 2023

What type of PR is this?
/kind bug

What this PR does / why we need it:

This PR fixes four neighboring issues with how private endpoints are constructed:

  1. The Azure API does not populate properties.subnet.properties when GET-ing an existing private endpoints resource, which was assumed to be populated and would cause CAPZ to panic (Creating a cluster with a privateLink (ACR) will lead capz-controller-manager to crash loop on AzureCluster reconcile #4013)
  2. The Azure API populates properties.customNetworkInterfaceName as the non-nil empty string "" in GETs after passing nil in an initial PUT. This was causing the Parameters method to always log a diff (but not reconcile forever since CreateOrUpdateAsync was finishing more-or-less immediately and successfully).
  3. Similarly, the Azure API populates properties.ipConfigurations as the non-nil empty array [] in GETs when created as nil, causing the same issue as 2.
  4. The inverse of 2. and 3. but causing the same issue, the Azure API nulls out properties.applicationSecurityGroups when created as the non-nil empty array [].

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #4013

Special notes for your reviewer:

  • cherry-pick candidate

/cherry-pick release-1.11

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Fix panic when reconciling private endpoints resources

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Sep 19, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 19, 2023
@nojnhuh
Copy link
Contributor Author

nojnhuh commented Sep 19, 2023

/cherry-pick release-1.11

@k8s-infra-cherrypick-robot

@nojnhuh: once the present PR merges, I will cherry-pick it on top of release-1.11 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Patch coverage: 78.94% and project coverage change: -0.02% ⚠️

Comparison is base (e21844c) 56.59% compared to head (8e3bcea) 56.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4014      +/-   ##
==========================================
- Coverage   56.59%   56.57%   -0.02%     
==========================================
  Files         187      187              
  Lines       19124    19126       +2     
==========================================
- Hits        10823    10821       -2     
- Misses       7671     7674       +3     
- Partials      630      631       +1     
Files Changed Coverage Δ
azure/services/privateendpoints/spec.go 85.11% <78.94%> (-2.24%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nawazkh
Copy link
Member

nawazkh commented Sep 19, 2023

🚀
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 5d2a78c6b486b03bd3dce4e2a3d83f2c9de823a6

@nawazkh
Copy link
Member

nawazkh commented Sep 19, 2023

Just curious, could we add a guardrail to this scenario via e2e tests?

@nojnhuh
Copy link
Contributor Author

nojnhuh commented Sep 19, 2023

Just curious, could we add a guardrail to this scenario via e2e tests?

I suppose we could add at least one private endpoint somewhere in the e2e templates, but I'm not exactly sure where that would fit best or what we could really have it link to.

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm
/test pull-cluster-api-provider-azure-e2e-optional

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold in case we want to contemplate adding an e2e test

if not an e2e test, is there a specific unit test that could validate the scenarios described in the PR description?

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 19, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2023
@nojnhuh
Copy link
Contributor Author

nojnhuh commented Sep 19, 2023

if not an e2e test, is there a specific unit test that could validate the scenarios described in the PR description?

I already updated the unit tests to account for the first 3 issues I listed above. Just pushed a change to cover the fourth.

@nojnhuh nojnhuh force-pushed the privateendpoints-fix branch from 70f7456 to 8e3bcea Compare September 19, 2023 23:50
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2023
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/hold cancel
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Sep 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 1c4cfea85a68cb48e3f743b6ad81aeef4f8da9bc

@k8s-ci-robot k8s-ci-robot merged commit 2e333aa into kubernetes-sigs:main Sep 20, 2023
@k8s-infra-cherrypick-robot

@nojnhuh: new pull request created: #4015

In response to this:

/cherry-pick release-1.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nojnhuh nojnhuh deleted the privateendpoints-fix branch September 20, 2023 01:33
@nojnhuh nojnhuh added this to the v1.12 milestone Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
6 participants