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

validate DNS Service IP to be a .10 IP belonging to Service CIDR #3826

Merged

Conversation

nawazkh
Copy link
Member

@nawazkh nawazkh commented Aug 10, 2023

What type of PR is this?
/kind bug

What this PR does / why we need it:

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

Special notes for your reviewer:

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

validate DNS Service IP to be a .10 IP belonging to Service CIDR

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 10, 2023
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 10, 2023
@nawazkh nawazkh changed the title validate if DNS Service IP is a .10 IP at azuremanaged control plane webhook [W.I.P]validate if DNS Service IP is a .10 IP at azuremanaged control plane webhook Aug 10, 2023
@nawazkh nawazkh added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2023
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2023
@nawazkh nawazkh force-pushed the improve_DNSServiceIP_validation branch from cbf86ed to 6dd02b1 Compare August 11, 2023 05:19
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 11, 2023
@nawazkh nawazkh force-pushed the improve_DNSServiceIP_validation branch from 6dd02b1 to 6078b79 Compare August 11, 2023 05:26
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2023
@nawazkh nawazkh removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2023
@nawazkh nawazkh changed the title [W.I.P]validate if DNS Service IP is a .10 IP at azuremanaged control plane webhook validate DNS Service IP to be a .10 IP belonging to Service CIDR Aug 11, 2023
@nawazkh nawazkh changed the title validate DNS Service IP to be a .10 IP belonging to Service CIDR validate DNS Service IP to be a .10 IP belonging to Service CIDR Aug 11, 2023
- Removed `validateDNSServiceIP()` from the validators because the
DNS Service IP validation was being done in `validateManagedClusterNetwork()`.
- update `validateManagedClusterNetwork()` to validate if DNS Service IP is a .10 IP
- update mockClient.Get to return clusterv1.Cluster with Service CIDR : `192.168.0.0/26`
- update amcp_webhook_test with valid DNS Service IPs and mock client for webhook tests
@nawazkh nawazkh force-pushed the improve_DNSServiceIP_validation branch from ac4003d to 05040f2 Compare August 11, 2023 07:13
@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Patch coverage: 88.88% and project coverage change: +0.13% 🎉

Comparison is base (a0dcdea) 54.86% compared to head (05040f2) 55.00%.
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3826      +/-   ##
==========================================
+ Coverage   54.86%   55.00%   +0.13%     
==========================================
  Files         188      188              
  Lines       19348    19348              
==========================================
+ Hits        10615    10642      +27     
+ Misses       8151     8116      -35     
- Partials      582      590       +8     
Files Changed Coverage Δ
api/v1beta1/azuremanagedcontrolplane_webhook.go 87.44% <88.88%> (+5.14%) ⬆️

... and 2 files with indirect coverage changes

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

@nawazkh
Copy link
Member Author

nawazkh commented Aug 11, 2023

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

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

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

LGTM label has been added.

Git tree hash: f325954ee37993b0ba6f9cd8d2a7b3a5f21b465f

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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 14, 2023
@k8s-ci-robot k8s-ci-robot merged commit 67d06f4 into kubernetes-sigs:main Aug 14, 2023
11 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Aug 14, 2023
@nawazkh nawazkh deleted the improve_DNSServiceIP_validation branch August 14, 2023 16:33
@nawazkh
Copy link
Member Author

nawazkh commented Aug 14, 2023

This PR should have been cherry-picked. I am not sure why the CI Robot did not cherry pick ?
@CecileRobertMichon @mboersma , I am a little confused , I am sorry, should I cherry-picking this PR into two other release branches?

@CecileRobertMichon
Copy link
Contributor

@nawazkh you need to add comment the cherry-pick bot commands on the PR for it to cherry-pick, the checkbox in PR description doesn't do anything, it's just a signal to maintainers/reviewers that they should consider it for cherry-pick

/cherry-pick release-1.10
/cherry-pick release-1.9

@k8s-infra-cherrypick-robot

@CecileRobertMichon: #3826 failed to apply on top of branch "release-1.10":

Applying: validate if DNS Service IP is a .10 IP
Using index info to reconstruct a base tree...
M	api/v1beta1/azuremachine_default_test.go
M	api/v1beta1/azuremanagedcontrolplane_webhook.go
M	api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Falling back to patching base and 3-way merge...
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook_test.go
CONFLICT (content): Merge conflict in api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook.go
Auto-merging api/v1beta1/azuremachine_default_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 validate if DNS Service IP is a .10 IP
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

@nawazkh you need to add comment the cherry-pick bot commands on the PR for it to cherry-pick, the checkbox in PR description doesn't do anything, it's just a signal to maintainers/reviewers that they should consider it for cherry-pick

/cherry-pick release-1.10
/cherry-pick release-1.9

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.

@mboersma mboersma mentioned this pull request Aug 14, 2023
4 tasks
@nawazkh
Copy link
Member Author

nawazkh commented Aug 14, 2023

it's just a signal to maintainers/reviewers that they should consider it for cherry-pick

Noted. Thanks!

@nawazkh
Copy link
Member Author

nawazkh commented Aug 14, 2023

/cherry-pick release-1.9

@k8s-infra-cherrypick-robot

@nawazkh: #3826 failed to apply on top of branch "release-1.9":

Applying: validate if DNS Service IP is a .10 IP
Using index info to reconstruct a base tree...
M	api/v1beta1/azuremachine_default_test.go
M	api/v1beta1/azuremanagedcontrolplane_webhook.go
M	api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Falling back to patching base and 3-way merge...
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook_test.go
CONFLICT (content): Merge conflict in api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook.go
Auto-merging api/v1beta1/azuremachine_default_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 validate if DNS Service IP is a .10 IP
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.9

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.

@nawazkh
Copy link
Member Author

nawazkh commented Aug 14, 2023

Merge conflicts in creating both the cherry-picks.. 🤔 Strange.
I will manually create the PRs in a bit.

@nawazkh
Copy link
Member Author

nawazkh commented Aug 14, 2023

^ raised two cherry-pick PRs

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

A DNS Service IP should be a .10 IP address belonging to the Service CIDR
5 participants