Skip to content

Commit

Permalink
Add spell check script to hack (antrea-io#539)
Browse files Browse the repository at this point in the history
Add spell check script to hack

Add a script to check commonly misspelled English words and add it to Github workflow
  • Loading branch information
abhiraut committed Mar 25, 2020
1 parent 1a73ecc commit 1673df4
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 20 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/go.yml
Expand Up @@ -139,3 +139,19 @@ jobs:

- name: Check tidy
run: make test-tidy

verify-spelling:
name: Verify common spelling mistakes
runs-on: [ubuntu-18.04]
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13

- name: Check-out code
uses: actions/checkout@v2

- name: Run verify scripts
run: make verify-spelling
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -191,3 +191,8 @@ octant-antrea-ubuntu:
@echo "===> Building antrea/octant-antrea-ubuntu Docker image <==="
docker build -t antrea/octant-antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.octant.ubuntu .
docker tag antrea/octant-antrea-ubuntu:$(DOCKER_IMG_VERSION) antrea/octant-antrea-ubuntu

.PHONY: verify-spelling
verify-spelling:
@echo "===> Verifying spellings <==="
$(CURDIR)/hack/verify-spelling.sh
2 changes: 1 addition & 1 deletion ROADMAP.md
Expand Up @@ -43,5 +43,5 @@ OVS datapath performance.
Leverage OVS with DPDK or AF_XDP for high performance.

* **OVS hardware offloading**
Enable hardware accelaration of the NICs that support OVS offloading.
Enable hardware acceleration of the NICs that support OVS offloading.

8 changes: 4 additions & 4 deletions build/yamls/antrea-eks.yml
Expand Up @@ -266,7 +266,7 @@ data:
#tunnelType: vxlan
# Default MTU to use for the host gateway interface and the network interface of each Pod. If
# omitted, antrea-agent will default this value to 1450 to accomodate for tunnel encapsulate
# omitted, antrea-agent will default this value to 1450 to accommodate for tunnel encapsulate
# overhead.
#defaultMTU: 1450
Expand Down Expand Up @@ -301,7 +301,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-kd2dgdtg74
name: antrea-config-57hfkfg8kd
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -394,7 +394,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-kd2dgdtg74
name: antrea-config-57hfkfg8kd
name: antrea-config
---
apiVersion: apiregistration.k8s.io/v1
Expand Down Expand Up @@ -578,7 +578,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-kd2dgdtg74
name: antrea-config-57hfkfg8kd
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
8 changes: 4 additions & 4 deletions build/yamls/antrea-ipsec.yml
Expand Up @@ -266,7 +266,7 @@ data:
tunnelType: gre
# Default MTU to use for the host gateway interface and the network interface of each Pod. If
# omitted, antrea-agent will default this value to 1450 to accomodate for tunnel encapsulate
# omitted, antrea-agent will default this value to 1450 to accommodate for tunnel encapsulate
# overhead.
#defaultMTU: 1450
Expand Down Expand Up @@ -301,7 +301,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-2g768b876h
name: antrea-config-f59cfh8thg
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -403,7 +403,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-2g768b876h
name: antrea-config-f59cfh8thg
name: antrea-config
---
apiVersion: apiregistration.k8s.io/v1
Expand Down Expand Up @@ -619,7 +619,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-2g768b876h
name: antrea-config-f59cfh8thg
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
8 changes: 4 additions & 4 deletions build/yamls/antrea.yml
Expand Up @@ -266,7 +266,7 @@ data:
#tunnelType: vxlan
# Default MTU to use for the host gateway interface and the network interface of each Pod. If
# omitted, antrea-agent will default this value to 1450 to accomodate for tunnel encapsulate
# omitted, antrea-agent will default this value to 1450 to accommodate for tunnel encapsulate
# overhead.
#defaultMTU: 1450
Expand Down Expand Up @@ -301,7 +301,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-5gb7c9t5kg
name: antrea-config-b2b5bdkh8t
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -394,7 +394,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-5gb7c9t5kg
name: antrea-config-b2b5bdkh8t
name: antrea-config
---
apiVersion: apiregistration.k8s.io/v1
Expand Down Expand Up @@ -578,7 +578,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-5gb7c9t5kg
name: antrea-config-b2b5bdkh8t
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
2 changes: 1 addition & 1 deletion build/yamls/base/conf/antrea-agent.conf
Expand Up @@ -21,7 +21,7 @@
#tunnelType: vxlan

# Default MTU to use for the host gateway interface and the network interface of each Pod. If
# omitted, antrea-agent will default this value to 1450 to accomodate for tunnel encapsulate
# omitted, antrea-agent will default this value to 1450 to accommodate for tunnel encapsulate
# overhead.
#defaultMTU: 1450

Expand Down
2 changes: 1 addition & 1 deletion ci/kind/kind-setup.sh
Expand Up @@ -46,7 +46,7 @@ where:
--antrea-cni: specifies install Antrea CNI in kind cluster, default is true.
--num-workers: specifies number of worker nodes in kind cluster, default is $NUM_WORKERS
--images: specifies images loaded to kind cluster, default is $IMAGES
--subnets: a subnet creates a seperate docker bridge network with assigned subnet that worker nodes may connect to. Default is empty all worker
--subnets: a subnet creates a separate docker bridge network with assigned subnet that worker nodes may connect to. Default is empty all worker
Node connected to docker0 bridge network
"

Expand Down
4 changes: 2 additions & 2 deletions docs/ovs-pipeline.md
Expand Up @@ -143,7 +143,7 @@ If you dump the flows for this table, you may see the following:
```

Flow 1 is for traffic coming in on the local gateway. Flow 2 is for traffic
comming in through a VXLAN or Geneve tunnel (i.e. from another Node). The next
coming in through a VXLAN or Geneve tunnel (i.e. from another Node). The next
two flows (3 and 4) are for local Pods (in this case Pods from the coredns
deployment).

Expand All @@ -169,7 +169,7 @@ on the local gateway port is not as trivial. Traffic from local Pods destined to
services will first go through the gateway, get load-balanced by the kube-proxy
datapath (DNAT) then sent back through the gateway. This means that legitimate
traffic can be received on the gateway port with a source IP belonging to a
local Pod. We may add some fine-grained rules in the future to accomodate for
local Pod. We may add some fine-grained rules in the future to accommodate for
this, but for now we just allow all IP traffic received from the gateway. We do
have an ARP spoofing check for the gateway however, since there is no reason for
the host to advertise a different MAC address on gw0.
Expand Down
12 changes: 12 additions & 0 deletions hack/.spelling_failures
@@ -0,0 +1,12 @@
CHANGELOG
CODE_OF_CONDUCT
GOVERNANCE
LICENSE
MAINTAINERS
go.mod
go.sum
clientset_generated
generated_expansion
generated.pb.go
generated.proto
zz_generated
4 changes: 2 additions & 2 deletions hack/terraform-eks.sh
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: terraform enviroment variables need to be set
# NOTE: terraform environment variables need to be set
AWS_CLI="aws"
TERRAFORM="terraform"
KUBECTL="kubectl"
Expand Down Expand Up @@ -55,7 +55,7 @@ function validate {
for env in ${ENV_ARRAY[@]}; do
printenv $env > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo required enviroment variable $env is not set.
echo required environment variable $env is not set.
exit 1
fi
done
Expand Down
54 changes: 54 additions & 0 deletions hack/verify-spelling.sh
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

# Copyright 2020 Antrea Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script checks commonly misspelled English words. This script is a
# slight modification of the kubernetes/hack/verify-spelling.sh.

set -o errexit
set -o nounset
set -o pipefail

TOOL_VERSION="v0.3.4"

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${ROOT}"

TMP_DIR=$(mktemp -d)

exitHandler() (
echo "Cleaning up temporary directory"
rm -rf "${TMP_DIR}"
)
trap exitHandler EXIT

cd "${TMP_DIR}"
GO111MODULE=on GOBIN="${TMP_DIR}" go get "github.com/client9/misspell/cmd/misspell@${TOOL_VERSION}"
export PATH="${TMP_DIR}:${PATH}"
cd "${ROOT}"

# Check spelling and ignore skipped files.
RES=0
echo "Spell check start"
ERROR_LOG="${TMP_DIR}/errors.log"
skipping_file="${ROOT}/hack/.spelling_failures"
failing_packages=$(sed "s| | -e |g" "${skipping_file}")
git ls-files | grep -v -e "${failing_packages}"| xargs misspell > "${ERROR_LOG}"
if [[ -s "${ERROR_LOG}" ]]; then
sed 's/^/error: /' "${ERROR_LOG}"
echo "Found spelling errors!"
RES=1
fi
exit "${RES}"
Expand Up @@ -26,7 +26,7 @@
when: kubeconfig_diff.changed

# We copy the config file last, as we use it to determine whether the join was
# succesful in future runs.
# successful in future runs.
- name: Setup kubeconfig for test user
block:
- name: Create /home/{{ test_user }}/.kube directory
Expand Down

0 comments on commit 1673df4

Please sign in to comment.