Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions web/src/components/netflow-traffic-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ export const NetflowTrafficTab: React.FC<NetflowTrafficTabProps> = ({ match, obj
backAndForth: false
});
break;
case 'Gateway':
// NOTE: Gateways can be both ingress (receive traffic) and egress (send traffic)
setForcedFilters({
list: [
{
def: findFilter(filterDefinitions, 'src_resource')!,
values: [{ v: `${obj.kind}.${obj.metadata!.namespace}.${obj.metadata!.name}` }]
}
],
backAndForth: true
});
break;
case 'Route':
const route = obj as RouteProps;
setForcedFilters({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CubeIcon,
CubesIcon,
ExternalLinkAltIcon,
GlobeRouteIcon,
NetworkIcon,
OutlinedHddIcon,
QuestionCircleIcon,
Expand Down Expand Up @@ -68,6 +69,8 @@ const getTypeIcon = (peer: TopologyMetricPeer): React.ComponentClass<any, any> =
return ZoneIcon;
case 'UDN':
return NetworkIcon;
case 'Gateway':
return GlobeRouteIcon;
case 'CatalogSource':
case 'DaemonSet':
case 'Deployment':
Expand Down
10 changes: 9 additions & 1 deletion web/src/components/tabs/netflow-topology/peer-resource-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ export interface PeerResourceLinkProps {
peer: TopologyMetricPeer;
}

// Map of resource kinds that need explicit group-version-kind string
const customResourceGVK: { [kind: string]: string } = {
Gateway: 'gateway.networking.k8s.io~v1~Gateway'
};

export const PeerResourceLink: React.FC<PeerResourceLinkProps> = ({ peer }) => {
const name = peer.getDisplayName(false, false);
if (name) {
if (peer.resourceKind) {
return <ResourceLink inline={true} kind={peer.resourceKind} name={name} namespace={peer.namespace} />;
const gvkString = customResourceGVK[peer.resourceKind];
// Use group~version~kind format for custom resources, or plain kind for standard resources
const kind = gvkString || peer.resourceKind;
return <ResourceLink inline={true} kind={kind} name={name} namespace={peer.namespace} />;
} else {
return <Text>{name}</Text>;
}
Expand Down
26 changes: 26 additions & 0 deletions web/src/utils/k8s-models-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ export function useK8sModelsWithColors() {
}
}

function setModel(kind: string, abbr: string, color: string) {
if (k8sModels && !k8sModels[kind]) {
k8sModels[kind] = {
abbr,
color,
kind,
label: kind,
labelKey: kind,
labelPlural: `${kind}s`,
labelPluralKey: `${kind}s`,
plural: `${kind.toLowerCase()}s`,
apiGroup: '',
apiVersion: 'v1',
id: kind.toLowerCase(),
crd: true,
namespaced: true
};
} else if (k8sModels && k8sModels[kind]) {
k8sModels[kind].abbr = abbr;
k8sModels[kind].color = color;
}
}

if (k8sModels && !inFlight) {
/* This part inject missing colors in k8sModels
* check console/frontend/public/style/_vars.scss for values
Expand Down Expand Up @@ -73,6 +96,9 @@ export function useK8sModelsWithColors() {

//$color-ingress-dark = $pf-v5-color-purple-700 = #1F0066
setColor('Ingress', '#1F0066');

//$color-gateway-dark = $pf-v5-color-blue-500 = #004080 (same as deployments)
setModel('Gateway', 'G', '#004080');
}

return k8sModels;
Expand Down
90 changes: 90 additions & 0 deletions web/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,96 @@ module.exports = {
}
}
},
{
type: "console.tab/horizontalNav",
properties: {
model: {
version: "v1",
group: "gateway.networking.k8s.io",
kind: "Gateway"
},
component: {
"$codeRef": "netflowTab.default"
},
"page": {
name: "%plugin__netobserv-plugin~Network Traffic%",
"href": "netflow"
}
},
"flags": { "required": ["NETOBSERV_LOKI_ENABLED"] }
},
{
type: "console.tab/horizontalNav",
properties: {
model: {
version: "v1",
group: "gateway.networking.k8s.io",
kind: "HTTPRoute"
},
component: {
"$codeRef": "netflowTab.default"
},
"page": {
name: "%plugin__netobserv-plugin~Network Traffic%",
"href": "netflow"
}
},
"flags": { "required": ["NETOBSERV_LOKI_ENABLED"] }
},
{
type: "console.tab/horizontalNav",
properties: {
model: {
version: "v1alpha2",
group: "gateway.networking.k8s.io",
kind: "GRPCRoute"
},
component: {
"$codeRef": "netflowTab.default"
},
"page": {
name: "%plugin__netobserv-plugin~Network Traffic%",
"href": "netflow"
}
},
"flags": { "required": ["NETOBSERV_LOKI_ENABLED"] }
},
{
type: "console.tab/horizontalNav",
properties: {
model: {
version: "v1alpha2",
group: "gateway.networking.k8s.io",
kind: "TCPRoute"
},
component: {
"$codeRef": "netflowTab.default"
},
"page": {
name: "%plugin__netobserv-plugin~Network Traffic%",
"href": "netflow"
}
},
"flags": { "required": ["NETOBSERV_LOKI_ENABLED"] }
},
{
type: "console.tab/horizontalNav",
properties: {
model: {
version: "v1alpha2",
group: "gateway.networking.k8s.io",
kind: "UDPRoute"
},
component: {
"$codeRef": "netflowTab.default"
},
"page": {
name: "%plugin__netobserv-plugin~Network Traffic%",
"href": "netflow"
}
},
"flags": { "required": ["NETOBSERV_LOKI_ENABLED"] }
},
{
type: "console.tab/horizontalNav",
properties: {
Expand Down