Skip to content

Commit

Permalink
init project from kruise-api
Browse files Browse the repository at this point in the history
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
  • Loading branch information
furykerry committed Jan 19, 2024
1 parent f4cd0a2 commit 253a6ef
Show file tree
Hide file tree
Showing 50 changed files with 5,732 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/schema-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update schema files when api changes

on:
push:
branches:
- master
paths:
- 'rollouts/**'

jobs:
update-schemas:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Update Schema
run: |
go mod tidy
make gen-openapi-schema
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Updated OpenAPI schema files
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
/bin/

# Test binary, built 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/

.idea/
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
CURRENT_DIR=$(shell pwd)
# 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

# Run go vet against code
vet:
go vet ./...

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
@hack/generate_client.sh

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
ifeq ("$(shell $(CONTROLLER_GEN) --version 2> /dev/null)", "Version: v0.7.0")
else
rm -rf $(CONTROLLER_GEN)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
endif

OPENAPI_GEN = $(shell pwd)/bin/openapi-gen
module=$(shell go list -f '{{.Module}}' k8s.io/kube-openapi/cmd/openapi-gen | awk '{print $$1}')
module_version=$(shell go list -m $(module) | awk '{print $$NF}' | head -1)
openapi-gen: ## Download openapi-gen locally if necessary.
ifeq ("$(shell command -v $(OPENAPI_GEN) 2> /dev/null)", "")
$(call go-get-tool,$(OPENAPI_GEN),k8s.io/kube-openapi/cmd/openapi-gen@$(module_version))
else
@echo "openapi-gen is already installed."
endif

# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef

.PHONY: gen-schema-only
gen-schema-only:
go run cmd/gen-schema/main.go

.PHONY: gen-openapi-schema
gen-openapi-schema: gen-rollouts-openapi
go run cmd/gen-schema/main.go

.PHONY: gen-rollouts-openapi
gen-rollouts-openapi: openapi-gen
$(OPENAPI_GEN) \
--go-header-file hack/boilerplate.go.txt \
--input-dirs github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1 \
--output-package pkg/rollouts/ \
--report-filename pkg/rollouts/violation_exceptions.list \
-o $(CURRENT_DIR)
9 changes: 9 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See: https://go.k8s.io/owners
approvers:
- furykerry
- zmberg
- veophi
reviewers:
- furykerry
- zmberg
- veophi
26 changes: 26 additions & 0 deletions addtoscheme_rollouts_v1alphal1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2022 The Kruise 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.
*/

package apis

import (
"github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
}
97 changes: 97 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.

85 changes: 85 additions & 0 deletions client/clientset/versioned/fake/clientset_generated.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/fake/doc.go

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

Loading

0 comments on commit 253a6ef

Please sign in to comment.