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

examine nil pointer before applying backend protocol configurations #678

Merged
merged 1 commit into from
Mar 15, 2019

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Mar 12, 2019

Mitigates #675

@k8s-ci-robot k8s-ci-robot added 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. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 12, 2019
@@ -62,6 +62,10 @@ const (
// backends, the port or named port specified in the Backend Service is
// used for health checking.
UseServingPortSpecification = "USE_SERVING_PORT"

newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you mean by exiting?

@@ -62,6 +62,10 @@ const (
// backends, the port or named port specified in the Backend Service is
// used for health checking.
UseServingPortSpecification = "USE_SERVING_PORT"

newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +
Copy link
Contributor

Choose a reason for hiding this comment

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

"..caused by an application..."


newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +
"Please revert the change on application protocol to avoid this error message."
Copy link
Contributor

Choose a reason for hiding this comment

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

"...revert the change on the application..."

Choose a reason for hiding this comment

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

Suggested change
"Please revert the change on application protocol to avoid this error message."
"Please revert the change on the application's protocol to avoid this error message."

I don't have a lot of insight into how the ingress-gce works internally, but I think a TODO on handling this type of change would be helpful. I think progressing from HTTP-1.1 to HTTP-2 (soon HTTP-3) or introducing changes on the protocol to adopt a service mesh will be a common occurrence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah. Agreed. In the long run we want to support this. But currently, due to GCE api changes, it was broken. So we need to put this short term fix in place so that it can be cherry picked.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the TODO just so we remember to do it?

@@ -62,6 +62,10 @@ const (
// backends, the port or named port specified in the Backend Service is
// used for health checking.
UseServingPortSpecification = "USE_SERVING_PORT"

newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +

Choose a reason for hiding this comment

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

Suggested change
"This is usually caused by application protocol changed. " +
"This is usually caused by a change of the application's protocol." +


newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +
"Please revert the change on application protocol to avoid this error message."

Choose a reason for hiding this comment

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

Suggested change
"Please revert the change on application protocol to avoid this error message."
"Please revert the change on the application's protocol to avoid this error message."

I don't have a lot of insight into how the ingress-gce works internally, but I think a TODO on handling this type of change would be helpful. I think progressing from HTTP-1.1 to HTTP-2 (soon HTTP-3) or introducing changes on the protocol to adopt a service mesh will be a common occurrence.

@freehan
Copy link
Contributor Author

freehan commented Mar 12, 2019

fixed.

@mariantalla
Copy link

Hi, is there anything missing for this to be /lgtmed?
cc @MrHohn @thockin

@mariantalla
Copy link

Assigning for lgtm (please reassign if I've done this wrong):
/assign @MrHohn

@MrHohn
Copy link
Member

MrHohn commented Mar 14, 2019

This LGTM, but will defer to @rramkumar1 to make the final call.
/assign @rramkumar1

@@ -62,6 +62,10 @@ const (
// backends, the port or named port specified in the Backend Service is
// used for health checking.
UseServingPortSpecification = "USE_SERVING_PORT"

newHealthCheckErrorMessageTemplate = "the %v health check configuration on the existing health check %v is nil. " +
"This is usually caused by an application protocol changed. " +
Copy link
Member

Choose a reason for hiding this comment

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

can we give the name of the actual field involved, this error is a bit vague sounding. are we talking about the GCP object, the protocol used by the app itself, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HealthCheck object contains HTTPHealthCheck configurations. It has bunch of fields.

In this case, the controller thinks that HTTP2HealthCheck configuration is nil because it was not vendored.

v.HTTPHealthCheck = computealpha.HTTPHealthCheck(*hc.HttpsHealthCheck)
case annotations.ProtocolHTTP2:
if hc.Http2HealthCheck == nil {
err = fmt.Errorf(newHealthCheckErrorMessageTemplate, annotations.ProtocolHTTP2, hc.Name)
Copy link
Member

Choose a reason for hiding this comment

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

can we not return immediately (same in all case above)

@freehan
Copy link
Contributor Author

freehan commented Mar 14, 2019

Ready for next round

@@ -62,6 +62,10 @@ const (
// backends, the port or named port specified in the Backend Service is
// used for health checking.
UseServingPortSpecification = "USE_SERVING_PORT"

newHealthCheckErrorMessageTemplate = "the %v health check configurations on the existing health check %v is nil. " +
Copy link
Contributor

Choose a reason for hiding this comment

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

"the %v health check configuration..."


newHealthCheckErrorMessageTemplate = "the %v health check configuration on the exiting health check %v is nil. " +
"This is usually caused by application protocol changed. " +
"Please revert the change on application protocol to avoid this error message."
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the TODO just so we remember to do it?

@rramkumar1 rramkumar1 changed the title examine nil pointer before applying configurations examine nil pointer before applying backend protocol configurations Mar 14, 2019
@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 Mar 14, 2019
@freehan
Copy link
Contributor Author

freehan commented Mar 15, 2019

Done

@rramkumar1
Copy link
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, rramkumar1

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 d2150fc into kubernetes:master Mar 15, 2019
rramkumar1 added a commit that referenced this pull request Mar 15, 2019
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants