Remove unimplemented debug page on dashboard (#2952)

* Remove unimplemented debug page on dashboard

Fixes #2895

Signed-off-by: Alejandro Pedraza <alejandro@buoyant.io>
This commit is contained in:
Alejandro Pedraza 2019-06-17 14:43:09 -05:00 committed by GitHub
parent 1ec9058f85
commit 928d4cb522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 149 deletions

View File

@ -13,8 +13,7 @@ const routeToCrumbTitle = {
"tap": "Tap", "tap": "Tap",
"top": "Top", "top": "Top",
"routes": "Top Routes", "routes": "Top Routes",
"community": "Community", "community": "Community"
"debug": "Debug"
}; };
class BreadcrumbHeader extends React.Component { class BreadcrumbHeader extends React.Component {

View File

@ -1,129 +0,0 @@
import BaseTable from './BaseTable.jsx';
import ErrorBanner from './ErrorBanner.jsx';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
import React from 'react';
import Spinner from './util/Spinner.jsx';
import Typography from '@material-ui/core/Typography';
import _each from 'lodash/each';
import _get from 'lodash/get';
import _reduce from 'lodash/reduce';
import { apiErrorPropType } from './util/ApiHelpers.jsx';
import { withContext } from './util/AppContext.jsx';
import withREST from './util/withREST.jsx';
const endpointColumns = [
{
title: "Namespace",
dataIndex: "namespace",
render: d => <Link to={"/namespaces/" + d.namespace}>{d.namespace}</Link>,
sorter: d => d.namespace
},
{
title: "IP",
dataIndex: "ip",
sorter: d => d.ip
},
{
title: "Port",
dataIndex: "port",
sorter: d => d.port
},
{
title: "Pod",
dataIndex: "name",
sorter: d => d.name,
render: d => <Link to={`/namespaces/${d.namespace}/pods/${d.name}`}>{d.name}</Link>
},
{
title: "Resource Version",
dataIndex: "resourceVersion",
sorter: d => d.resourceVersion
},
{
title: "Service",
dataIndex: "service",
sorter: d => d.service
}
];
class Debug extends React.Component {
static defaultProps = {
error: null
}
static propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
error: apiErrorPropType,
loading: PropTypes.bool.isRequired,
}
banner = () => {
const { error } = this.props;
if (!error) {
return;
}
return <ErrorBanner message={error} />;
}
loading = () => {
const { loading } = this.props;
if (!loading) {
return;
}
return <Spinner />;
}
render() {
const { data } = this.props;
let results = _get(data, '[0].servicePorts', {});
let rows = _reduce(results, (mem, svc, svcName) => {
let pods = [];
_each(svc.portEndpoints, info => {
info.podAddresses.forEach(podAddress => {
let [podNamespace, podName] = podAddress.pod.name.split("/");
pods.push({
service: svcName,
name: podName,
namespace: podNamespace,
resourceVersion: parseInt(podAddress.pod.resourceVersion, 10),
ip: podAddress.pod.podIP,
port: podAddress.addr.port,
});
});
});
return mem.concat(pods);
}, []);
return (
<React.Fragment>
{this.loading()}
{this.banner()}
<Typography variant="h6">Endpoints</Typography>
<Typography>
This table allows you to see Linkerd&#39;s service discovery state. It
provides debug information about the internal state of the
control-plane&#39;s destination container. Note that this cache of service
discovery information is populated on-demand via linkerd-proxy requests.
No endpoints will be found until a linkerd-proxy begins routing
requests.
</Typography>
<BaseTable
tableRows={rows}
tableColumns={endpointColumns}
tableClassName="metric-table"
defaultOrderBy="namespace"
rowKey={r => r.service + r.name}
padding="dense" />
</React.Fragment>
);
}
}
export default withREST(
withContext(Debug),
({api}) => [api.fetch("/api/endpoints")]
);

View File

@ -2,7 +2,6 @@ import { githubIcon, linkerdWordLogo, slackIcon } from './util/SvgWrappers.jsx';
import AppBar from '@material-ui/core/AppBar'; import AppBar from '@material-ui/core/AppBar';
import Badge from '@material-ui/core/Badge'; import Badge from '@material-ui/core/Badge';
import BreadcrumbHeader from './BreadcrumbHeader.jsx'; import BreadcrumbHeader from './BreadcrumbHeader.jsx';
import BuildIcon from '@material-ui/icons/Build';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import CloudQueueIcon from '@material-ui/icons/CloudQueue'; import CloudQueueIcon from '@material-ui/icons/CloudQueue';
import Divider from '@material-ui/core/Divider'; import Divider from '@material-ui/core/Divider';
@ -293,7 +292,6 @@ class NavigationBase extends React.Component {
{ this.menuItem("/routes", "Top Routes", <FontAwesomeIcon icon={faRandom} className={classes.shrinkIcon} />) } { this.menuItem("/routes", "Top Routes", <FontAwesomeIcon icon={faRandom} className={classes.shrinkIcon} />) }
{ this.menuItem("/servicemesh", "Service Mesh", <CloudQueueIcon className={classes.shrinkIcon} />) } { this.menuItem("/servicemesh", "Service Mesh", <CloudQueueIcon className={classes.shrinkIcon} />) }
<NavigationResources /> <NavigationResources />
{ this.menuItem("/debug", "Debug", <BuildIcon className={classes.shrinkIcon} />) }
</MenuList> </MenuList>
<Divider /> <Divider />

View File

@ -8,7 +8,6 @@ import ApiHelpers from './components/util/ApiHelpers.jsx';
import AppContext from './components/util/AppContext.jsx'; import AppContext from './components/util/AppContext.jsx';
import Community from './components/Community.jsx'; import Community from './components/Community.jsx';
import CssBaseline from '@material-ui/core/CssBaseline'; import CssBaseline from '@material-ui/core/CssBaseline';
import Debug from './components/Debug.jsx';
import Namespace from './components/Namespace.jsx'; import Namespace from './components/Namespace.jsx';
import NamespaceLanding from './components/NamespaceLanding.jsx'; import NamespaceLanding from './components/NamespaceLanding.jsx';
import Navigation from './components/Navigation.jsx'; import Navigation from './components/Navigation.jsx';
@ -112,9 +111,6 @@ let applicationHtml = (
<Route <Route
path={`${pathPrefix}/authorities`} path={`${pathPrefix}/authorities`}
render={props => <Navigation {...props} ChildComponent={ResourceList} resource="authority" />} /> render={props => <Navigation {...props} ChildComponent={ResourceList} resource="authority" />} />
<Route
path={`${pathPrefix}/debug`}
render={props => <Navigation {...props} ChildComponent={Debug} />} />
<Route <Route
path={`${pathPrefix}/community`} path={`${pathPrefix}/community`}
render={props => <Navigation {...props} ChildComponent={Community} />} /> render={props => <Navigation {...props} ChildComponent={Community} />} />

View File

@ -13,7 +13,6 @@ import (
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
"github.com/linkerd/linkerd2/controller/api/util" "github.com/linkerd/linkerd2/controller/api/util"
"github.com/linkerd/linkerd2/controller/gen/controller/discovery"
pb "github.com/linkerd/linkerd2/controller/gen/public" pb "github.com/linkerd/linkerd2/controller/gen/public"
"github.com/linkerd/linkerd2/pkg/k8s" "github.com/linkerd/linkerd2/pkg/k8s"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
@ -252,12 +251,3 @@ func (h *handler) handleAPITap(w http.ResponseWriter, req *http.Request, p httpr
} }
} }
} }
func (h *handler) handleAPIEndpoints(w http.ResponseWriter, req *http.Request, p httprouter.Params) {
result, err := h.apiClient.Endpoints(req.Context(), &discovery.EndpointsParams{})
if err != nil {
renderJSONError(w, err, http.StatusInternalServerError)
return
}
renderJSONPb(w, result)
}

View File

@ -108,7 +108,6 @@ func NewServer(
server.router.GET("/tap", handler.handleIndex) server.router.GET("/tap", handler.handleIndex)
server.router.GET("/top", handler.handleIndex) server.router.GET("/top", handler.handleIndex)
server.router.GET("/community", handler.handleIndex) server.router.GET("/community", handler.handleIndex)
server.router.GET("/debug", handler.handleIndex)
server.router.GET("/routes", handler.handleIndex) server.router.GET("/routes", handler.handleIndex)
server.router.GET("/profiles/new", handler.handleProfileDownload) server.router.GET("/profiles/new", handler.handleProfileDownload)
@ -125,7 +124,6 @@ func NewServer(
server.router.GET("/api/services", handler.handleAPIServices) server.router.GET("/api/services", handler.handleAPIServices)
server.router.GET("/api/tap", handler.handleAPITap) server.router.GET("/api/tap", handler.handleAPITap)
server.router.GET("/api/routes", handler.handleAPITopRoutes) server.router.GET("/api/routes", handler.handleAPITopRoutes)
server.router.GET("/api/endpoints", handler.handleAPIEndpoints)
// grafana proxy // grafana proxy
server.router.DELETE("/grafana/*grafanapath", handler.handleGrafana) server.router.DELETE("/grafana/*grafanapath", handler.handleGrafana)