-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: bitliu <bitliu@tencent.com>
- Loading branch information
Showing
34 changed files
with
2,802 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ out | |
bazel-bin | ||
bazel-out | ||
bazel-testlogs | ||
bazel-wasm-cpp | ||
bazel-wasm-cpp | ||
tools/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ header: | |
- 'plugins/**' | ||
- 'CODEOWNERS' | ||
- 'VERSION' | ||
- 'tools/' | ||
|
||
comment: on-failure | ||
dependency: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) 2022 Alibaba Group Holding Ltd. | ||
|
||
# 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. | ||
|
||
# cluster.conf | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
kubeadmConfigPatches: | ||
- | | ||
kind: InitConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "ingress-ready=true" | ||
extraPortMappings: | ||
- containerPort: 80 | ||
hostPort: 80 | ||
protocol: TCP | ||
- containerPort: 443 | ||
hostPort: 443 | ||
protocol: TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2022 Alibaba Group Holding Ltd. | ||
|
||
# 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. | ||
|
||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Setup default values | ||
CLUSTER_NAME=${CLUSTER_NAME:-"higress"} | ||
METALLB_VERSION=${METALLB_VERSION:-"v0.13.7"} | ||
KIND_NODE_TAG=${KIND_NODE_TAG:-"v1.25.3"} | ||
|
||
## Create kind cluster. | ||
if [[ -z "${KIND_NODE_TAG}" ]]; then | ||
tools/bin/kind create cluster --name "${CLUSTER_NAME}" --config=tools/hack/cluster.conf | ||
else | ||
tools/bin/kind create cluster --image "kindest/node:${KIND_NODE_TAG}" --name "${CLUSTER_NAME}" --config=tools/hack/cluster.conf | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright (c) 2022 Alibaba Group Holding Ltd. | ||
|
||
# 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. | ||
|
||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
readonly KIND=${KIND:-tools/bin/kind} | ||
readonly CLUSTER_NAME=${CLUSTER_NAME:-"higress"} | ||
|
||
# Docker variables | ||
readonly IMAGE="$1" | ||
readonly TAG="$2" | ||
|
||
# Wrap sed to deal with GNU and BSD sed flags. | ||
run::sed() { | ||
if sed --version </dev/null 2>&1 | grep -q GNU; then | ||
# GNU sed | ||
sed -i "$@" | ||
else | ||
# assume BSD sed | ||
sed -i '' "$@" | ||
fi | ||
} | ||
|
||
kind::cluster::exists() { | ||
${KIND} get clusters | grep -q "$1" | ||
} | ||
|
||
kind::cluster::load() { | ||
${KIND} load docker-image \ | ||
--name "${CLUSTER_NAME}" \ | ||
"$@" | ||
} | ||
|
||
if ! kind::cluster::exists "$CLUSTER_NAME" ; then | ||
echo "cluster $CLUSTER_NAME does not exist" | ||
exit 2 | ||
fi | ||
|
||
# Push the Higress image to the kind cluster. | ||
echo "Loading image ${IMAGE}:${TAG} to kind cluster ${CLUSTER_NAME}..." | ||
kind::cluster::load "${IMAGE}:${TAG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This is a wrapper to do lint checks | ||
# | ||
# All make targets related to lint are defined in this file. | ||
|
||
##@ Lint | ||
|
||
GITHUB_ACTION ?= | ||
|
||
.PHONY: lint | ||
lint: ## Run all linter of code sources, including golint, yamllint, whitenoise lint and codespell. | ||
|
||
# lint-deps is run separately in CI to separate the tooling install logs from the actual output logs generated | ||
# by the lint tooling. | ||
.PHONY: lint-deps | ||
lint-deps: ## Everything necessary to lint | ||
|
||
GOLANGCI_LINT_FLAGS ?= $(if $(GITHUB_ACTION),--out-format=github-actions) | ||
.PHONY: lint.golint | ||
lint: lint.golint | ||
lint-deps: $(tools/golangci-lint) | ||
lint.golint: $(tools/golangci-lint) | ||
$(tools/golangci-lint) run $(GOLANGCI_LINT_FLAGS) --config=tools/linter/golangci-lint/.golangci.yml | ||
|
||
.PHONY: lint.yamllint | ||
lint: lint.yamllint | ||
lint-deps: $(tools/yamllint) | ||
lint.yamllint: $(tools/yamllint) | ||
$(tools/yamllint) --config-file=tools/linter/yamllint/.yamllint $$(git ls-files :*.yml :*.yaml | xargs -L1 dirname | sort -u) | ||
|
||
CODESPELL_FLAGS ?= $(if $(GITHUB_ACTION),--disable-colors) | ||
.PHONY: lint.codespell | ||
lint: lint.codespell | ||
lint-deps: $(tools/codespell) | ||
lint.codespell: CODESPELL_SKIP := $(shell cat tools/linter/codespell/.codespell.skip | tr \\n ',') | ||
lint.codespell: $(tools/codespell) | ||
|
||
# This ::add-matcher/::remove-matcher business is based on | ||
# https://github.com/codespell-project/actions-codespell/blob/2292753ad350451611cafcbabc3abe387491339a/entrypoint.sh | ||
# We do this here instead of just using | ||
# codespell-project/codespell-problem-matcher@v1 so that the matcher | ||
# doesn't apply to the other linters that `make lint` also runs. | ||
# | ||
# This recipe is written a little awkwardly with everything running in | ||
# one shell, this is because we want the ::remove-matcher lines to get | ||
# printed whether or not it finds complaints. | ||
@PS4=; set -e; { \ | ||
if test -n "$$GITHUB_ACTION"; then \ | ||
printf '::add-matcher::$(CURDIR)/tools/linter/codespell/matcher.json\n'; \ | ||
trap "printf '::remove-matcher owner=codespell-matcher-default::\n::remove-matcher owner=codespell-matcher-specified::\n'" EXIT; \ | ||
fi; \ | ||
(set -x; $(tools/codespell) $(CODESPELL_FLAGS) --skip $(CODESPELL_SKIP) --ignore-words tools/linter/codespell/.codespell.ignorewords --check-filenames --check-hidden -q2); \ | ||
} | ||
|
||
.PHONY: lint.shellcheck | ||
lint: lint.shellcheck | ||
lint-deps: $(tools/shellcheck) | ||
lint.shellcheck: $(tools/shellcheck) | ||
$(tools/shellcheck) tools/hack/*.sh | ||
$(tools/shellcheck) script/*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
keypair | ||
keypairs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.git | ||
.idea | ||
*.png | ||
*.woff | ||
*.woff2 | ||
*.eot | ||
*.ttf | ||
*.jpg | ||
*.ico | ||
*.svg | ||
./docs/html/* | ||
go.mod | ||
go.sum | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "codespell-matcher-default", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+):(\\d+):\\s+(.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"message": 3 | ||
} | ||
] | ||
}, | ||
{ | ||
"owner": "codespell-matcher-specified", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(ERROR|WARNING):\\s+(.+):\\s+(.+?)\\s*$", | ||
"file": 3, | ||
"severity": 1, | ||
"message": 2 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
run: | ||
deadline: 10m | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
- gofmt | ||
- goimports | ||
- revive | ||
- gosec | ||
- misspell | ||
- exportloopref | ||
- unconvert | ||
- unparam | ||
- goheader | ||
- gocritic | ||
|
||
linters-settings: | ||
gci: | ||
sections: | ||
- standard # Captures all standard packages if they do not match another section. | ||
- default # Contains all imports that could not be matched to another section type. | ||
- prefix(github.com/alibaba/higress/) # Groups all imports with the specified Prefix. | ||
goimports: | ||
# put imports beginning with prefix after 3rd-party packages; | ||
# it's a comma-separated list of prefixes | ||
local-prefixes: github.com/alibaba/higress/ | ||
gofmt: | ||
simplify: true | ||
unparam: | ||
check-exported: false | ||
|
||
issues: | ||
exclude-rules: | ||
- path: zz_generated | ||
linters: | ||
- goimports | ||
- linters: | ||
- staticcheck | ||
text: "SA1019:" | ||
- path: test/e2e | ||
linters: | ||
- bodyclose | ||
# Show the complete output | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
Oops, something went wrong.