From 928d4cb5227e12000c2fcd47fcf6dc8509ca6649 Mon Sep 17 00:00:00 2001 From: Alejandro Pedraza Date: Mon, 17 Jun 2019 14:43:09 -0500 Subject: [PATCH] Remove unimplemented debug page on dashboard (#2952) * Remove unimplemented debug page on dashboard Fixes #2895 Signed-off-by: Alejandro Pedraza --- web/app/js/components/BreadcrumbHeader.jsx | 3 +- web/app/js/components/Debug.jsx | 129 --------------------- web/app/js/components/Navigation.jsx | 2 - web/app/js/index.js | 4 - web/srv/api_handlers.go | 10 -- web/srv/server.go | 2 - 6 files changed, 1 insertion(+), 149 deletions(-) delete mode 100644 web/app/js/components/Debug.jsx diff --git a/web/app/js/components/BreadcrumbHeader.jsx b/web/app/js/components/BreadcrumbHeader.jsx index 4b5c1b0db..7db854a73 100644 --- a/web/app/js/components/BreadcrumbHeader.jsx +++ b/web/app/js/components/BreadcrumbHeader.jsx @@ -13,8 +13,7 @@ const routeToCrumbTitle = { "tap": "Tap", "top": "Top", "routes": "Top Routes", - "community": "Community", - "debug": "Debug" + "community": "Community" }; class BreadcrumbHeader extends React.Component { diff --git a/web/app/js/components/Debug.jsx b/web/app/js/components/Debug.jsx deleted file mode 100644 index 62cdb4ac8..000000000 --- a/web/app/js/components/Debug.jsx +++ /dev/null @@ -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 => {d.namespace}, - 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 => {d.name} - }, - { - 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 ; - } - - loading = () => { - const { loading } = this.props; - if (!loading) { - return; - } - - return ; - } - - 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 ( - - {this.loading()} - {this.banner()} - Endpoints - - This table allows you to see Linkerd's service discovery state. It - provides debug information about the internal state of the - control-plane'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. - - - r.service + r.name} - padding="dense" /> - - - ); - } -} - -export default withREST( - withContext(Debug), - ({api}) => [api.fetch("/api/endpoints")] -); diff --git a/web/app/js/components/Navigation.jsx b/web/app/js/components/Navigation.jsx index 2d2187d35..1ebf86410 100644 --- a/web/app/js/components/Navigation.jsx +++ b/web/app/js/components/Navigation.jsx @@ -2,7 +2,6 @@ import { githubIcon, linkerdWordLogo, slackIcon } from './util/SvgWrappers.jsx'; import AppBar from '@material-ui/core/AppBar'; import Badge from '@material-ui/core/Badge'; import BreadcrumbHeader from './BreadcrumbHeader.jsx'; -import BuildIcon from '@material-ui/icons/Build'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import CloudQueueIcon from '@material-ui/icons/CloudQueue'; import Divider from '@material-ui/core/Divider'; @@ -293,7 +292,6 @@ class NavigationBase extends React.Component { { this.menuItem("/routes", "Top Routes", ) } { this.menuItem("/servicemesh", "Service Mesh", ) } - { this.menuItem("/debug", "Debug", ) } diff --git a/web/app/js/index.js b/web/app/js/index.js index fba9a2e31..7edd908a3 100644 --- a/web/app/js/index.js +++ b/web/app/js/index.js @@ -8,7 +8,6 @@ import ApiHelpers from './components/util/ApiHelpers.jsx'; import AppContext from './components/util/AppContext.jsx'; import Community from './components/Community.jsx'; import CssBaseline from '@material-ui/core/CssBaseline'; -import Debug from './components/Debug.jsx'; import Namespace from './components/Namespace.jsx'; import NamespaceLanding from './components/NamespaceLanding.jsx'; import Navigation from './components/Navigation.jsx'; @@ -112,9 +111,6 @@ let applicationHtml = ( } /> - } /> } /> diff --git a/web/srv/api_handlers.go b/web/srv/api_handlers.go index 4b48fa7dc..8296bff1a 100644 --- a/web/srv/api_handlers.go +++ b/web/srv/api_handlers.go @@ -13,7 +13,6 @@ import ( "github.com/gorilla/websocket" "github.com/julienschmidt/httprouter" "github.com/linkerd/linkerd2/controller/api/util" - "github.com/linkerd/linkerd2/controller/gen/controller/discovery" pb "github.com/linkerd/linkerd2/controller/gen/public" "github.com/linkerd/linkerd2/pkg/k8s" 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) -} diff --git a/web/srv/server.go b/web/srv/server.go index 8f0e4f9d3..ac8640679 100644 --- a/web/srv/server.go +++ b/web/srv/server.go @@ -108,7 +108,6 @@ func NewServer( server.router.GET("/tap", handler.handleIndex) server.router.GET("/top", handler.handleIndex) server.router.GET("/community", handler.handleIndex) - server.router.GET("/debug", handler.handleIndex) server.router.GET("/routes", handler.handleIndex) server.router.GET("/profiles/new", handler.handleProfileDownload) @@ -125,7 +124,6 @@ func NewServer( server.router.GET("/api/services", handler.handleAPIServices) server.router.GET("/api/tap", handler.handleAPITap) server.router.GET("/api/routes", handler.handleAPITopRoutes) - server.router.GET("/api/endpoints", handler.handleAPIEndpoints) // grafana proxy server.router.DELETE("/grafana/*grafanapath", handler.handleGrafana)