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

feat: support Health Check in BackendTrafficPolicy #2244

Merged
merged 10 commits into from
Jan 6, 2024

Conversation

lemonlinger
Copy link
Contributor

What type of PR is this?

What this PR does / why we need it:

This PR introduces active health checking to BackendTrafficPolicy, supporting 3 types of health checkers: HTTP, gRPC, and TCP.

Which issue(s) this PR fixes:

relates to #2126

@lemonlinger lemonlinger requested a review from a team as a code owner November 27, 2023 07:36
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 136 lines in your changes are missing coverage. Please review.

Comparison is base (caf2ddb) 64.64% compared to head (06973fe) 64.60%.

Files Patch % Lines
internal/ir/zz_generated.deepcopy.go 0.00% 105 Missing and 1 partial ⚠️
internal/gatewayapi/backendtrafficpolicy.go 83.56% 8 Missing and 4 partials ⚠️
internal/ir/xds.go 90.72% 7 Missing and 2 partials ⚠️
internal/xds/translator/cluster.go 88.46% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2244      +/-   ##
==========================================
- Coverage   64.64%   64.60%   -0.04%     
==========================================
  Files         115      115              
  Lines       16844    17199     +355     
==========================================
+ Hits        10888    11112     +224     
- Misses       5260     5382     +122     
- Partials      696      705       +9     

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

Copy link
Contributor

@shawnh2 shawnh2 left a comment

Choose a reason for hiding this comment

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

thanks @lemonlinger , it's better to add some e2e test and user facing doc in the following PR.

api/v1alpha1/healthcheck_types.go Outdated Show resolved Hide resolved
api/v1alpha1/healthcheck_types.go Outdated Show resolved Hide resolved
internal/xds/translator/cluster.go Outdated Show resolved Hide resolved
internal/ir/xds.go Outdated Show resolved Hide resolved
// +kubebuilder:validation:Minimum=1
HealthyThreshold uint32 `json:"healthyThreshold"`

// HealthChecker defines the concrete health checker to do health checking.
Copy link
Contributor

Choose a reason for hiding this comment

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

we need a better name here, it currently looks like

healthCheck:
  healthChecker:
  .....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about checker ?

healthCheck:
  checker:

Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on endpoint ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel a little bit confused. Any thoughts from others?

Copy link
Member

Choose a reason for hiding this comment

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

PTAL #1821 the healthChecking part as a reference

Copy link
Contributor

Choose a reason for hiding this comment

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

how about removing healthChecking and copying the fields directly into top level struct ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about this ?

  healthChecking: # optional
      connectionTimeout: duration # optional
      healthyCheckInterval: duration # optional, default=5s
      unhealthyCheckInterval: duration, # optional, default=10s
      unhealthyThreshold: int # optional, default=3
      healthyThreshold: int # optional, default=1
      type: Enum (grpc/http)
      grpc: # required when type=grpc
        upstreamName: string # required
        authority: string # optional
      http: # required when type=http
        expectedStatuses: # required, minItems=1
        - min: int # min=100, max=599
           max: int # min=100, max=599
        path: string # optional
        hostname: string # optional

Copy link
Contributor

Choose a reason for hiding this comment

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

yup looking good !

  • prefer "healthCheck" as the top level noun
  • lets only support tcp and http for now, and add support for grpc later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

inline heathChecker to heathCheck and remove grpc checker.

done

Method string `json:"method,omitempty" yaml:"method,omitempty"`
// ExpectedStatuses defines a list of HTTP response statuses considered healthy.
// +optional
ExpectedStatuses []Int64Range `json:"expectedStatuses,omitempty" yaml:"expectedStatuses,omitempty"`
Copy link
Contributor

@arkodg arkodg Nov 27, 2023

Choose a reason for hiding this comment

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

range doesnt seem like the common case for me, prefer a list of ints e.g. []int{200, 201}
curious what others think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to me that using range provides more clarity and understanding compared to an array of integers.

Copy link
Contributor

@shawnh2 shawnh2 Dec 4, 2023

Choose a reason for hiding this comment

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

+1 for @lemonlinger, since an arrry of intergers will introduce length check, not a fun

this design is also corresponding to https://www.envoyproxy.io/docs/envoy/latest/api-v3/type/v3/range.proto#envoy-v3-api-msg-type-v3-int64range

@Xunzhuo
Copy link
Member

Xunzhuo commented Nov 30, 2023

/retest

@lemonlinger
Copy link
Contributor Author

lemonlinger commented Dec 2, 2023

thanks @lemonlinger , it's better to add some e2e test and user facing doc in the following PR.

Sure, will do.

@lemonlinger lemonlinger force-pushed the feature/health-check branch 2 times, most recently from 2c7203a to bb329db Compare December 2, 2023 13:58
@lemonlinger
Copy link
Contributor Author

/retest

1 similar comment
@lemonlinger
Copy link
Contributor Author

/retest

Copy link
Member

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

Great work @lemonlinger, will start reviewing this week.

@lemonlinger
Copy link
Contributor Author

/retest

@Xunzhuo
Copy link
Member

Xunzhuo commented Dec 6, 2023

Hey @AliceProxy, would you like to take a review on this ?

@zirain
Copy link
Contributor

zirain commented Dec 6, 2023

/retest

1 similar comment
@lemonlinger
Copy link
Contributor Author

/retest

@github-actions github-actions bot temporarily deployed to pull request December 8, 2023 06:26 Inactive
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
@lemonlinger lemonlinger force-pushed the feature/health-check branch 2 times, most recently from cffba8b to a431627 Compare December 25, 2023 10:17
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
@lemonlinger
Copy link
Contributor Author

/retest

@arkodg
Copy link
Contributor

arkodg commented Jan 4, 2024

@lemonlinger can you address the comments ?

@lemonlinger
Copy link
Contributor Author

@lemonlinger can you address the comments ?

Sure thing. I'll get it done today.

Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Signed-off-by: lemonlinger <lemonlinger@gmail.com>
Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !
can you also raise a separate GH issue for E2E and docs

@arkodg arkodg requested review from shawnh2, Xunzhuo and a team January 5, 2024 22:25
@Xunzhuo Xunzhuo merged commit fb67037 into envoyproxy:main Jan 6, 2024
20 checks passed
@lemonlinger
Copy link
Contributor Author

LGTM thanks !

can you also raise a separate GH issue for E2E and docs

Sure thing.

@lemonlinger lemonlinger deleted the feature/health-check branch January 7, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants