-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser) support same-name services across NSes (#4375)
Correctly build upstreams for multiple backends where multiple services in the backends share the same name in different namespaces. Previously services were indexed by name alone in the rule builder, resulting in one clobbering the other(s).
- Loading branch information
Showing
5 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...al/dataplane/parser/testdata/golden/same-name-services-single-backend/default_golden.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
_format_version: "3.0" | ||
services: | ||
- connect_timeout: 60000 | ||
host: httproute.default.test.0 | ||
name: httproute.default.test.0 | ||
protocol: http | ||
read_timeout: 60000 | ||
retries: 5 | ||
routes: | ||
- https_redirect_status_code: 426 | ||
name: httproute.default.test.0.0 | ||
path_handling: v0 | ||
paths: | ||
- ~/test$ | ||
- /test/ | ||
preserve_host: true | ||
protocols: | ||
- http | ||
- https | ||
strip_path: true | ||
tags: | ||
- k8s-name:test | ||
- k8s-namespace:default | ||
- k8s-kind:HTTPRoute | ||
- k8s-group:gateway.networking.k8s.io | ||
- k8s-version:v1beta1 | ||
tags: | ||
- k8s-name:test | ||
- k8s-namespace:default | ||
- k8s-kind:HTTPRoute | ||
- k8s-group:gateway.networking.k8s.io | ||
- k8s-version:v1beta1 | ||
write_timeout: 60000 | ||
upstreams: | ||
- algorithm: round-robin | ||
name: httproute.default.test.0 | ||
tags: | ||
- k8s-name:test | ||
- k8s-namespace:default | ||
- k8s-kind:HTTPRoute | ||
- k8s-group:gateway.networking.k8s.io | ||
- k8s-version:v1beta1 | ||
targets: | ||
- target: 10.244.0.5:9443 | ||
weight: 50 | ||
- target: 10.244.0.4:9443 | ||
weight: 50 |
114 changes: 114 additions & 0 deletions
114
internal/dataplane/parser/testdata/golden/same-name-services-single-backend/in.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: ReferenceGrant | ||
metadata: | ||
name: testing | ||
namespace: other | ||
spec: | ||
from: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
namespace: default | ||
to: | ||
- group: "" | ||
kind: Service | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: test | ||
namespace: default | ||
annotations: | ||
konghq.com/strip-path: "true" | ||
spec: | ||
parentRefs: | ||
- name: kong | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: /test | ||
backendRefs: | ||
- name: one | ||
kind: Service | ||
port: 80 | ||
weight: 50 | ||
group: "" | ||
- name: two | ||
namespace: other | ||
kind: Service | ||
port: 80 | ||
weight: 50 | ||
group: "" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: example | ||
name: one | ||
namespace: default | ||
spec: | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 80 | ||
selector: | ||
app: example | ||
type: ClusterIP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: example | ||
name: two | ||
namespace: other | ||
spec: | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 80 | ||
selector: | ||
app: example | ||
type: ClusterIP | ||
--- | ||
apiVersion: discovery.k8s.io/v1 | ||
addressType: IPv4 | ||
kind: EndpointSlice | ||
metadata: | ||
namespace: default | ||
labels: | ||
kubernetes.io/service-name: one | ||
name: one-n5g6g | ||
endpoints: | ||
- addresses: | ||
- 10.244.0.5 | ||
conditions: | ||
ready: true | ||
serving: true | ||
terminating: false | ||
ports: | ||
- name: "" | ||
port: 9443 | ||
protocol: TCP | ||
--- | ||
apiVersion: discovery.k8s.io/v1 | ||
addressType: IPv4 | ||
kind: EndpointSlice | ||
metadata: | ||
namespace: other | ||
labels: | ||
kubernetes.io/service-name: two | ||
name: two-n5g6g | ||
endpoints: | ||
- addresses: | ||
- 10.244.0.4 | ||
conditions: | ||
ready: true | ||
serving: true | ||
terminating: false | ||
ports: | ||
- name: "" | ||
port: 9443 | ||
protocol: TCP |