Skip to content

Commit

Permalink
feat(kuma-cp): add support for inspect api for new kind Dataplane and…
Browse files Browse the repository at this point in the history
… section name for selecting single inbound

Fixes: #12361
Signed-off-by: Marcin Skalski <[email protected]>
  • Loading branch information
Automaat committed Jan 22, 2025
1 parent 28fefc6 commit e890085
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"httpMatches": [],
"resource": {
"labels": {
"app": "demo-app"
},
"mesh": "mesh-1",
"name": "dp-1",
"type": "Dataplane"
},
"rules": [
{
"fromRules": [
{
"inbound": {
"port": 8080,
"tags": {
"kuma.io/service": "foo"
}
},
"rules": [
{
"conf": {
"connectionTimeout": "7s",
"idleTimeout": "7s",
"http": {
"requestTimeout": "7s"
}
},
"matchers": [],
"origin": [
{
"labels": {},
"mesh": "mesh-1",
"name": "select-whole-dpp",
"type": "MeshTimeout"
}
]
}
]
},
{
"inbound": {
"port": 9090,
"tags": {
"kuma.io/service": "bar"
}
},
"rules": [
{
"conf": {
"connectionTimeout": "7s",
"idleTimeout": "7s",
"http": {
"requestTimeout": "2s"
}
},
"matchers": [],
"origin": [
{
"labels": {},
"mesh": "mesh-1",
"name": "select-whole-dpp",
"type": "MeshTimeout"
},
{
"labels": {},
"mesh": "mesh-1",
"name": "select-single-inbound",
"type": "MeshTimeout"
}
]
}
]
}
],
"toResourceRules": [],
"toRules": [],
"type": "MeshTimeout",
"warnings": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#/meshes/mesh-1/dataplanes/dp-1/_rules 200
type: Mesh
name: mesh-1
---
type: Dataplane
name: dp-1
mesh: mesh-1
labels:
app: demo-app
networking:
address: 127.0.0.1
inbound:
- port: 8080
name: main-port
tags:
kuma.io/service: foo
- port: 9090
name: secondary-port
tags:
kuma.io/service: bar
---
type: MeshTimeout
name: select-whole-dpp
mesh: mesh-1
spec:
targetRef:
kind: Dataplane
labels:
app: demo-app
from:
- targetRef:
kind: Mesh
default:
idleTimeout: 7s
connectionTimeout: 7s
http:
requestTimeout: 7s
---
type: MeshTimeout
name: select-single-inbound
mesh: mesh-1
spec:
targetRef:
kind: Dataplane
labels:
app: demo-app
sectionName: secondary-port
from:
- targetRef:
kind: Mesh
default:
http:
requestTimeout: 2s
1 change: 1 addition & 0 deletions pkg/plugins/policies/meshtimeout/api/v1alpha1/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (r *MeshTimeoutResource) validateTop(targetRef *common_api.TargetRef) valid
common_api.MeshService,
common_api.MeshServiceSubset,
},
IsInboundPolicy: true,
})
}
}
Expand Down

0 comments on commit e890085

Please sign in to comment.