Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/v1alpha1/healthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ type ActiveHealthCheck struct {
// from the main service configuration.
// +optional
Overrides *HealthCheckOverrides `json:"overrides,omitempty" yaml:"overrides,omitempty"`

// IgnoreNewHostsUntilFirstHealthCheck prevents newly added hosts
// from receiving traffic until they pass their first health check.
//
// This maps to Envoy's common_lb_config.ignore_new_hosts_until_first_hc.
// +optional
IgnoreNewHostsUntilFirstHealthCheck *bool `json:"ignoreNewHostsUntilFirstHealthCheck,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any thoughts on a better name here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks for the suggestion!

I kept the name aligned with Envoy's field ignore_new_hosts_until_first_hc for clarity and easier mapping.

That said, I agree it might be a bit verbose. I'm open to renaming if you have a preferred convention (e.g., shorter or more user-friendly).

Happy to update based on your suggestion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hey @jukie , any further updated regarding this PR , how can i imorove the naming here

}

// ActiveHealthCheckerType is the type of health checker.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,8 @@ func buildActiveHealthCheck(policy egv1a1.HealthCheck) *ir.ActiveHealthCheck {
irHC.Overrides = buildHealthCheckOverrides(hc.Overrides)
}

irHC.IgnoreNewHostsUntilFirstHealthCheck = hc.IgnoreNewHostsUntilFirstHealthCheck

return irHC
}

Expand Down
3 changes: 3 additions & 0 deletions internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -3012,6 +3012,9 @@ type ActiveHealthCheck struct {
// Overrides defines the configuration of the overriding health check settings for all endpoints
// in the backend cluster.
Overrides *HealthCheckOverrides `json:"overrides,omitempty" yaml:"overrides,omitempty"`
// IgnoreNewHostsUntilFirstHealthCheck prevents newly added hosts
// from receiving traffic until they pass their first health check.
IgnoreNewHostsUntilFirstHealthCheck *bool
}

func (h *HealthCheck) SetHTTPHostIfAbsent(host string) {
Expand Down
9 changes: 9 additions & 0 deletions internal/xds/translator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,15 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) {
cluster.HealthChecks = buildXdsHealthCheck(args.healthCheck.Active)
}

// Apply ignore_new_hosts_until_first_hc if configured
if args.healthCheck != nil &&
args.healthCheck.Active != nil &&
args.healthCheck.Active.IgnoreNewHostsUntilFirstHealthCheck != nil {

cluster.CommonLbConfig.IgnoreNewHostsUntilFirstHc =
*args.healthCheck.Active.IgnoreNewHostsUntilFirstHealthCheck
}

if args.healthCheck != nil && args.healthCheck.Passive != nil {
cluster.OutlierDetection = buildXdsOutlierDetection(args.healthCheck.Passive)
}
Expand Down
1 change: 1 addition & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ _Appears in:_
| `tcp` | _[TCPActiveHealthChecker](#tcpactivehealthchecker)_ | false | | TCP defines the configuration of tcp health checker.<br />It's required while the health checker type is TCP. |
| `grpc` | _[GRPCActiveHealthChecker](#grpcactivehealthchecker)_ | false | | GRPC defines the configuration of the GRPC health checker.<br />It's optional, and can only be used if the specified type is GRPC. |
| `overrides` | _[HealthCheckOverrides](#healthcheckoverrides)_ | false | | Overrides defines the configuration of the overriding health check settings for all endpoints<br />in the backend cluster. This allows customization of port and other settings that may differ<br />from the main service configuration. |
| `ignoreNewHostsUntilFirstHealthCheck` | _boolean_ | false | | IgnoreNewHostsUntilFirstHealthCheck prevents newly added hosts<br />from receiving traffic until they pass their first health check.<br />This maps to Envoy's common_lb_config.ignore_new_hosts_until_first_hc. |


#### ActiveHealthCheckPayload
Expand Down
Loading