Skip to content

Commit 2c5f570

Browse files
committed
Remove deprecated 'authority' references from tap form
PR linkerd#13578 removes 'authority' from being a pseudo-k8s resource, but the viz web `/tap` form still expects it to be present, issuing a `/api/tps-reports?resource_type=authority&all_namespaces=true` call, which returns 500 `cannot find Kubernetes canonical name from friendly name [authority]`, breaking the form entirely. This change removes all references to authorities in the form, restoring functionality. This was validated against a edge-25.3.1 linkerd-viz install by performing a successful tap with the new code. Signed-off-by: Stephen Muth <[email protected]>
1 parent 38ec591 commit 2c5f570

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

web/app/js/components/Tap.jsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class Tap extends React.Component {
3434
tapResultsById: this.tapResultsById,
3535
error: null,
3636
resourcesByNs: {},
37-
authoritiesByNs: {},
3837
query: {
3938
resource: '',
4039
namespace: '',
@@ -43,7 +42,6 @@ class Tap extends React.Component {
4342
method: '',
4443
path: '',
4544
scheme: '',
46-
authority: '',
4745
maxRps: '',
4846
},
4947
maxLinesToDisplay: 40,
@@ -269,15 +267,12 @@ class Tap extends React.Component {
269267
});
270268

271269
const url = this.api.urlsForResourceNoStats('all');
272-
const authorityUrl = this.api.urlsForResource('authority');
273-
this.api.setCurrentRequests([this.api.fetchMetrics(url), this.api.fetchMetrics(authorityUrl)]);
270+
this.api.setCurrentRequests([this.api.fetchMetrics(url)]);
274271
Promise.all(this.api.getCurrentPromises())
275272
.then(rsp => {
276273
const { resourcesByNs } = groupResourcesByNs(rsp[0]);
277-
const { authoritiesByNs } = groupResourcesByNs(rsp[1]);
278274
this.setState({
279275
resourcesByNs,
280-
authoritiesByNs,
281276
pendingRequests: false,
282277
});
283278
})
@@ -292,7 +287,7 @@ class Tap extends React.Component {
292287
};
293288

294289
render() {
295-
const { tapResultsById, tapRequestInProgress, tapIsClosing, resourcesByNs, authoritiesByNs, query, showTapEnabledWarning, error } = this.state;
290+
const { tapResultsById, tapRequestInProgress, tapIsClosing, resourcesByNs, query, showTapEnabledWarning, error } = this.state;
296291
const tableRows = _orderBy(_values(tapResultsById), r => r.lastUpdated, 'desc');
297292

298293
return (
@@ -308,7 +303,6 @@ class Tap extends React.Component {
308303
handleTapStop={this.handleTapStop}
309304
handleTapClear={this.handleTapClear}
310305
resourcesByNs={resourcesByNs}
311-
authoritiesByNs={authoritiesByNs}
312306
updateQuery={this.updateQuery}
313307
currentQuery={query} />
314308
{showTapEnabledWarning &&

web/app/js/components/TapQueryForm.jsx

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,17 @@ class TapQueryForm extends React.Component {
9797
static getDerivedStateFromProps(props, state) {
9898
if (!_isEqual(props.resourcesByNs, state.resourcesByNs)) {
9999
const resourcesByNs = props.resourcesByNs;
100-
const authoritiesByNs = props.authoritiesByNs;
101100
const namespaces = Object.keys(resourcesByNs).sort();
102101
const resourceNames = getResourceList(resourcesByNs, state.query.namespace);
103102
const toResourceNames = getResourceList(resourcesByNs, state.query.toNamespace);
104-
const authorities = getResourceList(authoritiesByNs, state.query.namespace);
105103

106104
return _merge(state, {
107105
resourcesByNs,
108-
authoritiesByNs,
109106
autocomplete: {
110107
namespace: namespaces,
111108
resource: resourceNames,
112109
toNamespace: namespaces,
113110
toResource: toResourceNames,
114-
authority: authorities,
115111
},
116112
});
117113
} else {
@@ -133,28 +129,25 @@ class TapQueryForm extends React.Component {
133129
this.state = {
134130
query,
135131
advancedFormExpanded,
136-
authoritiesByNs: {},
137132
resourcesByNs: {},
138133
autocomplete: {
139134
namespace: [],
140135
resource: [],
141136
toNamespace: [],
142137
toResource: [],
143-
authority: [],
144138
},
145139
};
146140
}
147141

148142
handleFormChange = (name, scopeResource) => {
149-
const { query, autocomplete, resourcesByNs, authoritiesByNs } = this.state;
143+
const { query, autocomplete, resourcesByNs } = this.state;
150144
const { updateQuery } = this.props;
151145

152146
const state = {
153147
query,
154148
autocomplete,
155149
};
156150

157-
const shouldScopeAuthority = name === 'namespace';
158151
const newQueryValues = {};
159152

160153
return event => {
@@ -169,10 +162,6 @@ class TapQueryForm extends React.Component {
169162
newQueryValues[scopeResource] = `namespace/${formVal}`;
170163
}
171164

172-
if (shouldScopeAuthority) {
173-
state.autocomplete.authority = authoritiesByNs[formVal];
174-
}
175-
176165
this.setState(state);
177166
updateQuery(state.query);
178167
this.handleUrlUpdate(newQueryValues);
@@ -320,7 +309,7 @@ class TapQueryForm extends React.Component {
320309
};
321310

322311
renderAdvancedTapFormContent() {
323-
const { autocomplete, query } = this.state;
312+
const { query } = this.state;
324313
const { classes } = this.props;
325314

326315
return (
@@ -339,29 +328,6 @@ class TapQueryForm extends React.Component {
339328
</Grid>
340329
</Grid>
341330

342-
<Grid container spacing={3}>
343-
<Grid item xs={6} md={3} classes={{ item: classes.formControlWrapper }}>
344-
<FormControl className={classes.formControl}>
345-
<InputLabel htmlFor="authority"><Trans>formAuthority</Trans></InputLabel>
346-
<Select
347-
value={query.authority}
348-
onChange={this.handleFormChange('authority')}
349-
inputProps={{ name: 'authority', id: 'authority' }}
350-
className={classes.selectEmpty}>
351-
{
352-
_map(autocomplete.authority, (d, i) => (
353-
<MenuItem key={`authority-${i}`} value={d}>{d}</MenuItem>
354-
))
355-
}
356-
</Select>
357-
<FormHelperText><Trans>formAuthorityHelpText</Trans></FormHelperText>
358-
</FormControl>
359-
</Grid>
360-
<Grid item xs={6} md={3} className={classes.formControlWrapper}>
361-
{this.renderTextInput(<Trans>formPath</Trans>, 'path', <Trans>formPathHelpText</Trans>)}
362-
</Grid>
363-
</Grid>
364-
365331
<Grid container spacing={3}>
366332
<Grid item xs={6} md={3} className={classes.formControlWrapper}>
367333
{this.renderTextInput(<Trans>formScheme</Trans>, 'scheme', <Trans>formSchemeHelpText</Trans>)}
@@ -449,7 +415,6 @@ class TapQueryForm extends React.Component {
449415
}
450416

451417
TapQueryForm.propTypes = {
452-
authoritiesByNs: PropTypes.shape({}).isRequired,
453418
cmdName: PropTypes.string.isRequired,
454419
currentQuery: tapQueryPropType.isRequired,
455420
enableAdvancedForm: PropTypes.bool,

0 commit comments

Comments
 (0)