Skip to content

Commit d5027db

Browse files
authored
Adds a command to generate the zz_generated.deepcopy.go files for the apis (googleforgames#3900)
* Adds a command to generate the zz_generated.deepcopy.go files for the apis * Combines CRD client and deepcopy code generation into one script * Updates boilerplate headers to 2024 * Generated code from gen-all-sdk-grpc * Small update to template comment
1 parent 8ca6ffd commit d5027db

File tree

188 files changed

+220
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+220
-203
lines changed

.github/ISSUE_TEMPLATE/kubernetes_update.md

+3-3

build/Makefile

+19-10
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,12 @@ gen-install: $(ensure-build-image)
738738
--set agones.crds.cleanupOnDelete=false \
739739
> $(mount_path)/install/yaml/install.yaml'
740740

741-
# Generate the client for our CustomResourceDefinition
742-
gen-crd-client: $(ensure-build-image)
741+
# Generate the client, conversions, deepcopy, and defaults code for our CustomResourceDefinition
742+
gen-crd-code: $(ensure-build-image)
743743
docker run --rm \
744744
$(common_mounts) -w $(workdir_path) $(build_tag) bash -c "\
745745
$(git_safe) && \
746-
/root/gen-crd-client.sh && \
746+
/root/gen-crd-code.sh && \
747747
cd $(workdir_path)/pkg && goimports -w ."
748748

749749
# Run a bash shell with the developer tools in it. (Creates the image if it doesn't exist)
@@ -848,14 +848,23 @@ update-go-deps:
848848
$(DOCKER_RUN) go mod tidy
849849
$(DOCKER_RUN) go mod vendor
850850

851-
test-gen-crd-client:
852-
mkdir -p build/tmp
853-
mv ../pkg/client build/tmp
854-
make gen-crd-client
855-
diff_output=$$(diff -bBr build/tmp/client ../pkg/client); \
856-
if [ -z "$$diff_output" ]; then \
857-
echo "No differences found. Deleting build/tmp"; \
851+
test-gen-crd-code:
852+
mkdir -p build/tmp/apis | mkdir -p build/tmp/client; \
853+
cp -r ../pkg/apis/* build/tmp/apis | cp -r ../pkg/client/* build/tmp/client; \
854+
make gen-crd-code; \
855+
$(MAKE) diff-directory DIRECTORY=apis
856+
$(MAKE) diff-directory DIRECTORY=client
857+
# Delete build/tmp if the directory is empty
858+
if [ ! "$(ls -A build/tmp)" ]; then \
859+
echo "No differences found. Deleting empty directory build/tmp."; \
858860
rm -r build/tmp; \
861+
fi
862+
863+
diff-directory:
864+
diff_output=$$(diff -bBr build/tmp/$(DIRECTORY) ../pkg/$(DIRECTORY)); \
865+
if [ -z "$$diff_output" ]; then \
866+
echo "No differences found. Deleting build/tmp/$(DIRECTORY)"; \
867+
rm -r build/tmp/$(DIRECTORY); \
859868
else \
860869
echo "Differences found."; \
861870
echo "$$diff_output"; \

build/README.md

+4-4

build/boilerplate.go.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Google LLC All Rights Reserved.
1+
// Copyright 2024 Google LLC All Rights Reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

build/boilerplate.yaml.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 Google LLC All Rights Reserved.
1+
# Copyright 2024 Google LLC All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

build/build-image/gen-crd-client.sh build/build-image/gen-crd-code.sh

+8
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ kube::codegen::gen_client \
3838
/go/src/agones.dev/agones/pkg/apis
3939

4040
echo "CRD client code generation complete."
41+
42+
echo "Generating CRD conversions, deepcopy, and defaults code..."
43+
44+
kube::codegen::gen_helpers \
45+
--boilerplate /go/src/agones.dev/agones/build/boilerplate.go.txt \
46+
/go/src/agones.dev/agones/pkg/apis
47+
48+
echo "CRD conversions, deepcopy, and defaults code generation complete."

cloudbuild.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ steps:
116116
# Preventing Broken PR Merges in CI
117117
#
118118
- name: make-docker
119-
id: test-gen-crd-client
119+
id: test-gen-crd-code
120120
waitFor: [pull-build-image]
121121
dir: build
122-
args: [test-gen-crd-client]
122+
args: [test-gen-crd-code]
123123

124124
#
125125
# Runs the linter -- but also builds the build image, if not able to download
@@ -128,7 +128,7 @@ steps:
128128
id: lint
129129
waitFor:
130130
- pull-build-image
131-
- test-gen-crd-client
131+
- test-gen-crd-code
132132
- test-gen-all-sdk-grpc
133133
dir: build
134134
args: [lint] # pull the build image if it exists

pkg/apis/agones/v1/zz_generated.deepcopy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/allocation/v1/zz_generated.deepcopy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/autoscaling/v1/zz_generated.deepcopy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/multicluster/v1/zz_generated.deepcopy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/aggregatedcounterstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/aggregatedliststatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/aggregatedplayerstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/allocationoverflow.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/counterstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/eviction.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/fleet.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/fleetspec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/fleetstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserver.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserverport.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserverset.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserversetspec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserversetstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserverspec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserverstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameserverstatusport.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/gameservertemplatespec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/health.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/liststatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/playersspec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/playerstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/priority.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/agones/v1/sdkserver.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/bufferpolicy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/counterpolicy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fixedintervalsync.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fleetautoscaler.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerpolicy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerspec.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalerstatus.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/fleetautoscalersync.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/listpolicy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/autoscaling/v1/webhookpolicy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/internal/internal.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/applyconfiguration/multicluster/v1/clusterconnectioninfo.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)