Skip to content

Commit 2f820d6

Browse files
authored
add groups endpoint (#396)
1 parent 08f5a33 commit 2f820d6

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Lists all changes with user impact.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

6+
## [0.19.36]
7+
8+
### Changed
9+
- Added debug endpoint, which returns current groups
10+
611
## [0.19.35]
712

813
### Changed

envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/debug/SnapshotDebugController.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestBody
3434
import org.springframework.web.bind.annotation.RequestParam
3535
import org.springframework.web.bind.annotation.ResponseBody
3636
import org.springframework.web.bind.annotation.RestController
37+
import pl.allegro.tech.servicemesh.envoycontrol.groups.Group
3738
import io.envoyproxy.envoy.config.core.v3.Node as NodeV3
3839
import io.envoyproxy.envoy.extensions.filters.http.rbac.v3.RBAC as RBACFilter
3940

@@ -57,6 +58,15 @@ class SnapshotDebugController(val debugService: SnapshotDebugService) {
5758
)
5859
}
5960

61+
@GetMapping("/groups")
62+
fun globalSnapshot(@RequestParam(required = false) discoveryServiceName: String?)
63+
: ResponseEntity<Collection<Group>> {
64+
return ResponseEntity(
65+
debugService.groups(discoveryServiceName),
66+
HttpStatus.OK
67+
)
68+
}
69+
6070
@GetMapping("/snapshot-global")
6171
fun globalSnapshot(@RequestParam(defaultValue = "false") xds: Boolean): ResponseEntity<SnapshotDebugInfo> {
6272
return ResponseEntity(

envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/debug/SnapshotDebugService.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ class SnapshotDebugService(
3030
}
3131
}
3232

33+
fun groups(discoveryServiceName: String?): Collection<Group> {
34+
return if (discoveryServiceName != null) {
35+
cache.groups().filter { it.discoveryServiceName == discoveryServiceName }
36+
} else {
37+
cache.groups()
38+
}
39+
}
40+
3341
fun globalSnapshot(xds: Boolean): SnapshotDebugInfo {
3442
val globalSnapshot = snapshotUpdater.getGlobalSnapshot()
3543
if (xds) {

0 commit comments

Comments
 (0)