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 @@ -81,6 +81,13 @@ type PassiveHealthCheck struct {
// +kubebuilder:validation:Maximum=100
// +optional
FailurePercentageThreshold *uint32 `json:"failurePercentageThreshold,omitempty"`

// AlwaysEjectOneHost defines whether at least one host should be ejected,
// regardless of MaxEjectionPercent.
//
// +kubebuilder:default=false
// +optional
AlwaysEjectOneHost *bool `json:"alwaysEjectOneHost,omitempty"`
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 use Endpoint instead of Host here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but "Host" matches Envoy's internal terminology and the field directly controls Envoy's always_eject_one_host outlier detection behavior, it cloud confuse users familiar with Envoy's outlier detection documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

we use Endpoint instead of Host in Envoy Gateway, since Endpoint maps better to the API nomenclature used in this project (closer to Gateway API)

}

// ActiveHealthCheck defines the active health check configuration.
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.

Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base duration for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11700,6 +11700,12 @@ spec:
description: Passive passive check
configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime
Expand Down Expand Up @@ -12952,6 +12958,12 @@ spec:
description: Passive passive check
configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime
Expand Down Expand Up @@ -14363,6 +14375,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines
Expand Down Expand Up @@ -15689,6 +15707,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down Expand Up @@ -2393,6 +2399,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down Expand Up @@ -3743,6 +3755,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the
Expand Down Expand Up @@ -5153,6 +5171,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base duration for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11699,6 +11699,12 @@ spec:
description: Passive passive check
configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime
Expand Down Expand Up @@ -12951,6 +12957,12 @@ spec:
description: Passive passive check
configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime
Expand Down Expand Up @@ -14362,6 +14374,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines
Expand Down Expand Up @@ -15688,6 +15706,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down Expand Up @@ -2392,6 +2398,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down Expand Up @@ -3742,6 +3754,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the
Expand Down Expand Up @@ -5152,6 +5170,12 @@ spec:
passive:
description: Passive passive check configuration
properties:
alwaysEjectOneHost:
default: false
description: |-
AlwaysEjectOneHost defines whether at least one host should be ejected,
regardless of MaxEjectionPercent.
type: boolean
baseEjectionTime:
default: 30s
description: BaseEjectionTime defines the base
Expand Down
2 changes: 2 additions & 0 deletions internal/gatewayapi/backendtrafficpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ func TestBuildPassiveHealthCheck(t *testing.T) {
BaseEjectionTime: ptr.To(gwapiv1.Duration("30s")),
MaxEjectionPercent: ptr.To[int32](10),
FailurePercentageThreshold: ptr.To[uint32](85),
AlwaysEjectOneHost: ptr.To(true),
},
},
expected: &ir.OutlierDetection{
Expand All @@ -271,6 +272,7 @@ func TestBuildPassiveHealthCheck(t *testing.T) {
BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}),
MaxEjectionPercent: ptr.To[int32](10),
FailurePercentageThreshold: ptr.To[uint32](85),
AlwaysEjectOneHost: ptr.To(true),
},
},
}
Expand Down
1 change: 1 addition & 0 deletions internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ func buildPassiveHealthCheck(policy egv1a1.HealthCheck) *ir.OutlierDetection {
Consecutive5xxErrors: hc.Consecutive5xxErrors,
MaxEjectionPercent: hc.MaxEjectionPercent,
FailurePercentageThreshold: hc.FailurePercentageThreshold,
AlwaysEjectOneHost: hc.AlwaysEjectOneHost,
}

if hc.Interval != nil {
Expand Down
2 changes: 2 additions & 0 deletions internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -2820,6 +2820,8 @@ type OutlierDetection struct {
MaxEjectionPercent *int32 `json:"maxEjectionPercent,omitempty" yaml:"maxEjectionPercent,omitempty"`
// FailurePercentageThreshold sets the failure percentage threshold for outlier detection.
FailurePercentageThreshold *uint32 `json:"failurePercentageThreshold,omitempty" yaml:"failurePercentageThreshold,omitempty"`
// AlwaysEjectOneHost defines whether at least one host should be ejected, regardless of MaxEjectionPercent.
AlwaysEjectOneHost *bool `json:"alwaysEjectOneHost,omitempty" yaml:"alwaysEjectOneHost,omitempty"`
}

// ActiveHealthCheck defines active health check settings
Expand Down
5 changes: 5 additions & 0 deletions internal/ir/zz_generated.deepcopy.go

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

4 changes: 4 additions & 0 deletions internal/xds/translator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@ func buildXdsOutlierDetection(outlierDetection *ir.OutlierDetection) *clusterv3.
od.EnforcingFailurePercentage = wrapperspb.UInt32(100)
}

if outlierDetection.AlwaysEjectOneHost != nil {
od.AlwaysEjectOneHost = wrapperspb.Bool(*outlierDetection.AlwaysEjectOneHost)
}

return od
}

Expand Down
2 changes: 2 additions & 0 deletions internal/xds/translator/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func TestBuildXdsOutlierDetection(t *testing.T) {
BaseEjectionTime: ptr.To(metav1.Duration{Duration: 30 * time.Second}),
MaxEjectionPercent: ptr.To[int32](10),
FailurePercentageThreshold: ptr.To[uint32](85),
AlwaysEjectOneHost: ptr.To(true),
},
expected: &clusterv3.OutlierDetection{
SplitExternalLocalOriginErrors: true,
Expand All @@ -144,6 +145,7 @@ func TestBuildXdsOutlierDetection(t *testing.T) {
MaxEjectionPercent: wrapperspb.UInt32(10),
FailurePercentageThreshold: wrapperspb.UInt32(85),
EnforcingFailurePercentage: wrapperspb.UInt32(100),
AlwaysEjectOneHost: wrapperspb.Bool(true),
},
},
}
Expand Down
Loading