-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Convert error messages to use event recorder #83934
Conversation
Hi @wccsama. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
@@ -559,20 +559,21 @@ func getPortsForLB(service *v1.Service) ([]*v1.ServicePort, error) { | |||
if protocol == "" { | |||
protocol = sp.Protocol | |||
} else if protocol != sp.Protocol && wantsLoadBalancer(service) { | |||
// TODO: Convert error messages to use event recorder | |||
return nil, fmt.Errorf("mixed protocol external load balancers are not supported") | |||
s.eventRecorder.Eventf(service, v1.EventTypeWarning, "mixed protocol external load balancers are not supported", |
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.
This is a strange place to do validation like this (this function is only triggered when comparing an updated service object). Also, on the above it says the cloud provider itself is responsible for the protocol validation. Why don't we remove the validation here and delegate EnsureLoadBalancer()
for doing the check of mixed protocol?
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.
Yeah~, mixed protocol may be checked in the function EnsureLoadBalancer() in a future version.
/retest |
/assign @MrHohn Should I remove the validation, or just print err message like this pr. |
@wccsama I would suggest removing the check completely so that kubernetes/pkg/apis/core/validation/validation.go Lines 3998 to 4012 in 3698100
|
/retest |
@MrHohn Done, PTAL thanks~ |
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.
/approve
} | ||
|
||
func portsEqualForLB(x, y *v1.Service) bool { | ||
xPorts, err := getPortsForLB(x) | ||
if err != nil { | ||
xPorts := getPortsForLB(x) |
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.
Seems like we don't need to check nil?
xPorts := getPortsForLB(x)
yPorts := getPortsForLB(y)
return portSlicesEqualForLB(xPorts, yPorts)
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.
yeah~
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrHohn, wccsama 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 |
This LGTM, can you squash the fix-up commits? |
remove mix protocol validation remove check nil
62e31f2
to
18cf49e
Compare
@MrHohn already fixed~ |
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!
/lgtm
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: