Skip to content

Commit

Permalink
tests(kuma-cp) more provided gateway id tests
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
  • Loading branch information
Paul Parkanzky committed Aug 3, 2022
1 parent f44269b commit 48c54b5
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/plugins/runtime/k8s/controllers/pod_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,17 @@ var _ = Describe("PodToDataplane(..)", func() {
otherReplicaSets: "20.replicasets-for-pod.yaml",
dataplane: "20.dataplane.yaml",
}),
Entry("21. Pod with gateway annotation and 1 service with no replicaset", testCase{
pod: "21.pod.yaml",
servicesForPod: "21.services-for-pod.yaml",
dataplane: "21.dataplane.yaml",
}),
Entry("22. Pod with gateway annotation and 1 service with replicaset but no deployment", testCase{
pod: "22.pod.yaml",
servicesForPod: "22.services-for-pod.yaml",
otherReplicaSets: "22.replicasets-for-pod.yaml",
dataplane: "22.dataplane.yaml",
}),
)

DescribeTable("should convert Ingress Pod into an Ingress Dataplane YAML version",
Expand Down
16 changes: 16 additions & 0 deletions pkg/plugins/runtime/k8s/controllers/testdata/21.dataplane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mesh: default
metadata:
creationTimestamp: null
spec:
networking:
address: 192.168.0.1
gateway:
tags:
app: example
k8s.kuma.io/namespace: demo
k8s.kuma.io/service-name: example
k8s.kuma.io/service-port: "80"
kuma.io/protocol: tcp
kuma.io/service: example_demo_svc_80
kuma.io/zone: zone-1
version: "0.1"
16 changes: 16 additions & 0 deletions pkg/plugins/runtime/k8s/controllers/testdata/21.pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
metadata:
namespace: demo
name: example
labels:
app: example
version: "0.1"
annotations:
kuma.io/gateway: provided
spec:
containers:
- ports:
- containerPort: 7070
- containerPort: 6060
name: metrics
status:
podIP: 192.168.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
metadata:
namespace: demo
name: example
spec:
clusterIP: 192.168.0.1
ports:
- # protocol defaults to TCP
port: 80
targetPort: 8080
- protocol: TCP
port: 443
targetPort: 8443
16 changes: 16 additions & 0 deletions pkg/plugins/runtime/k8s/controllers/testdata/22.dataplane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mesh: default
metadata:
creationTimestamp: null
spec:
networking:
address: 192.168.0.1
gateway:
tags:
app: example
k8s.kuma.io/namespace: demo
k8s.kuma.io/service-name: example
k8s.kuma.io/service-port: "80"
kuma.io/protocol: tcp
kuma.io/service: example_demo_svc_80
kuma.io/zone: zone-1
version: "0.1"
19 changes: 19 additions & 0 deletions pkg/plugins/runtime/k8s/controllers/testdata/22.pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
metadata:
namespace: demo
ownerReferences:
- name: replicaSetOne
kind: ReplicaSet
name: example
labels:
app: example
version: "0.1"
annotations:
kuma.io/gateway: provided
spec:
containers:
- ports:
- containerPort: 7070
- containerPort: 6060
name: metrics
status:
podIP: 192.168.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: replicaSetOne
namespace: demo
spec:
template:
spec:
containers:
- name: app
image: app-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
metadata:
namespace: demo
name: example
spec:
clusterIP: 192.168.0.1
ports:
- # protocol defaults to TCP
port: 80
targetPort: 8080
- protocol: TCP
port: 443
targetPort: 8443

0 comments on commit 48c54b5

Please sign in to comment.