-
Notifications
You must be signed in to change notification settings - Fork 4
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: 佑祎 <[email protected]> Signed-off-by: 佑祎 <[email protected]>
- Loading branch information
1 parent
7d7b315
commit 150f127
Showing
78 changed files
with
8,487 additions
and
5 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor |
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,115 @@ | ||
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. | ||
ENVTEST_K8S_VERSION = 1.22 | ||
|
||
KOORD_VERSION ?= v0.7.0 | ||
|
||
# Set license header files. | ||
LICENSE_HEADER_GO ?= hack/boilerplate/boilerplate.go.txt | ||
|
||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
GOBIN=$(shell go env GOPATH)/bin | ||
else | ||
GOBIN=$(shell go env GOBIN) | ||
endif | ||
|
||
# Setting SHELL to bash allows bash commands to be executed by recipes. | ||
# This is a requirement for 'setup-envtest.sh' in the test target. | ||
# Options are set to exit when a recipe line exits non-zero or a piped command fails. | ||
SHELL = /usr/bin/env bash -o pipefail | ||
.SHELLFLAGS = -ec | ||
|
||
.PHONY: all | ||
all: clone generate mod fmt vet lint | ||
|
||
##@ General | ||
|
||
# The help target prints out all targets with their descriptions organized | ||
# beneath their categories. The categories are represented by '##@' and the | ||
# target descriptions by '##'. The awk commands is responsible for reading the | ||
# entire set of makefiles included in this invocation, looking for lines of the | ||
# file as xyz: ## something, and then pretty-format the target and help. Then, | ||
# if there's a line with ##@ something, that gets pretty-printed as a category. | ||
# More info on the usage of ANSI control characters for terminal formatting: | ||
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters | ||
# More info on the awk command: | ||
# http://linuxcommand.org/lc3_adv_awk.php | ||
|
||
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
##@ Development | ||
|
||
.PHONY: clone | ||
clone: ## Clone api files from koordinator-sh/koordinator/apis repo and replace package cross imports | ||
@hack/clone-api-files.sh $(KOORD_VERSION) | ||
@hack/replace-import-repo.sh | ||
|
||
.PHONY: mod | ||
mod: ## Clone api files from koordinator-sh/koordinator/apis repo and replace package cross imports | ||
@go mod tidy -compat=1.17 | ||
|
||
.PHONY: generate | ||
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
$(CONTROLLER_GEN) object:headerFile="$(LICENSE_HEADER_GO)" paths="./..." | ||
@hack/update-codegen.sh | ||
|
||
.PHONY: fmt | ||
fmt: ## Run go fmt against code. | ||
go fmt ./... | ||
|
||
.PHONY: vet | ||
vet: ## Run go vet against code. | ||
go vet ./... | ||
|
||
.PHONY: lint | ||
lint: lint-go lint-license ## Lint all code. | ||
|
||
.PHONY: lint-go | ||
lint-go: golangci-lint ## Lint Go code. | ||
$(GOLANGCI_LINT) run -v --timeout=10m | ||
|
||
.PHONY: lint-license | ||
lint-license: | ||
@hack/update-license-header.sh | ||
|
||
##@ Build Dependencies | ||
|
||
## Location to install dependencies to | ||
LOCALBIN ?= $(shell pwd)/bin | ||
$(LOCALBIN): | ||
mkdir -p $(LOCALBIN) | ||
|
||
## Tool Binaries | ||
KUSTOMIZE ?= $(LOCALBIN)/kustomize | ||
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen | ||
ENVTEST ?= $(LOCALBIN)/setup-envtest | ||
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint | ||
HACK_DIR ?= $(PWD)/hack | ||
|
||
## Tool Versions | ||
KUSTOMIZE_VERSION ?= v3.8.7 | ||
CONTROLLER_TOOLS_VERSION ?= v0.8.0 | ||
GOLANGCILINT_VERSION ?= v1.47.3 | ||
|
||
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | ||
.PHONY: kustomize | ||
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. | ||
$(KUSTOMIZE): $(LOCALBIN) | ||
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN) | ||
|
||
.PHONY: controller-gen | ||
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. | ||
$(CONTROLLER_GEN): $(LOCALBIN) | ||
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) | ||
|
||
.PHONY: envtest | ||
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. | ||
$(ENVTEST): $(LOCALBIN) | ||
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
||
.PHONY: golangci-lint | ||
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. | ||
$(GOLANGCI_LINT): $(LOCALBIN) | ||
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION) |
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 |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# apis | ||
The APIs of Koordinator | ||
# koordinator-api | ||
|
||
Schema of the API types that are served by Koordinator. | ||
|
||
## Purpose | ||
|
||
This library is the canonical location of the Koordinator API definition. | ||
|
||
We recommend using the go types in this repo. You may serialize them directly to JSON. | ||
|
||
## Where does it come from? | ||
|
||
`koordinator-sh/api` is synced from [https://github.com/koordinator-sh/koordinator/apis](https://github.com/koordinator-sh/koordinator/tree/master/apis). | ||
All modification Code changes are made in origin location(`koordinator-sh/koordinator/apis`), then merged into `koordinator-sh/apis` later. | ||
|
||
## For Koordinator developers | ||
`koordinator-sh/apis` is a read-only repo. Please contribute to [https://github.com/koordinator-sh/koordinator/tree/master/apis](https://github.comkoordinator-sh/koordinator/tree/master/apis) | ||
if you have new features to develop. API Changes will be synced to `koordinator-sh/apis` when there is new version released of Koordinator . | ||
|
||
## For Koordinator maintainers | ||
To update Koordinator API repo. | ||
1. (optional) add more api directories to clone, append source and destination to API_PATHS_MAP in clone-api-files.sh | ||
```shell script | ||
# vim hack/clone-api-files.sh | ||
API_PATHS_MAP=( | ||
"apis/slo:slo" | ||
) | ||
``` | ||
|
||
2. move API files from `koordinator-sh/koordinator/apis` with specified version tag | ||
```shell script | ||
make clone KOORD_VERSION=v0.7.0 | ||
``` | ||
3. generate deepcopy and clients for API files | ||
```shell script | ||
make generate | ||
``` | ||
4. (optional)update go.mod | ||
```shell script | ||
make mod | ||
``` | ||
5. create a pull request to merge new files | ||
6. create tag for new commit and push | ||
```shell script | ||
git tag ${version-tag} | ||
git push --tags | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.