Skip to content

Commit 04223b6

Browse files
committed
codegen: Remove pre-v1.31 hacks
We no longer need a temporary 'core' symlink for generating clients for a single group. We no longer need to delete the generated clientsets, as we're now using the same k8s version in the package as the generator, which is the intended usage.
1 parent 663ba86 commit 04223b6

File tree

113 files changed

+9147
-46
lines changed

Some content is hidden

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

113 files changed

+9147
-46
lines changed

hack/update-codegen.sh

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,13 @@ trap 'rm -r "${tempdir}"' EXIT
6666
openapi="${tempdir}/openapi.json"
6767
go run "${PROJECT_ROOT}/hack/codegen/cmd/models-schema/main.go" > "$openapi"
6868

69-
# This hack is required until we're using k8s.io/code-generator containing
70-
# https://github.com/kubernetes/kubernetes/pull/125162, which should be v0.31
71-
ln -s "${PROJECT_ROOT}/api" "${PROJECT_ROOT}/core"
72-
trap 'rm "${PROJECT_ROOT}/core"' EXIT
73-
7469
kube::codegen::gen_client \
7570
--with-applyconfig \
71+
--with-watch \
7672
--applyconfig-openapi-schema "$openapi" \
7773
--output-dir "${PROJECT_ROOT}/${GENERATED_PKG}" \
7874
--output-pkg sigs.k8s.io/cluster-api-provider-openstack/${GENERATED_PKG} \
7975
--versioned-name clientset \
8076
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
8177
--one-input-api "api" \
8278
"${PROJECT_ROOT}"
83-
84-
# Add --with-watch to the above command line to generate informers and listers.
85-
# It's not worth doing that now until we can remove the hack below which
86-
# deletes the clientset.
87-
# --with-watch \
88-
89-
# The hack below is required until CAPO is using the same version of the k/k
90-
# libraries as the code-generator we're using in this utility module.
91-
#
92-
# code-generator generates code targetting the version of kubernetes it is
93-
# built from. We are fortunate that the generated applyconfiguration builds
94-
# against older libraries. However, the generated clientset does not. As we
95-
# aren't yet using the clientset we just delete it for now.
96-
#
97-
# We could avoid generating it in the first place, but then we wouldn't be able
98-
# to use kube_codegen.sh. We leave it like this as we expect to update to a
99-
# sufficiently new k/k in the relatively near future.
100-
rm -r "${PROJECT_ROOT}/${GENERATED_PKG}/clientset"

orc/hack/update-codegen.sh

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,13 @@ trap 'rm -r "${tempdir}"' EXIT
6464
openapi="${tempdir}/openapi.json"
6565
go run "${PROJECT_ROOT}/hack/codegen/cmd/models-schema/main.go" > "$openapi"
6666

67-
# This hack is required until we're using k8s.io/code-generator containing
68-
# https://github.com/kubernetes/kubernetes/pull/125162, which should be v0.31
69-
ln -s "${PROJECT_ROOT}/api" "${PROJECT_ROOT}/core"
70-
trap 'rm "${PROJECT_ROOT}/core"' EXIT
71-
7267
kube::codegen::gen_client \
7368
--with-applyconfig \
69+
--with-watch \
7470
--applyconfig-openapi-schema "$openapi" \
7571
--output-dir "${PROJECT_ROOT}/${GENERATED_PKG}" \
7672
--output-pkg github.com/k-orc/openstack-resource-controller/${GENERATED_PKG} \
7773
--versioned-name clientset \
7874
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
7975
--one-input-api "api" \
8076
"${PROJECT_ROOT}"
81-
82-
# Add --with-watch to the above command line to generate informers and listers.
83-
# It's not worth doing that now until we can remove the hack below which
84-
# deletes the clientset.
85-
# --with-watch \
86-
87-
# The hack below is required until CAPO is using the same version of the k/k
88-
# libraries as the code-generator we're using in this utility module.
89-
#
90-
# code-generator generates code targetting the version of kubernetes it is
91-
# built from. We are fortunate that the generated applyconfiguration builds
92-
# against older libraries. However, the generated clientset does not. As we
93-
# aren't yet using the clientset we just delete it for now.
94-
#
95-
# We could avoid generating it in the first place, but then we wouldn't be able
96-
# to use kube_codegen.sh. We leave it like this as we expect to update to a
97-
# sufficiently new k/k in the relatively near future.
98-
rm -r "${PROJECT_ROOT}/${GENERATED_PKG}/clientset"

orc/pkg/clients/clientset/clientset/clientset.go

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

orc/pkg/clients/clientset/clientset/fake/clientset_generated.go

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

orc/pkg/clients/clientset/clientset/fake/doc.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

orc/pkg/clients/clientset/clientset/fake/register.go

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)