diff --git a/api/v1alpha1/envoygateway_types.go b/api/v1alpha1/envoygateway_types.go index 080d3020b67..882aff68a00 100644 --- a/api/v1alpha1/envoygateway_types.go +++ b/api/v1alpha1/envoygateway_types.go @@ -482,23 +482,23 @@ type XDSTranslatorHooks struct { // ExtensionService defines the configuration for connecting to a registered extension service. type ExtensionService struct { + // BackendEndpoint points to where the extension server can be found. + BackendEndpoint `json:",inline"` + // Host define the extension service hostname. - // Deprecated: use the backend attribute instead + // Deprecated: use the appropriate transport attribute instead (FQDN,IPv4,Unix) // // +optional Host string `json:"host,omitempty"` // Port defines the port the extension service is exposed on. - // Deprecated: use the backend attribute instead + // Deprecated: use the appropriate transport attribute instead (FQDN,IPv4,Unix) // // +optional // +kubebuilder:validation:Minimum=0 // +kubebuilder:default=80 Port int32 `json:"port,omitempty"` - // Backend points to where the extension server can be found. - Backend BackendEndpoint `json:"backend"` - // TLS defines TLS configuration for communication between Envoy Gateway and // the extension service. // diff --git a/api/v1alpha1/validation/envoygateway_validate.go b/api/v1alpha1/validation/envoygateway_validate.go index 49ca6e35452..d4f27633c6f 100644 --- a/api/v1alpha1/validation/envoygateway_validate.go +++ b/api/v1alpha1/validation/envoygateway_validate.go @@ -86,12 +86,12 @@ func ValidateEnvoyGateway(eg *v1alpha1.EnvoyGateway) error { } switch { - case eg.ExtensionManager.Service.Host == "" && eg.ExtensionManager.Service.Backend.FQDN == nil && eg.ExtensionManager.Service.Backend.Unix == nil && eg.ExtensionManager.Service.Backend.IPv4 == nil: + case eg.ExtensionManager.Service.Host == "" && eg.ExtensionManager.Service.FQDN == nil && eg.ExtensionManager.Service.Unix == nil && eg.ExtensionManager.Service.IPv4 == nil: return fmt.Errorf("extension service must contain a configured target") - case eg.ExtensionManager.Service.Backend.FQDN != nil && (eg.ExtensionManager.Service.Backend.IPv4 != nil || eg.ExtensionManager.Service.Backend.Unix != nil || eg.ExtensionManager.Service.Host != ""), - eg.ExtensionManager.Service.Backend.IPv4 != nil && (eg.ExtensionManager.Service.Backend.FQDN != nil || eg.ExtensionManager.Service.Backend.Unix != nil || eg.ExtensionManager.Service.Host != ""), - eg.ExtensionManager.Service.Backend.Unix != nil && (eg.ExtensionManager.Service.Backend.IPv4 != nil || eg.ExtensionManager.Service.Backend.FQDN != nil || eg.ExtensionManager.Service.Host != ""): + case eg.ExtensionManager.Service.FQDN != nil && (eg.ExtensionManager.Service.IPv4 != nil || eg.ExtensionManager.Service.Unix != nil || eg.ExtensionManager.Service.Host != ""), + eg.ExtensionManager.Service.IPv4 != nil && (eg.ExtensionManager.Service.FQDN != nil || eg.ExtensionManager.Service.Unix != nil || eg.ExtensionManager.Service.Host != ""), + eg.ExtensionManager.Service.Unix != nil && (eg.ExtensionManager.Service.IPv4 != nil || eg.ExtensionManager.Service.FQDN != nil || eg.ExtensionManager.Service.Host != ""): return fmt.Errorf("only one backend target can be configured for the extension manager") diff --git a/api/v1alpha1/validation/envoygateway_validate_test.go b/api/v1alpha1/validation/envoygateway_validate_test.go index f584630280e..2823e70a47c 100644 --- a/api/v1alpha1/validation/envoygateway_validate_test.go +++ b/api/v1alpha1/validation/envoygateway_validate_test.go @@ -584,7 +584,7 @@ func TestValidateEnvoyGateway(t *testing.T) { }, }, Service: &v1alpha1.ExtensionService{ - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ FQDN: &v1alpha1.FQDNEndpoint{ Hostname: "foo.example.com", Port: 8080, @@ -614,7 +614,7 @@ func TestValidateEnvoyGateway(t *testing.T) { }, }, Service: &v1alpha1.ExtensionService{ - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ FQDN: &v1alpha1.FQDNEndpoint{ Hostname: "foo.example.com", Port: 8080, @@ -647,7 +647,7 @@ func TestValidateEnvoyGateway(t *testing.T) { Service: &v1alpha1.ExtensionService{ Host: "foo.example.com", Port: 8080, - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ FQDN: &v1alpha1.FQDNEndpoint{ Hostname: "foo.example.com", Port: 8080, diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index ed9ce8f5993..8720b70a549 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -2014,7 +2014,7 @@ func (in *ExtensionManager) DeepCopy() *ExtensionManager { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExtensionService) DeepCopyInto(out *ExtensionService) { *out = *in - in.Backend.DeepCopyInto(&out.Backend) + in.BackendEndpoint.DeepCopyInto(&out.BackendEndpoint) if in.TLS != nil { in, out := &in.TLS, &out.TLS *out = new(ExtensionTLS) diff --git a/internal/extension/registry/extension_manager.go b/internal/extension/registry/extension_manager.go index 7dbec46b476..7ef203e5ab8 100644 --- a/internal/extension/registry/extension_manager.go +++ b/internal/extension/registry/extension_manager.go @@ -122,12 +122,12 @@ func (m *Manager) HasExtension(g v1.Group, k v1.Kind) bool { func getExtensionServerAddress(service *v1alpha1.ExtensionService) string { var serverAddr string switch { - case service.Backend.FQDN != nil: - serverAddr = fmt.Sprintf("%s:%d", service.Backend.FQDN.Hostname, service.Backend.FQDN.Port) - case service.Backend.IPv4 != nil: - serverAddr = fmt.Sprintf("%s:%d", service.Backend.IPv4.Address, service.Backend.IPv4.Port) - case service.Backend.Unix != nil: - serverAddr = fmt.Sprintf("unix://%s", service.Backend.Unix.Path) + case service.FQDN != nil: + serverAddr = fmt.Sprintf("%s:%d", service.FQDN.Hostname, service.FQDN.Port) + case service.IPv4 != nil: + serverAddr = fmt.Sprintf("%s:%d", service.IPv4.Address, service.IPv4.Port) + case service.Unix != nil: + serverAddr = fmt.Sprintf("unix://%s", service.Unix.Path) case service.Host != "": serverAddr = fmt.Sprintf("%s:%d", service.Host, service.Port) } diff --git a/internal/extension/registry/extension_manager_test.go b/internal/extension/registry/extension_manager_test.go index c7c07fc579c..28e7d84ffdd 100644 --- a/internal/extension/registry/extension_manager_test.go +++ b/internal/extension/registry/extension_manager_test.go @@ -22,7 +22,7 @@ func TestGetExtensionServerAddress(t *testing.T) { { Name: "has an FQDN", Service: &v1alpha1.ExtensionService{ - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ FQDN: &v1alpha1.FQDNEndpoint{ Hostname: "extserver.svc.cluster.local", Port: 5050, @@ -34,7 +34,7 @@ func TestGetExtensionServerAddress(t *testing.T) { { Name: "has an IPv4", Service: &v1alpha1.ExtensionService{ - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ IPv4: &v1alpha1.IPv4Endpoint{ Address: "10.10.10.10", Port: 5050, @@ -46,7 +46,7 @@ func TestGetExtensionServerAddress(t *testing.T) { { Name: "has a Unix path", Service: &v1alpha1.ExtensionService{ - Backend: v1alpha1.BackendEndpoint{ + BackendEndpoint: v1alpha1.BackendEndpoint{ Unix: &v1alpha1.UnixSocket{ Path: "/some/path", }, diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index f3808749a3e..0ba1f5677c6 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -1515,9 +1515,11 @@ _Appears in:_ | Field | Type | Required | Description | | --- | --- | --- | --- | -| `host` | _string_ | false | Host define the extension service hostname.
Deprecated: use the backend attribute instead | -| `port` | _integer_ | false | Port defines the port the extension service is exposed on.
Deprecated: use the backend attribute instead | -| `backend` | _[BackendEndpoint](#backendendpoint)_ | true | Backend points to where the extension server can be found. | +| `fqdn` | _[FQDNEndpoint](#fqdnendpoint)_ | false | FQDN defines a FQDN endpoint | +| `ipv4` | _[IPv4Endpoint](#ipv4endpoint)_ | false | IPv4 defines an IPv4 endpoint | +| `unix` | _[UnixSocket](#unixsocket)_ | false | Unix defines the unix domain socket endpoint | +| `host` | _string_ | false | Host define the extension service hostname.
Deprecated: use the appropriate transport attribute instead (FQDN,IPv4,Unix) | +| `port` | _integer_ | false | Port defines the port the extension service is exposed on.
Deprecated: use the appropriate transport attribute instead (FQDN,IPv4,Unix) | | `tls` | _[ExtensionTLS](#extensiontls)_ | false | TLS defines TLS configuration for communication between Envoy Gateway and
the extension service. | @@ -1544,6 +1546,7 @@ https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto# _Appears in:_ - [BackendEndpoint](#backendendpoint) +- [ExtensionService](#extensionservice) | Field | Type | Required | Description | | --- | --- | --- | --- | @@ -1927,6 +1930,7 @@ https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto# _Appears in:_ - [BackendEndpoint](#backendendpoint) +- [ExtensionService](#extensionservice) | Field | Type | Required | Description | | --- | --- | --- | --- | @@ -3522,6 +3526,7 @@ https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto# _Appears in:_ - [BackendEndpoint](#backendendpoint) +- [ExtensionService](#extensionservice) | Field | Type | Required | Description | | --- | --- | --- | --- |