Skip to content

Commit

Permalink
dataclients/kubernetes: add failing testcase for named service target…
Browse files Browse the repository at this point in the history
… port

For #2565

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Sep 13, 2023
1 parent 35e9ac6 commit 3f555d8
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Endpoints logic produces endpoints with port 3000 therefore
// this test case fails because endpointslices logic produces endpoints with port 0
kube_myapp_ns__myapp_ingress__example_org____myapp_service:
Host("^(example[.]org[.]?(:[0-9]+)?)$")
-> <roundRobin, "http://10.2.0.162:3000", "http://10.2.72.100:3000">;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# Passes with false but fails with true
#
enable-kubernetes-endpointslices: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
labels:
app: myapp
name: myapp-ingress
namespace: myapp-ns
spec:
rules:
- host: example.org
http:
paths:
- backend:
service:
name: myapp-service
port:
number: 80
pathType: ImplementationSpecific
---
apiVersion: v1
kind: Service
metadata:
labels:
app: myapp
name: myapp-service
namespace: myapp-ns
spec:
clusterIP: 10.5.69.228
clusterIPs:
- 10.5.69.228
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- port: 80
protocol: TCP
targetPort: http-grafana
selector:
app: myapp
sessionAffinity: None
type: ClusterIP
---
kind: EndpointSlice
metadata:
labels:
app: myapp
kubernetes.io/service-name: myapp-service
name: myapp-service-foo
namespace: myapp-ns
addressType: IPv4
apiVersion: discovery.k8s.io/v1
endpoints:
- addresses:
- 10.2.0.162
conditions:
ready: true
serving: true
terminating: false
zone: eu-central-1a
- addresses:
- 10.2.72.100
conditions:
ready: true
serving: true
terminating: false
zone: eu-central-1c
ports:
- name: ""
port: 3000
protocol: TCP
---
# Endpoints for comparison
apiVersion: v1
kind: Endpoints
metadata:
labels:
app: myapp
name: myapp-service
namespace: myapp-ns
subsets:
- addresses:
- ip: 10.2.0.162
- ip: 10.2.72.100
ports:
- port: 3000
protocol: TCP

0 comments on commit 3f555d8

Please sign in to comment.