mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-27 17:21:34 +00:00
Merge pull request #1199 from weaveworks/misspell
Update tools & build container to check for spelling mistakes
This commit is contained in:
@@ -274,7 +274,7 @@ Bug fixes:
|
||||
[#686](https://github.com/weaveworks/scope/pull/686)
|
||||
- Take default topology option if missing in URL
|
||||
[#678](https://github.com/weaveworks/scope/pull/678)
|
||||
- Dont treat missing node as UI error
|
||||
- Don't treat missing node as UI error
|
||||
[#677](https://github.com/weaveworks/scope/pull/677)
|
||||
- Unset previous details when deselecting a node
|
||||
[#675](https://github.com/weaveworks/scope/pull/675)
|
||||
|
||||
2
Makefile
2
Makefile
@@ -100,7 +100,7 @@ tests: $(SCOPE_BACKEND_BUILD_UPTODATE)
|
||||
./tools/test -no-go-get
|
||||
|
||||
lint: $(SCOPE_BACKEND_BUILD_UPTODATE)
|
||||
./tools/lint .
|
||||
./tools/lint -ignorespelling "agre " -ignorespelling "AGRE " .
|
||||
|
||||
prog/static.go: $(SCOPE_BACKEND_BUILD_UPTODATE)
|
||||
esc -o $@ -prefix client/build client/build
|
||||
|
||||
14
README.md
14
README.md
@@ -116,7 +116,7 @@ You need to run Scope on every machine you want to monitor.
|
||||
```
|
||||
|
||||
If you run Scope on the same machine as the Weave Network, the probe will use
|
||||
weaveDNS to automatically discover other apps on your network. Scope acheives
|
||||
weaveDNS to automatically discover other apps on your network. Scope achieves
|
||||
this by registering itself under the address **scope.weave.local**. Each probe
|
||||
will send reports to every app registered under this address. Therefore, if
|
||||
you have a running weaveDNS setup, you do not need to take any further steps.
|
||||
@@ -209,7 +209,7 @@ The SCOPE_SERVICE_TOKEN is found when you [log in to the Scope service](https://
|
||||
- "--probe.docker"
|
||||
- "true"
|
||||
- "--service-token"
|
||||
- "${SCOPE_SERVICE_TOKEN}"
|
||||
- "${SCOPE_SERVICE_TOKEN}"
|
||||
|
||||
## <a name="using-weave-scope-with-kubernetes"></a>Using Weave Scope with Kubernetes
|
||||
|
||||
@@ -217,14 +217,14 @@ Scope comes with built-in Kubernetes support. We recommend to run Scope natively
|
||||
in your Kubernetes cluster using
|
||||
[these resource definitions](https://github.com/TheNewNormal/kube-charts/tree/master/weavescope/manifests).
|
||||
|
||||
1. Make sure your cluster allows priviledged pods (required by the Scope
|
||||
probes). Priviledged pods are allowed by default from Kubernetes 1.1.
|
||||
If you are running an earlier version or a non-default configuration,
|
||||
make sure your API Server and all your Kubelets are provided with flag `--allow_privileged`
|
||||
1. Make sure your cluster allows privileged pods (required by the Scope
|
||||
probes). Privileged pods are allowed by default from Kubernetes 1.1.
|
||||
If you are running an earlier version or a non-default configuration,
|
||||
make sure your API Server and all your Kubelets are provided with flag `--allow_privileged`
|
||||
at launch time.
|
||||
|
||||
2. Make sure your cluster supports
|
||||
[DaemonSets](https://github.com/kubernetes/kubernetes/blob/master/docs/design/daemon.md).
|
||||
[DaemonSets](https://github.com/kubernetes/kubernetes/blob/master/docs/design/daemon.md).
|
||||
DaemonSets are needed to ensure that each Kubernetes node
|
||||
runs a Scope Probe:
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
FROM golang:1.6.0
|
||||
RUN apt-get update && apt-get install -y libpcap-dev python-requests time
|
||||
RUN apt-get update && apt-get install -y libpcap-dev python-requests time file
|
||||
RUN go clean -i net && go install -tags netgo std && go install -race -tags netgo std
|
||||
RUN go get -tags netgo \
|
||||
github.com/fzipp/gocyclo \
|
||||
github.com/golang/lint/golint \
|
||||
github.com/kisielk/errcheck \
|
||||
github.com/mjibson/esc
|
||||
github.com/mjibson/esc \
|
||||
github.com/client9/misspell/cmd/misspell
|
||||
COPY build.sh /
|
||||
ENTRYPOINT ["/build.sh"]
|
||||
|
||||
@@ -2,6 +2,6 @@ FROM node:4.2.2
|
||||
WORKDIR /home/weave
|
||||
COPY package.json /home/weave/
|
||||
ENV NPM_CONFIG_LOGLEVEL=warn NPM_CONFIG_PROGRESS=false
|
||||
# Dont install optional developer tools
|
||||
# Don't install optional developer tools
|
||||
RUN npm install --no-optional
|
||||
COPY webpack.local.config.js webpack.production.config.js server.js .babelrc .eslintrc .eslintignore /home/weave/
|
||||
|
||||
@@ -189,7 +189,7 @@ export function hitEsc() {
|
||||
pipeId: controlPipe.id
|
||||
});
|
||||
updateRoute();
|
||||
// Dont deselect node on ESC if there is a controlPipe (keep terminal open)
|
||||
// Don't deselect node on ESC if there is a controlPipe (keep terminal open)
|
||||
} else if (AppStore.getTopCardNodeId() && !controlPipe) {
|
||||
AppDispatcher.dispatch({ type: ActionTypes.DESELECT_NODE });
|
||||
updateRoute();
|
||||
|
||||
@@ -193,7 +193,7 @@ describe('NodesLayout', () => {
|
||||
expect(resultCoords).toEqual(coords);
|
||||
});
|
||||
|
||||
it('keeps nodes in rectangle after node dissappears', () => {
|
||||
it('keeps nodes in rectangle after node disappears', () => {
|
||||
let result = NodesLayout.doLayout(
|
||||
nodeSets.initial4.nodes,
|
||||
nodeSets.initial4.edges);
|
||||
|
||||
@@ -28,7 +28,7 @@ const nodeShapes = {
|
||||
function getNodeShape({shape, stack}) {
|
||||
const nodeShape = nodeShapes[shape];
|
||||
if (!nodeShape) {
|
||||
throw new Error(`Unkown shape: ${shape}!`);
|
||||
throw new Error(`Unknown shape: ${shape}!`);
|
||||
}
|
||||
return stack ? stackedShape(nodeShape) : nodeShape;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ func (s *Sniffer) loop(src gopacket.ZeroCopyPacketDataSource, on, off time.Durat
|
||||
}
|
||||
}
|
||||
|
||||
// interpolateCounts compensates for sampling by artifically inflating counts
|
||||
// interpolateCounts compensates for sampling by artificially inflating counts
|
||||
// throughout the report. It should be run once for each report, within the
|
||||
// probe, before it gets emitted into the rest of the system.
|
||||
func interpolateCounts(r report.Report) {
|
||||
|
||||
@@ -8,7 +8,7 @@ Run tracer:
|
||||
|
||||
TODO:
|
||||
- <s>need to stich traces together</s>
|
||||
- deal with persistant connections
|
||||
- deal with persistent connections
|
||||
- make it work for goroutines
|
||||
- test with jvm based app
|
||||
- find way to get local ip address for an incoming connection
|
||||
|
||||
@@ -238,7 +238,7 @@ func (t *PTracer) handleStopped(pid int, status syscall.WaitStatus) {
|
||||
t.threadExited(target)
|
||||
return
|
||||
} else if status.Stopped() {
|
||||
// tracee recieved a non-trace related signal
|
||||
// tracee received a non-trace related signal
|
||||
signal = status.StopSignal()
|
||||
|
||||
if signal == syscall.SIGSTOP && target.process.detaching {
|
||||
|
||||
@@ -132,7 +132,7 @@ func (r *registry) loop() {
|
||||
|
||||
func (r *registry) listenForEvents() bool {
|
||||
// First we empty the store lists.
|
||||
// This ensure any containers that went away inbetween calls to
|
||||
// This ensure any containers that went away in between calls to
|
||||
// listenForEvents don't hang around.
|
||||
r.reset()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ var (
|
||||
// parseLsof parses lsof out with `-F cn` argument.
|
||||
//
|
||||
// Format description: the first letter is the type of record, records are
|
||||
// newline seperated, the record starting with 'p' (pid) is a new processid.
|
||||
// newline separated, the record starting with 'p' (pid) is a new processid.
|
||||
// There can be multiple connections for the same 'p' record in which case the
|
||||
// 'p' is not repeated.
|
||||
//
|
||||
|
||||
@@ -65,7 +65,7 @@ var (
|
||||
func TestSpyNoProcesses(t *testing.T) {
|
||||
const (
|
||||
nodeID = "heinz-tomato-ketchup" // TODO rename to hostID
|
||||
nodeName = "frenchs-since-1904" // TODO rename to hostNmae
|
||||
nodeName = "frenchs-since-1904" // TODO rename to hostName
|
||||
)
|
||||
|
||||
scanner := procspy.FixedScanner(fixConnections)
|
||||
@@ -83,7 +83,7 @@ func TestSpyNoProcesses(t *testing.T) {
|
||||
func TestSpyWithProcesses(t *testing.T) {
|
||||
const (
|
||||
nodeID = "nikon" // TODO rename to hostID
|
||||
nodeName = "fishermans-friend" // TODO rename to hostNmae
|
||||
nodeName = "fishermans-friend" // TODO rename to hostName
|
||||
)
|
||||
|
||||
scanner := procspy.FixedScanner(fixConnectionsWithProcesses)
|
||||
|
||||
@@ -29,7 +29,7 @@ func (t Tagger) Tag(r report.Report) (report.Report, error) {
|
||||
parents = report.EmptySets.Add(report.Host, report.MakeStringSet(t.hostNodeID))
|
||||
)
|
||||
|
||||
// Explicity don't tag Endpoints and Addresses - These topologies include pseudo nodes,
|
||||
// Explicitly don't tag Endpoints and Addresses - These topologies include pseudo nodes,
|
||||
// and as such do their own host tagging
|
||||
for _, topology := range []report.Topology{r.Process, r.Container, r.ContainerImage, r.Host, r.Overlay} {
|
||||
for id, node := range topology.Nodes {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
// CustomRenderer allow for mapping functions that recived the entire topology
|
||||
// CustomRenderer allow for mapping functions that received the entire topology
|
||||
// in one call - useful for functions that need to consider the entire graph.
|
||||
// We should minimise the use of this renderer type, as it is very inflexible.
|
||||
type CustomRenderer struct {
|
||||
|
||||
@@ -384,7 +384,7 @@ func MapEndpoint2Pseudo(n RenderableNode, local report.Networks) RenderableNodes
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a process graph to get that info.
|
||||
func MapEndpoint2Process(n RenderableNode, local report.Networks) RenderableNodes {
|
||||
// Nodes without a hostid are treated as psuedo nodes
|
||||
// Nodes without a hostid are treated as pseudo nodes
|
||||
if _, ok := n.Latest.Lookup(report.HostNodeID); !ok {
|
||||
return MapEndpoint2Pseudo(n, local)
|
||||
}
|
||||
@@ -413,12 +413,12 @@ func MapEndpoint2Process(n RenderableNode, local report.Networks) RenderableNode
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a container graph to get that info.
|
||||
func MapProcess2Container(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Propogate the internet pseudo node
|
||||
// Propagate the internet pseudo node
|
||||
if strings.HasSuffix(n.ID, TheInternetID) {
|
||||
return RenderableNodes{n.ID: n}
|
||||
}
|
||||
|
||||
// Don't propogate non-internet pseudo nodes
|
||||
// Don't propagate non-internet pseudo nodes
|
||||
if n.Pseudo {
|
||||
return RenderableNodes{}
|
||||
}
|
||||
@@ -509,7 +509,7 @@ func MapCountProcessName(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a container graph to get that info.
|
||||
func MapContainer2ContainerImage(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Propogate all pseudo nodes
|
||||
// Propagate all pseudo nodes
|
||||
if n.Pseudo {
|
||||
return RenderableNodes{n.ID: n}
|
||||
}
|
||||
@@ -586,7 +586,7 @@ func MapContainerImage2Name(n RenderableNode, _ report.Networks) RenderableNodes
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a container graph to get that info.
|
||||
func MapX2Host(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Don't propogate all pseudo nodes - we do this in MapEndpoint2Host
|
||||
// Don't propagate all pseudo nodes - we do this in MapEndpoint2Host
|
||||
if n.Pseudo {
|
||||
return RenderableNodes{}
|
||||
}
|
||||
@@ -604,7 +604,7 @@ func MapX2Host(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// MapEndpoint2Host takes nodes from the endpoint topology and produces
|
||||
// host nodes or pseudo nodes.
|
||||
func MapEndpoint2Host(n RenderableNode, local report.Networks) RenderableNodes {
|
||||
// Nodes without a hostid are treated as psuedo nodes
|
||||
// Nodes without a hostid are treated as pseudo nodes
|
||||
if _, ok := n.Latest.Lookup(report.HostNodeID); !ok {
|
||||
return MapEndpoint2Pseudo(n, local)
|
||||
}
|
||||
@@ -628,7 +628,7 @@ func MapEndpoint2Host(n RenderableNode, local report.Networks) RenderableNodes {
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a container graph to get that info.
|
||||
func MapContainer2Pod(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Propogate all pseudo nodes
|
||||
// Propagate all pseudo nodes
|
||||
if n.Pseudo {
|
||||
return RenderableNodes{n.ID: n}
|
||||
}
|
||||
@@ -673,7 +673,7 @@ func MapContainer2Pod(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// It does not have enough info to do that, and the resulting graph
|
||||
// must be merged with a pod graph to get that info.
|
||||
func MapPod2Service(pod RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Propogate all pseudo nodes
|
||||
// Propagate all pseudo nodes
|
||||
if pod.Pseudo {
|
||||
return RenderableNodes{pod.ID: pod}
|
||||
}
|
||||
@@ -700,7 +700,7 @@ func MapPod2Service(pod RenderableNode, _ report.Networks) RenderableNodes {
|
||||
|
||||
// MapContainer2Hostname maps container RenderableNodes to 'hostname' renderabled nodes..
|
||||
func MapContainer2Hostname(n RenderableNode, _ report.Networks) RenderableNodes {
|
||||
// Propogate all pseudo nodes
|
||||
// Propagate all pseudo nodes
|
||||
if n.Pseudo {
|
||||
return RenderableNodes{n.ID: n}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func MakeEndpointNodeID(hostID, address, port string) string {
|
||||
func MakeAddressNodeID(hostID, address string) string {
|
||||
var scope string
|
||||
|
||||
// Loopback addresses and addresses explicity marked as
|
||||
// Loopback addresses and addresses explicitly marked as
|
||||
// local get scoped by hostID
|
||||
addressIP := net.ParseIP(address)
|
||||
if addressIP != nil && LocalNetworks.Contains(addressIP) {
|
||||
|
||||
@@ -72,7 +72,7 @@ type Report struct {
|
||||
// before serving it to consumers.
|
||||
Window time.Duration
|
||||
|
||||
// Shortcut reports should be propogated to the UI as quickly as possible,
|
||||
// Shortcut reports should be propagated to the UI as quickly as possible,
|
||||
// bypassing the usual spy interval, publish interval and app ws interval.
|
||||
Shortcut bool
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/weaveworks/scope/test/reflect"
|
||||
)
|
||||
|
||||
// Poll repeatedly evaluates condition until we either timeout, or it suceeds.
|
||||
// Poll repeatedly evaluates condition until we either timeout, or it succeeds.
|
||||
func Poll(t *testing.T, d time.Duration, want interface{}, have func() interface{}) {
|
||||
deadline := time.Now().Add(d)
|
||||
for {
|
||||
|
||||
22
tools/lint
22
tools/lint
@@ -15,6 +15,7 @@ set -e
|
||||
|
||||
IGNORE_LINT_COMMENT=
|
||||
IGNORE_TEST_PACKAGES=
|
||||
IGNORE_SPELLINGS=
|
||||
while true; do
|
||||
case "$1" in
|
||||
-nocomment)
|
||||
@@ -25,6 +26,10 @@ while true; do
|
||||
IGNORE_TEST_PACKAGES=1
|
||||
shift 1
|
||||
;;
|
||||
-ignorespelling)
|
||||
IGNORE_SPELLINGS="$2,$IGNORE_SPELLINGS"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
break
|
||||
esac
|
||||
@@ -35,8 +40,21 @@ function spell_check {
|
||||
filename="$1"
|
||||
local lint_result=0
|
||||
|
||||
if grep -iH --color=always 'psueod\|availible' "${filename}"; then
|
||||
echo "${filename}: spelling mistake"
|
||||
# we don't want to spell check tar balls or binaries
|
||||
if file $filename | grep executable >/dev/null 2>&1; then
|
||||
return $lint_result
|
||||
fi
|
||||
if [[ $filename == *".tar" ]]; then
|
||||
return $lint_result
|
||||
fi
|
||||
|
||||
# misspell is completely optional. If you don't like it
|
||||
# don't have it installed.
|
||||
if ! type misspell >/dev/null 2>&1; then
|
||||
return $lint_result
|
||||
fi
|
||||
|
||||
if ! misspell -error -i "$IGNORE_SPELLINGS" "${filename}"; then
|
||||
lint_result=1
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ cached_image_rev() {
|
||||
find $CACHEDIR -name "$SAVEDNAME-*" -type f | sed -n 's/^[^\-]*\-\([a-z0-9]*\).gz$/\1/p'
|
||||
}
|
||||
|
||||
# Have there been any revision beween $1 and $2
|
||||
# Have there been any revision between $1 and $2
|
||||
has_changes() {
|
||||
local rev1=$1
|
||||
local rev2=$2
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
socks5 "github.com/armon/go-socks5"
|
||||
"github.com/docker/docker/pkg/mflag"
|
||||
"github.com/weaveworks/weave/common/mflagext"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type pacFileParameters struct {
|
||||
@@ -72,11 +73,11 @@ type aliasingResolver struct {
|
||||
socks5.NameResolver
|
||||
}
|
||||
|
||||
func (r aliasingResolver) Resolve(name string) (net.IP, error) {
|
||||
func (r aliasingResolver) Resolve(ctx context.Context, name string) (context.Context, net.IP, error) {
|
||||
if alias, ok := r.aliases[name]; ok {
|
||||
return r.NameResolver.Resolve(alias)
|
||||
return r.NameResolver.Resolve(ctx, alias)
|
||||
}
|
||||
return r.NameResolver.Resolve(name)
|
||||
return r.NameResolver.Resolve(ctx, name)
|
||||
}
|
||||
|
||||
func socksProxy(aliases map[string]string) {
|
||||
|
||||
Reference in New Issue
Block a user