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

[release/v1.2] cherry pick bug fixes and IPv6 to v1.2.2 #4765

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
xds: always use :: and IPv4Compact for dynamic listener (#4743)
* enable IPv4Compact

Signed-off-by: zirain <zirain2009@gmail.com>

* fix xds test

Signed-off-by: zirain <zirain2009@gmail.com>

* release-notes

Signed-off-by: zirain <zirain2009@gmail.com>

* nit

Signed-off-by: zirain <zirain2009@gmail.com>

* gen

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
(cherry picked from commit 78da42c)
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
zirain authored and zhaohuabing committed Nov 22, 2024
commit 222a0f22cdde01619b21b2e5440b360202e1fff2
Original file line number Diff line number Diff line change
@@ -891,7 +891,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
@@ -950,7 +951,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8080
defaultFilterChain:
filters:
@@ -1017,7 +1019,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
filterChains:
- filters:
@@ -1056,7 +1059,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8443
filterChains:
- filterChainMatch:
@@ -1102,7 +1106,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
protocol: UDP
listenerFilters:
Original file line number Diff line number Diff line change
@@ -637,7 +637,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 10080
}
},
@@ -728,7 +729,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 8080
}
},
@@ -833,7 +835,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 1234
}
},
@@ -898,7 +901,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 8443
}
},
@@ -976,7 +980,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 1234,
"protocol": "UDP"
}
Original file line number Diff line number Diff line change
@@ -370,7 +370,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
@@ -429,7 +430,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8080
defaultFilterChain:
filters:
@@ -496,7 +498,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
filterChains:
- filters:
@@ -535,7 +538,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8443
filterChains:
- filterChainMatch:
@@ -581,7 +585,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
protocol: UDP
listenerFilters:
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
@@ -79,7 +80,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8080
defaultFilterChain:
filters:
@@ -146,7 +148,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
filterChains:
- filters:
@@ -185,7 +188,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 8443
filterChains:
- filterChainMatch:
@@ -231,7 +235,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 1234
protocol: UDP
listenerFilters:
Original file line number Diff line number Diff line change
@@ -460,7 +460,8 @@
],
"address": {
"socketAddress": {
"address": "0.0.0.0",
"address": "::",
"ipv4Compat": true,
"portValue": 10080
}
},
Original file line number Diff line number Diff line change
@@ -265,7 +265,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
Original file line number Diff line number Diff line change
@@ -227,7 +227,8 @@ xds:
path: /dev/stdout
address:
socketAddress:
address: 0.0.0.0
address: '::'
ipv4Compat: true
portValue: 10080
defaultFilterChain:
filters:
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
4 changes: 2 additions & 2 deletions internal/cmd/envoy/shutdown_manager.go
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@
// postEnvoyAdminAPI sends a POST request to the Envoy admin API
func postEnvoyAdminAPI(path string) error {
if resp, err := http.Post(fmt.Sprintf("http://%s:%d/%s",
bootstrap.EnvoyAdminAddress, bootstrap.EnvoyAdminPort, path), "application/json", nil); err != nil {
"localhost", bootstrap.EnvoyAdminPort, path), "application/json", nil); err != nil {

Check warning on line 174 in internal/cmd/envoy/shutdown_manager.go

Codecov / codecov/patch

internal/cmd/envoy/shutdown_manager.go#L174

Added line #L174 was not covered by tests
return err
} else {
defer resp.Body.Close()
@@ -187,7 +187,7 @@
func getTotalConnections() (*int, error) {
// Send request to Envoy admin API to retrieve server.total_connections stat
if resp, err := http.Get(fmt.Sprintf("http://%s:%d//stats?filter=^server\\.total_connections$&format=json",
bootstrap.EnvoyAdminAddress, bootstrap.EnvoyAdminPort)); err != nil {
"localhost", bootstrap.EnvoyAdminPort)); err != nil {

Check warning on line 190 in internal/cmd/envoy/shutdown_manager.go

Codecov / codecov/patch

internal/cmd/envoy/shutdown_manager.go#L190

Added line #L190 was not covered by tests
return nil, err
} else {
defer resp.Body.Close()
11 changes: 8 additions & 3 deletions internal/gatewayapi/listener.go
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ import (
"github.com/envoyproxy/gateway/internal/ir"
"github.com/envoyproxy/gateway/internal/utils"
"github.com/envoyproxy/gateway/internal/utils/naming"
"github.com/envoyproxy/gateway/internal/utils/net"
)

var _ ListenersTranslator = (*Translator)(nil)
@@ -99,6 +100,10 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
if !isReady {
continue
}

// EG always use `::` and set ipv4_compact with true to support both IPv4 and IPv6
address := net.IPv6ListenerAddress

// Add the listener to the Xds IR
servicePort := &protocolPort{protocol: listener.Protocol, port: int32(listener.Port)}
containerPort := servicePortToContainerPort(int32(listener.Port), gateway.envoyProxy)
@@ -107,7 +112,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
irListener := &ir.HTTPListener{
CoreListenerDetails: ir.CoreListenerDetails{
Name: irListenerName(listener),
Address: "0.0.0.0",
Address: address,
Port: uint32(containerPort),
Metadata: buildListenerMetadata(listener, gateway),
IPFamily: getIPFamily(gateway.envoyProxy),
@@ -134,7 +139,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
irListener := &ir.TCPListener{
CoreListenerDetails: ir.CoreListenerDetails{
Name: irListenerName(listener),
Address: "0.0.0.0",
Address: address,
Port: uint32(containerPort),
IPFamily: getIPFamily(gateway.envoyProxy),
},
@@ -150,7 +155,7 @@ func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource
irListener := &ir.UDPListener{
CoreListenerDetails: ir.CoreListenerDetails{
Name: irListenerName(listener),
Address: "0.0.0.0",
Address: address,
Port: uint32(containerPort),
},
}
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -266,7 +266,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
@@ -323,7 +323,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -227,7 +227,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ xdsIR:
text:
- path: /dev/stdout
http:
- address: 0.0.0.0
- address: '::'
hostnames:
- '*'
isHTTP2: false
Loading

Unchanged files with check annotations Beta

BackendObjectReference: *http.BackendRef,
},
}
default:
// This is a sanity check, it should never happen because the API server should have caught it
return nil, errors.New("http backend refs must be specified")

Check warning on line 879 in internal/gatewayapi/securitypolicy.go

Codecov / codecov/patch

internal/gatewayapi/securitypolicy.go#L877-L879

Added lines #L877 - L879 were not covered by tests
}
case grpc != nil:
protocol = ir.GRPC
BackendObjectReference: *grpc.BackendRef,
},
}
default:
// This is a sanity check, it should never happen because the API server should have caught it
return nil, errors.New("grpc backend refs must be specified")

Check warning on line 894 in internal/gatewayapi/securitypolicy.go

Codecov / codecov/patch

internal/gatewayapi/securitypolicy.go#L892-L894

Added lines #L892 - L894 were not covered by tests
}
}