Skip to content

Commit e02caee

Browse files
authored
Add resource versions display to node overview UI (#219)
1 parent 2351b9b commit e02caee

File tree

9 files changed

+95
-9
lines changed

9 files changed

+95
-9
lines changed

helm/charts/envoy-xds-controller/templates/ui/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spec:
4545
containers:
4646
- image: {{ .Values.ui.image.repository }}:{{ default .Chart.AppVersion .Values.ui.image.tag }}
4747
name: envoy-xds-controller-ui
48-
imagePullPolicy: {{ .Values.image.pullPolicy }}
48+
imagePullPolicy: {{ .Values.ui.image.pullPolicy }}
4949
{{- if .Values.ui.nginxConfigMap.enabled }}
5050
volumeMounts:
5151
- name: nginx-config

internal/xds/api/v1/handlers/overview.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ func (h *handler) getOverview(ctx *gin.Context) {
4444
return
4545
}
4646

47+
// Get resource versions
48+
versions, err := h.cache.GetVersions(nodeID)
49+
if err != nil {
50+
ctx.JSON(500, gin.H{"error": err.Error()})
51+
return
52+
}
53+
54+
resourceVersions := ResourceVersions{
55+
Listeners: versions["listeners"],
56+
Clusters: versions["clusters"],
57+
Routes: versions["routes"],
58+
Secrets: versions["secrets"],
59+
}
60+
4761
// Get all resources
4862
listeners, err := h.cache.GetListeners(nodeID)
4963
if err != nil {
@@ -70,10 +84,11 @@ func (h *handler) getOverview(ctx *gin.Context) {
7084
summary := h.calculateSummary(endpoints, certificates)
7185

7286
response := &NodeOverviewResponse{
73-
NodeID: nodeID,
74-
Summary: summary,
75-
Endpoints: endpoints,
76-
Certificates: certificates,
87+
NodeID: nodeID,
88+
Summary: summary,
89+
ResourceVersions: resourceVersions,
90+
Endpoints: endpoints,
91+
Certificates: certificates,
7792
}
7893

7994
// Cache the response

internal/xds/api/v1/handlers/overview_types.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ package handlers
33
// NodeOverviewResponse represents the complete overview of a node's configuration
44
// in a human-readable format.
55
type NodeOverviewResponse struct {
6-
NodeID string `json:"nodeId"`
7-
Summary OverviewSummary `json:"summary"`
8-
Endpoints []EndpointInfo `json:"endpoints"`
9-
Certificates []CertificateInfo `json:"certificates"`
6+
NodeID string `json:"nodeId"`
7+
Summary OverviewSummary `json:"summary"`
8+
ResourceVersions ResourceVersions `json:"resourceVersions"`
9+
Endpoints []EndpointInfo `json:"endpoints"`
10+
Certificates []CertificateInfo `json:"certificates"`
11+
}
12+
13+
// ResourceVersions contains xDS resource version strings for each resource type.
14+
type ResourceVersions struct {
15+
Listeners string `json:"listeners"`
16+
Clusters string `json:"clusters"`
17+
Routes string `json:"routes"`
18+
Secrets string `json:"secrets"`
1019
}
1120

1221
// OverviewSummary provides aggregate statistics for the node.

scripts/dev-update.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ helm upgrade exc \
6161
--reuse-values \
6262
--set image.repository="$IMG_REPO" \
6363
--set image.tag="$IMAGE_TAG" \
64+
--set image.pullPolicy=Always \
6465
--set ui.image.repository="$UI_IMG_REPO" \
6566
--set ui.image.tag="$IMAGE_TAG" \
67+
--set ui.image.pullPolicy=Always \
6668
--set initCert.image.repository="$INIT_CERT_IMG_REPO" \
6769
--set initCert.image.tag="$IMAGE_TAG" \
70+
--set initCert.image.pullPolicy=Always \
6871
--namespace envoy-xds-controller \
6972
"$ROOT_DIR/helm/charts/envoy-xds-controller" \
7073
--timeout='5m' --wait

scripts/dev.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@ helm install exc \
125125
--set 'watchNamespaces={default}' \
126126
--set image.repository="$IMG_REPO" \
127127
--set image.tag="$IMAGE_TAG" \
128+
--set image.pullPolicy=Always \
128129
--set ui.image.repository="$UI_IMG_REPO" \
129130
--set ui.image.tag="$IMAGE_TAG" \
131+
--set ui.image.pullPolicy=Always \
130132
--set initCert.image.repository="$INIT_CERT_IMG_REPO" \
131133
--set initCert.image.tag="$IMAGE_TAG" \
134+
--set initCert.image.pullPolicy=Always \
132135
--namespace envoy-xds-controller \
133136
--create-namespace "$ROOT_DIR/helm/charts/envoy-xds-controller" \
134137
--timeout='5m' --wait

ui/src/common/types/overviewApiTypes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
export interface NodeOverviewResponse {
22
nodeId: string
33
summary: OverviewSummary
4+
resourceVersions: ResourceVersions
45
endpoints: EndpointInfo[]
56
certificates: CertificateInfo[]
67
}
78

9+
export interface ResourceVersions {
10+
listeners: string
11+
clusters: string
12+
routes: string
13+
secrets: string
14+
}
15+
816
export interface OverviewSummary {
917
totalDomains: number
1018
totalEndpoints: number
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Box, Typography } from '@mui/material'
2+
import { ResourceVersions as ResourceVersionsType } from '../../common/types/overviewApiTypes'
3+
4+
interface ResourceVersionsProps {
5+
versions: ResourceVersionsType
6+
}
7+
8+
export const ResourceVersions = ({ versions }: ResourceVersionsProps) => {
9+
const items = [
10+
{ label: 'Listeners', version: versions.listeners },
11+
{ label: 'Clusters', version: versions.clusters },
12+
{ label: 'Routes', version: versions.routes },
13+
{ label: 'Secrets', version: versions.secrets }
14+
]
15+
16+
return (
17+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2, flexWrap: 'wrap' }}>
18+
<Typography variant='body2' color='text.secondary'>
19+
Versions:
20+
</Typography>
21+
{items.map((item, index) => (
22+
<Box key={item.label} sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
23+
<Typography variant='body2' color='text.secondary'>
24+
{item.label}
25+
</Typography>
26+
<Typography variant='body2' sx={{ fontFamily: 'monospace', fontWeight: 600 }}>
27+
{item.version}
28+
</Typography>
29+
{index < items.length - 1 && (
30+
<Typography variant='body2' color='text.disabled' sx={{ ml: 1 }}>
31+
|
32+
</Typography>
33+
)}
34+
</Box>
35+
))}
36+
</Box>
37+
)
38+
}
39+
40+
export default ResourceVersions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { ResourceVersions } from './ResourceVersions'
2+
export { default } from './ResourceVersions'

ui/src/pages/nodeOverview/NodeOverview.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'
55
import RefreshIcon from '@mui/icons-material/Refresh'
66
import { useOverview } from '../../api/hooks/useOverview'
77
import { OverviewSummary } from '../../components/overviewSummary'
8+
import { ResourceVersions } from '../../components/resourceVersions'
89
import { EndpointsTable } from '../../components/endpointsTable'
910
import { CertificatesTable } from '../../components/certificatesTable'
1011
import { CustomTabPanel } from '../../components/customTabPanel'
@@ -80,6 +81,11 @@ const NodeOverview = () => {
8081
</IconButton>
8182
</Box>
8283

84+
{/* Resource Versions */}
85+
<Box sx={{ mb: 2 }}>
86+
<ResourceVersions versions={overview.resourceVersions} />
87+
</Box>
88+
8389
{/* Summary Cards */}
8490
<OverviewSummary summary={overview.summary} />
8591

0 commit comments

Comments
 (0)