Skip to content

Commit 6b37d32

Browse files
authored
Use go 1.24 tool command for code-generator/controller-gen (#717)
Signed-off-by: Mikkel Oscar Lyderik Larsen <[email protected]>
1 parent f07f9d5 commit 6b37d32

File tree

6 files changed

+41
-54
lines changed

6 files changed

+41
-54
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $(GENERATED): go.mod $(CRD_TYPE_SOURCE)
3535
./hack/update-codegen.sh
3636

3737
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
38-
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd:crdVersions=v1,allowDangerousTypes=true paths=./pkg/apis/... output:crd:dir=docs
38+
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true paths=./pkg/apis/... output:crd:dir=docs
3939
go run hack/crd/trim.go < docs/zalando.org_stacksets.yaml > docs/stackset_crd.yaml
4040
go run hack/crd/trim.go < docs/zalando.org_stacks.yaml > docs/stack_crd.yaml
4141
rm docs/zalando.org_stacksets.yaml docs/zalando.org_stacks.yaml

docs/stack_crd.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,11 +1096,6 @@ spec:
10961096
type: object
10971097
x-kubernetes-map-type: atomic
10981098
namespaces:
1099-
description: |-
1100-
namespaces specifies a static list of namespace names that the term applies to.
1101-
The term is applied to the union of the namespaces listed in this field
1102-
and the ones selected by namespaceSelector.
1103-
null or empty namespaces list and null namespaceSelector means "this pod's namespace".
11041099
items:
11051100
type: string
11061101
type: array
@@ -6156,12 +6151,6 @@ spec:
61566151
properties:
61576152
name:
61586153
default: ""
6159-
description: |-
6160-
Name of the referent.
6161-
This field is effectively required, but due to backwards compatibility is
6162-
allowed to be empty. Instances of this type with an empty value here are
6163-
almost certainly wrong.
6164-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
61656154
type: string
61666155
type: object
61676156
x-kubernetes-map-type: atomic
@@ -6293,6 +6282,12 @@ spec:
62936282
properties:
62946283
name:
62956284
default: ""
6285+
description: |-
6286+
Name of the referent.
6287+
This field is effectively required, but due to backwards compatibility is
6288+
allowed to be empty. Instances of this type with an empty value here are
6289+
almost certainly wrong.
6290+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
62966291
type: string
62976292
type: object
62986293
x-kubernetes-map-type: atomic
@@ -6625,12 +6620,6 @@ spec:
66256620
properties:
66266621
name:
66276622
default: ""
6628-
description: |-
6629-
Name of the referent.
6630-
This field is effectively required, but due to backwards compatibility is
6631-
allowed to be empty. Instances of this type with an empty value here are
6632-
almost certainly wrong.
6633-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
66346623
type: string
66356624
type: object
66366625
x-kubernetes-map-type: atomic
@@ -7243,6 +7232,12 @@ spec:
72437232
properties:
72447233
name:
72457234
default: ""
7235+
description: |-
7236+
Name of the referent.
7237+
This field is effectively required, but due to backwards compatibility is
7238+
allowed to be empty. Instances of this type with an empty value here are
7239+
almost certainly wrong.
7240+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
72467241
type: string
72477242
type: object
72487243
x-kubernetes-map-type: atomic
@@ -7290,6 +7285,12 @@ spec:
72907285
properties:
72917286
name:
72927287
default: ""
7288+
description: |-
7289+
Name of the referent.
7290+
This field is effectively required, but due to backwards compatibility is
7291+
allowed to be empty. Instances of this type with an empty value here are
7292+
almost certainly wrong.
7293+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
72937294
type: string
72947295
type: object
72957296
x-kubernetes-map-type: atomic

docs/stackset_crd.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,13 @@ spec:
23312331
localhostProfile:
23322332
type: string
23332333
type:
2334+
description: |-
2335+
type indicates which kind of seccomp profile will be applied.
2336+
Valid options are:
2337+
2338+
Localhost - a profile defined in a file on the node should be used.
2339+
RuntimeDefault - the container runtime default profile should be used.
2340+
Unconfined - no profile should be applied.
23342341
type: string
23352342
required:
23362343
- type
@@ -3694,13 +3701,6 @@ spec:
36943701
localhostProfile:
36953702
type: string
36963703
type:
3697-
description: |-
3698-
type indicates which kind of seccomp profile will be applied.
3699-
Valid options are:
3700-
3701-
Localhost - a profile defined in a file on the node should be used.
3702-
RuntimeDefault - the container runtime default profile should be used.
3703-
Unconfined - no profile should be applied.
37043704
type: string
37053705
required:
37063706
- type

go.mod

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ require (
1515
k8s.io/api v0.34.1
1616
k8s.io/apimachinery v0.34.1
1717
k8s.io/client-go v0.34.1
18-
k8s.io/code-generator v0.34.1
19-
sigs.k8s.io/controller-tools v0.19.0
2018
sigs.k8s.io/yaml v1.6.0
2119
)
2220

@@ -74,11 +72,22 @@ require (
7472
gopkg.in/yaml.v2 v2.4.0 // indirect
7573
gopkg.in/yaml.v3 v3.0.1 // indirect
7674
k8s.io/apiextensions-apiserver v0.34.0 // indirect
75+
k8s.io/code-generator v0.34.1 // indirect
7776
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
7877
k8s.io/klog/v2 v2.130.1 // indirect
7978
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
8079
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
80+
sigs.k8s.io/controller-tools v0.19.0 // indirect
8181
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
8282
sigs.k8s.io/randfill v1.0.0 // indirect
8383
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
8484
)
85+
86+
tool (
87+
k8s.io/code-generator
88+
k8s.io/code-generator/cmd/client-gen
89+
k8s.io/code-generator/cmd/deepcopy-gen
90+
k8s.io/code-generator/cmd/informer-gen
91+
k8s.io/code-generator/cmd/lister-gen
92+
sigs.k8s.io/controller-tools/cmd/controller-gen
93+
)

hack/tools.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

hack/update-codegen.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ APIS_PKG="${GOPKG}/pkg/apis"
3131
GROUPS_WITH_VERSIONS="${CUSTOM_RESOURCE_NAME}:${CUSTOM_RESOURCE_VERSION}"
3232

3333
echo "Generating deepcopy funcs"
34-
go run k8s.io/code-generator/cmd/deepcopy-gen \
34+
go tool deepcopy-gen \
3535
--output-file zz_generated.deepcopy.go \
3636
--bounding-dirs "${APIS_PKG}" \
3737
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
3838
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
3939

4040
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
41-
go run k8s.io/code-generator/cmd/client-gen \
41+
go tool client-gen \
4242
--clientset-name versioned \
4343
--input-base "" \
4444
--input "${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}" \
@@ -47,14 +47,14 @@ go run k8s.io/code-generator/cmd/client-gen \
4747
--output-dir "${OUTPUT_DIR}/clientset"
4848

4949
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
50-
go run k8s.io/code-generator/cmd/lister-gen \
50+
go tool lister-gen \
5151
--output-pkg "${OUTPUT_PKG}/listers" \
5252
--go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
5353
--output-dir "${OUTPUT_DIR}/listers" \
5454
"${APIS_PKG}/${CUSTOM_RESOURCE_NAME}/${CUSTOM_RESOURCE_VERSION}"
5555

5656
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
57-
go run k8s.io/code-generator/cmd/informer-gen \
57+
go tool informer-gen \
5858
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
5959
--listers-package "${OUTPUT_PKG}/listers" \
6060
--output-pkg "${OUTPUT_PKG}/informers" \

0 commit comments

Comments
 (0)