Skip to content

Commit

Permalink
[api] Add Failover field to Backend (#4099)
Browse files Browse the repository at this point in the history
* [api] Add Failover field to Backend

Adds a `failover` field to Backend API so we can support Active/Passive
Failove backends within xRoutes similar to #4033

Relates to #3055

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix doc string

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* notImplementedHide

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg authored Aug 27, 2024
1 parent 834619a commit 3119549
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 10 deletions.
10 changes: 10 additions & 0 deletions api/v1alpha1/backend_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ type BackendSpec struct {
//
// +optional
AppProtocols []AppProtocolType `json:"appProtocols,omitempty"`

// Failover indicates whether the backend is designated as a failover.
// It is highly recommended to configure active or passive health checks to ensure that failover can be detected
// when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
// The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when
// the health of the active backends falls below 72%.
//
// +optional
// +notImplementedHide
Failover *bool `json:"failover,omitempty"`
}

// BackendConditionType is a type of condition for a backend. This type should be
Expand Down
3 changes: 2 additions & 1 deletion api/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,13 @@ type BackendRef struct {
// BackendObjectReference references a Kubernetes object that represents the backend.
// Only Service kind is supported for now.
gwapiv1.BackendObjectReference `json:",inline"`
// Failover This indicates whether the backend is designated as a failover.
// Failover indicates whether the backend is designated as a failover.
// Multiple failover backends can be configured.
// It is highly recommended to configure active or passive health checks to ensure that failover can be detected
// when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
// The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when
// the health of the active backends falls below 72%.
//
// +optional
Failover *bool `json:"failover,omitempty"`
}
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 @@ -137,6 +137,14 @@ spec:
x-kubernetes-validations:
- message: fqdn addresses cannot be mixed with other address types
rule: self.all(f, has(f.fqdn)) || !self.exists(f, has(f.fqdn))
failover:
description: |-
Failover indicates whether the backend is designated as a failover.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when
the health of the active backends falls below 72%.
type: boolean
type: object
status:
description: Status defines the current status of Backend.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10359,7 +10359,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down Expand Up @@ -11245,7 +11245,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down Expand Up @@ -12209,7 +12209,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down Expand Up @@ -13108,7 +13108,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down Expand Up @@ -1130,7 +1130,7 @@ spec:
properties:
failover:
description: |-
Failover This indicates whether the backend is designated as a failover.
Failover indicates whether the backend is designated as a failover.
Multiple failover backends can be configured.
It is highly recommended to configure active or passive health checks to ensure that failover can be detected
when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ _Appears in:_
| `name` | _[ObjectName](#objectname)_ | true | Name is the name of the referent. |
| `namespace` | _[Namespace](#namespace)_ | false | Namespace is the namespace of the backend. When unspecified, the local<br />namespace is inferred.<br /><br />Note that when a namespace different than the local namespace is specified,<br />a ReferenceGrant object is required in the referent namespace to allow that<br />namespace's owner to accept the reference. See the ReferenceGrant<br />documentation for details.<br /><br />Support: Core |
| `port` | _[PortNumber](#portnumber)_ | false | Port specifies the destination port number to use for this resource.<br />Port is required when the referent is a Kubernetes Service. In this<br />case, the port number is the service port number, not the target port.<br />For other resources, destination port might be derived from the referent<br />resource or this field. |
| `failover` | _boolean_ | false | Failover This indicates whether the backend is designated as a failover.<br />Multiple failover backends can be configured.<br />It is highly recommended to configure active or passive health checks to ensure that failover can be detected<br />when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.<br />The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when<br />the health of the active backends falls below 72%. |
| `failover` | _boolean_ | false | Failover indicates whether the backend is designated as a failover.<br />Multiple failover backends can be configured.<br />It is highly recommended to configure active or passive health checks to ensure that failover can be detected<br />when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.<br />The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when<br />the health of the active backends falls below 72%. |


#### BackendSpec
Expand Down
2 changes: 1 addition & 1 deletion site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ _Appears in:_
| `name` | _[ObjectName](#objectname)_ | true | Name is the name of the referent. |
| `namespace` | _[Namespace](#namespace)_ | false | Namespace is the namespace of the backend. When unspecified, the local<br />namespace is inferred.<br /><br />Note that when a namespace different than the local namespace is specified,<br />a ReferenceGrant object is required in the referent namespace to allow that<br />namespace's owner to accept the reference. See the ReferenceGrant<br />documentation for details.<br /><br />Support: Core |
| `port` | _[PortNumber](#portnumber)_ | false | Port specifies the destination port number to use for this resource.<br />Port is required when the referent is a Kubernetes Service. In this<br />case, the port number is the service port number, not the target port.<br />For other resources, destination port might be derived from the referent<br />resource or this field. |
| `failover` | _boolean_ | false | Failover This indicates whether the backend is designated as a failover.<br />Multiple failover backends can be configured.<br />It is highly recommended to configure active or passive health checks to ensure that failover can be detected<br />when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.<br />The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when<br />the health of the active backends falls below 72%. |
| `failover` | _boolean_ | false | Failover indicates whether the backend is designated as a failover.<br />Multiple failover backends can be configured.<br />It is highly recommended to configure active or passive health checks to ensure that failover can be detected<br />when the active backends become unhealthy and to automatically readjust once the primary backends are healthy again.<br />The overprovisioning factor is set to 1.4, meaning the failover backends will only start receiving traffic when<br />the health of the active backends falls below 72%. |


#### BackendSpec
Expand Down

0 comments on commit 3119549

Please sign in to comment.