Migrate to kube codegen (#15491)

This commit is contained in:
Stavros Kontopoulos 2024-09-03 12:02:27 +03:00 committed by GitHub
parent 5f5f6d820b
commit 372f5d1202
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 47 additions and 21 deletions

View File

@ -60,20 +60,25 @@ ${REPO_ROOT_DIR}/hack/update-checksums.sh
group "Kubernetes Codegen"
# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
knative.dev/serving/pkg/client knative.dev/serving/pkg/apis \
"serving:v1 serving:v1beta1 autoscaling:v1alpha1" \
--go-header-file "${boilerplate}"
source "${CODEGEN_PKG}/kube_codegen.sh"
# Generate our own client for cert-manager (otherwise injection won't work)
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
knative.dev/serving/pkg/client/certmanager github.com/cert-manager/cert-manager/pkg/apis \
"certmanager:v1 acme:v1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
kube::codegen::gen_helpers \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt" \
"${REPO_ROOT_DIR}/pkg/apis"
kube::codegen::gen_client \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt" \
--output-dir "${REPO_ROOT_DIR}/pkg/client" \
--output-pkg "knative.dev/serving/pkg/client" \
--with-watch \
"${REPO_ROOT_DIR}/pkg/apis"
kube::codegen::gen_client \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt" \
--output-dir "${REPO_ROOT_DIR}/pkg/client/certmanager" \
--output-pkg "knative.dev/serving/pkg/client/certmanager" \
--with-watch \
"${REPO_ROOT_DIR}/vendor/github.com/cert-manager/cert-manager/pkg/apis"
group "Knative Codegen"
@ -92,16 +97,15 @@ ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
group "Deepcopy Gen"
# Depends on generate-groups.sh to install bin/deepcopy-gen
${GOPATH}/bin/deepcopy-gen \
-O zz_generated.deepcopy \
--output-file zz_generated.deepcopy.go \
--go-header-file "${boilerplate}" \
-i knative.dev/serving/pkg/apis/config \
-i knative.dev/serving/pkg/reconciler/route/config \
-i knative.dev/serving/pkg/autoscaler/config/autoscalerconfig \
-i knative.dev/serving/pkg/autoscaler/scaling \
-i knative.dev/serving/pkg/deployment \
-i knative.dev/serving/pkg/gc
knative.dev/serving/pkg/apis/config \
knative.dev/serving/pkg/reconciler/route/config \
knative.dev/serving/pkg/autoscaler/config/autoscalerconfig \
knative.dev/serving/pkg/autoscaler/scaling \
knative.dev/serving/pkg/deployment \
knative.dev/serving/pkg/gc
group "Generating API reference docs"

22
pkg/apis/zz_generated.deepcopy.go generated Normal file
View File

@ -0,0 +1,22 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2022 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package apis