Skip to content

Commit

Permalink
release v0.7.0 api (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: 佑祎 <zzw261520@alibaba-inc.com>

Signed-off-by: 佑祎 <zzw261520@alibaba-inc.com>
  • Loading branch information
zwzhang0107 committed Oct 12, 2022
1 parent 7d7b315 commit 150f127
Show file tree
Hide file tree
Showing 78 changed files with 8,487 additions and 5 deletions.
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@
*.dll
*.so
*.dylib
bin
testbin/*

# Test binary, built with `go test -c`
# Go dependencies folder
vendor

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

.vscode
.DS_Store

dist/

README-contributing.md
1 change: 1 addition & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor
115 changes: 115 additions & 0 deletions Makefile
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)
49 changes: 47 additions & 2 deletions README.md
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://git.luolix.topkoordinator-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
```
125 changes: 125 additions & 0 deletions client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions client/clientset/versioned/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 150f127

Please sign in to comment.