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

let users configure private IP of the internal LB #5332

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

nawazkh
Copy link
Member

@nawazkh nawazkh commented Dec 12, 2024

What type of PR is this?
/kind feature

What this PR does / why we need it:

  • This PR is needed for updating Tilt workflow to spin up VM based templates with custom, non-overlapping Private IPs.

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 #5264

Special notes for your reviewer:

  • This PR follows Use feature flag to create internal LB #5311 .
  • Note: This PR
    • updates defaulting webhook to create and assign a default internal IP when APIServer ILB Feature flag enabled
    • updates validation webhook to validate the internal IP when when APIServer ILB Feature flag enabled
    • updates defaulting webhook unit tests: preserves existing functionality/unit tests and adds new tests for feature flag scenarios.
    • updates validating webhook unit tests: preserves existing functionality/unit tests and adds new tests for feature flag scenarios.
    • updates apiserver ilb template with custom CIDRs
    • updates apiserver ilb windows template with custom CIDRs
    • creates ci template for api server ILB for linux nodes
    • adds e2e tests for apiserver ilb feature flag

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

feat APIServerILB: private IP of the internal LB can be customized

Sorry, something went wrong.

@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/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 12, 2024
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 12, 2024
@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

@nawazkh nawazkh added this to the v1.18 milestone Dec 12, 2024
@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 94.95798% with 6 lines in your changes missing coverage. Please review.

Project coverage is 52.59%. Comparing base (61c6f3f) to head (ded1922).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
api/v1beta1/azurecluster_default.go 85.00% 2 Missing and 1 partial ⚠️
api/v1beta1/azurecluster_validation.go 92.30% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5332      +/-   ##
==========================================
+ Coverage   52.51%   52.59%   +0.07%     
==========================================
  Files         272      272              
  Lines       29431    29489      +58     
==========================================
+ Hits        15457    15510      +53     
- Misses      13172    13176       +4     
- Partials      802      803       +1     

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

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

1 similar comment
@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test

@k8s-ci-robot
Copy link
Contributor

@nawazkh: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-azure-apiversion-upgrade
  • /test pull-cluster-api-provider-azure-build
  • /test pull-cluster-api-provider-azure-ci-entrypoint
  • /test pull-cluster-api-provider-azure-e2e
  • /test pull-cluster-api-provider-azure-e2e-aks
  • /test pull-cluster-api-provider-azure-test
  • /test pull-cluster-api-provider-azure-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-azure-apidiff
  • /test pull-cluster-api-provider-azure-apiserver-ilb
  • /test pull-cluster-api-provider-azure-capi-e2e
  • /test pull-cluster-api-provider-azure-conformance
  • /test pull-cluster-api-provider-azure-conformance-custom-builds
  • /test pull-cluster-api-provider-azure-conformance-dual-stack-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-conformance-ipv6-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-e2e-optional
  • /test pull-cluster-api-provider-azure-e2e-workload-upgrade
  • /test pull-cluster-api-provider-azure-load-test-custom-builds
  • /test pull-cluster-api-provider-azure-windows-custom-builds
  • /test pull-cluster-api-provider-azure-windows-with-ci-artifacts

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-azure-apidiff
  • pull-cluster-api-provider-azure-apiversion-upgrade
  • pull-cluster-api-provider-azure-build
  • pull-cluster-api-provider-azure-ci-entrypoint
  • pull-cluster-api-provider-azure-conformance
  • pull-cluster-api-provider-azure-conformance-custom-builds
  • pull-cluster-api-provider-azure-conformance-dual-stack-with-ci-artifacts
  • pull-cluster-api-provider-azure-conformance-ipv6-with-ci-artifacts
  • pull-cluster-api-provider-azure-conformance-with-ci-artifacts
  • pull-cluster-api-provider-azure-e2e
  • pull-cluster-api-provider-azure-e2e-aks
  • pull-cluster-api-provider-azure-test
  • pull-cluster-api-provider-azure-verify
  • pull-cluster-api-provider-azure-windows-custom-builds
  • pull-cluster-api-provider-azure-windows-with-ci-artifacts

In response to this:

/test

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-sigs/prow repository.

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

Copy link
Contributor

@willie-yao willie-yao left a comment

Choose a reason for hiding this comment

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

Wow great job on this Nawaz! Way to go getting everything to work here. Just a few comments from my end 🚀

v
+--------------------------------+
| Test Complete |
+--------------------------------+
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this comment describing what the test does! Kudos!

controlPlaneEndpointDNSName, apiServerILBPrivateIP := "", ""
for _, frontendIP := range deployedAzureCluster.Spec.NetworkSpec.APIServerLB.FrontendIPs {
if frontendIP.PublicIP != nil && frontendIP.PublicIP.DNSName != "" {
fmt.Fprintf(GinkgoWriter, "Control Plane Endpoint Name: %s\n", frontendIP.PublicIP.DNSName)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Might be good to use Logf instead of fmt.Fprintf here, as well as in the rest of the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

fmt.Fprintf(GinkgoWriter, .....) helped me log the output inline with the test.
Do you know if Logf() achieves the same ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should achieve the same and I've always used Logf to print stuff in-line. Logf under the hood is fmt.Fprintf as seen here:

fmt.Fprintf(ginkgo.GinkgoWriter, nowStamp()+": "+level+": "+format+"\n", args...)

It seems like Logf is the preferred way to print stuff in E2E tests as it prints the log level and timestamp

Copy link
Member Author

Choose a reason for hiding this comment

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

Updating

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, please take a look.

@nawazkh nawazkh force-pushed the make_ilb_ip_configurable branch from f875002 to 3720d4b Compare December 12, 2024 22:15
@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

Copy link
Contributor

@Jont828 Jont828 left a comment

Choose a reason for hiding this comment

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

LGTM pending nits and Willie's comments

@nawazkh nawazkh requested a review from willie-yao December 12, 2024 22:38
@willie-yao
Copy link
Contributor

/retest

@nawazkh nawazkh force-pushed the make_ilb_ip_configurable branch from 57e9274 to 8d20398 Compare December 12, 2024 23:33
@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

@nawazkh
Copy link
Member Author

nawazkh commented Dec 12, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

RESPONSE 400: 400 Bad Request
	ERROR CODE: PublicIPCountLimitReached
	--------------------------------------------------------------------------------
	{
	  "error": {
	    "code": "PublicIPCountLimitReached",
	    "message": "Cannot create more than 100 public IP addresses for this subscription in this region.",
	    "details": []
	  }
	}

@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

/test pull-cluster-api-provider-azure-windows-with-ci-artifacts

1 similar comment
@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

/test pull-cluster-api-provider-azure-windows-with-ci-artifacts

@nawazkh nawazkh requested a review from Jont828 December 13, 2024 06:53
- update apiserver ilb flavor with custom CIDRs
- update apiserver ilb windows flavor with custom CIDRs
- create ci template for api server ILB PR tests
- add e2e tests for apiserver ilb template
- add e2e test for a default flavored template
@nawazkh nawazkh force-pushed the make_ilb_ip_configurable branch from 8d20398 to ded1922 Compare December 13, 2024 17:06
@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

/test pull-cluster-api-provider-azure-apiversion-upgrade

@nawazkh
Copy link
Member Author

nawazkh commented Dec 13, 2024

/test pull-cluster-api-provider-azure-apiserver-ilb

Copy link
Contributor

@willie-yao willie-yao left a comment

Choose a reason for hiding this comment

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

/lgtm

Awesome work @nawazkh! This is a huge fix for CAPZ 🚀

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

LGTM label has been added.

Git tree hash: 01e0a1b10f1ce2a8a21ed6adc5e61e345918ecb1

@Jont828
Copy link
Contributor

Jont828 commented Dec 13, 2024

/approve

Nice work!

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 13, 2024
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
/approve

Ignore my comment about t.Parallel; I saw your answer to @willie-yao about the same thing. 👍

}

for _, c := range cases {
tc := c
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
Copy link
Contributor

Choose a reason for hiding this comment

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

This didn't work with t.Parallel?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jont828, mboersma

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 merged commit 736bfbc into kubernetes-sigs:main Dec 14, 2024
31 checks passed
@nawazkh nawazkh deleted the make_ilb_ip_configurable branch January 17, 2025 03:57
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/feature Categorizes issue or PR as related to a new feature. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Make internal LB IP configurable
6 participants