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

Update zz_generated.deepcopy.go, also add new make target for the same #8267

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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ update-coredns: ## get latest coredns builds for each available eks version
update-ec2-info: ## get latest info on ec2 instance types
@go run cmd/ec2geninfo/main.go

.PHONY: update-deepcopy
update-deepcopy:
build/scripts/update-codegen.sh

deep_copy_helper_input = $(shell $(call godeps_cmd,./pkg/apis/...) | sed 's|$(generated_code_deep_copy_helper)||' )
$(generated_code_deep_copy_helper): $(deep_copy_helper_input) ## Generate Kubernetes API helpers
build/scripts/update-codegen.sh
Expand Down
29 changes: 5 additions & 24 deletions build/scripts/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,15 @@ set -o errexit
set -o nounset


SCRIPT_ROOT=$(git rev-parse --show-toplevel)
PROJECT_ROOT=$(git rev-parse --show-toplevel)

# Grab code-generator pkg
CODEGEN_PKG=$(go list -m -f '{{.Dir}}' 'k8s.io/code-generator')
echo ">> Using ${CODEGEN_PKG}"

# code-generator does work with go.mod but makes assumptions about
# the project living in `$GOPATH/src`. To work around this and support
# any location; create a temporary directory, use this as an output
# base, and copy everything back once generated.
TEMP_DIR=$(mktemp -d)
cleanup() {
echo ">> Removing ${TEMP_DIR}"
rm -rf "${TEMP_DIR}"
}
trap "cleanup" EXIT SIGINT

echo ">> Temporary output directory ${TEMP_DIR}"
source "${CODEGEN_PKG}/kube_codegen.sh"

# Ensure we can execute.
chmod +x "${CODEGEN_PKG}/generate-groups.sh"
chmod +x "${CODEGEN_PKG}/generate-internal-groups.sh"

GOPATH=$(go env GOPATH) "${CODEGEN_PKG}/generate-groups.sh" deepcopy,defaulter \
_ github.com/weaveworks/eksctl/pkg/apis \
eksctl.io:v1alpha5 \
--go-header-file <(printf "/*\n%s\n*/\n" "$(cat LICENSE)") \
--output-base "${TEMP_DIR}"

# Copy everything back.
cp -r "${TEMP_DIR}/github.com/weaveworks/eksctl/." "${SCRIPT_ROOT}/"
kube::codegen::gen_helpers \
--boilerplate <(printf "/*\n%s\n*/\n" "$(cat LICENSE)") \
"${PROJECT_ROOT}/pkg/apis"
41 changes: 41 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/zz_generated.deepcopy.go

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