Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix make update error #181

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ go.work.sum

# Project Specific
*.csv

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
/bin
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ KARPENTER_CORE_DIR = $(shell go list -m -f '{{ .Dir }}' sigs.k8s.io/karpenter)
# TEST_SUITE enables you to select a specific test suite directory to run "make e2etests" against
TEST_SUITE ?= "..."

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

## Tool Binaries
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen

## Tool Versions
CONTROLLER_TOOLS_VERSION ?= v0.16.4

help: ## Display help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\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)

Expand All @@ -39,7 +50,14 @@ run: ## Run Karpenter controller binary against your local cluster
FEATURE_GATES="SpotToSpotConsolidation=true" \
go run ./cmd/controller/main.go

update: tidy download ## Update go files header, CRD and generated code
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

update: tidy download generate ## Update go files header, CRD and generated code
hack/boilerplate.sh
hack/update-generated.sh

Expand Down Expand Up @@ -80,7 +98,7 @@ download: ## Run "go mod download"
codegen: ## Auto generate files based on AlibabaCloud APIs
./hack/codegen.sh

.PHONY: help presubmit run ut-test coverage update verify image apply delete toolchain tidy download
.PHONY: help presubmit run ut-test coverage update verify image apply delete toolchain tidy download controller-gen generate

define newline

Expand Down
10 changes: 4 additions & 6 deletions hack/update-generated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

set -eu -o pipefail

LOCALBIN=$(pwd)/bin
CONTROLLER_GEN=${LOCALBIN}/controller-gen

# Update CRD
controller-gen crd paths=./pkg/apis/v1alpha1/... output:crd:dir=./charts/karpenter/crds
${CONTROLLER_GEN} crd paths=./pkg/apis/v1alpha1/... output:crd:dir=./charts/karpenter/crds

# Update generated code
export REPO_ROOT=$(pwd)
Expand All @@ -22,8 +25,3 @@ mkdir -p "${GO_PKG_DIR}"
if [[ ! -e "${GO_PKG_DIR}" || "$(readlink "${GO_PKG_DIR}")" != "${REPO_ROOT}" ]]; then
ln -snf "${REPO_ROOT}" "${GO_PKG_DIR}"
fi

deepcopy-gen \
--go-header-file hack/boilerplate.go.txt \
--output-file-base zz_generated.deepcopy \
--input-dirs github.com/cloudpilot-ai/karpenter-provider-alibabacloud/pkg/apis/v1alpha1
25 changes: 6 additions & 19 deletions pkg/apis/v1alpha1/zz_generated.deepcopy.go

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

Loading