Skip to content

Commit

Permalink
feat(dataplanes): disable linking of new Mesh*Services
Browse files Browse the repository at this point in the history
Signed-off-by: John Cowen <[email protected]>
  • Loading branch information
johncowen committed Sep 2, 2024
1 parent 58bc77d commit 919b371
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
27 changes: 23 additions & 4 deletions src/app/connections/data/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const protocols = ['http', 'tcp'] as const
const appProtocols = ['http', 'tcp', 'grpc'] as const

// `_` followed by 1 to 5 digits followed by a `.`
const trailingPortRe = /_\d{1,5}\./
const trailingPortRe2 = /_\d{1,5}/
const meshServiceRe = /_(mz|m|me){1}svc_\d{1,5}$/

export const Stat = {
fromCollection(items: string) {
return parse(items)
Expand Down Expand Up @@ -47,11 +52,29 @@ export const ConnectionCollection = {
.map(([cluster, value]) => {
const { tcp, http, http2, grpc, ...rest } = value
const stats = {
$kind: '',
tcp,
...(typeof http !== 'undefined' ? { http } : {}),
...(typeof http2 !== 'undefined' ? { http2 } : {}),
...(typeof grpc !== 'undefined' ? { grpc } : {}),
}
// sniff the name to see if we are a new type of service
const found = cluster.match(meshServiceRe)
if (found) {
const str = found[0]
switch (true) {
case (str.indexOf('_msvc_') !== -1):
stats.$kind = 'MeshService'
break
case (str.indexOf('_mesvc_') !== -1):
stats.$kind = 'MeshExternalService'
break
case (str.indexOf('_mzsvc_') !== -1):
stats.$kind = 'MeshMultiZoneService'
break
}
}
//
// check each protocol for existence, on root i.e.`<protocol>.<cluster-name>`
protocols.forEach(protocol => {
// replaces `cluster.<cluster-name>.<protocol>` with anything in `<protocol>.<cluster-name>`
Expand Down Expand Up @@ -91,10 +114,6 @@ export const ConnectionCollection = {
},
}

// `_` followed by 1 to 5 digits followed by a `.`
const trailingPortRe = /_\d{1,5}\./
const trailingPortRe2 = /_\d{1,5}/

// just does the initial response to JSON parsing
const parse = (lines: string): Record<string, any> => {
// for each line
Expand Down
1 change: 1 addition & 0 deletions src/app/connections/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const sources = (source: Source, api: KumaApi) => {
'_', // most internal names will be prefixed by `_` the rest will become legacy internal names
'admin',
'async-client',
'kuma_readiness',
'kuma_envoy_admin',
'probe_listener',
'inbound_passthrough_',
Expand Down
2 changes: 1 addition & 1 deletion src/app/data-planes/views/DataPlaneDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
data-testid="dataplane-outbound"
:protocol="['grpc', 'http', 'tcp'].find(protocol => typeof outbound[protocol] !== 'undefined') ?? 'tcp'"
:traffic="outbound"
:service="name.replace(hash, '')"
:service="outbound.$kind === '' ? name.replace(hash, '') : undefined"
:direction="direction"
>
<RouterLink
Expand Down

0 comments on commit 919b371

Please sign in to comment.