another hack codegen update

This commit is contained in:
Felix Kunde 2024-02-22 16:15:21 +01:00
parent 5b9d8f90a1
commit 8879aa079a
4 changed files with 16 additions and 24 deletions

5
hack/codegen.go Normal file
View File

@ -0,0 +1,5 @@
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
// Keep a reference to code-generator so it's not removed by go mod tidy
package hack
import _ "k8s.io/code-generator"

View File

@ -1,19 +0,0 @@
// +build tools
/*
Copyright 2019 The Kubernetes 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.
*/
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools
import _ "k8s.io/code-generator"

View File

@ -4,9 +4,9 @@ set -o errexit
set -o nounset
set -o pipefail
GENERATED_PACKAGE_ROOT="github.com"
GENERATED_PACKAGE_ROOT="src/github.com"
OPERATOR_PACKAGE_ROOT="${GENERATED_PACKAGE_ROOT}/zalando/postgres-operator"
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
TARGET_CODE_DIR=${1-${SCRIPT_ROOT}/pkg}
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
@ -20,7 +20,7 @@ trap "cleanup" EXIT SIGINT
kube::codegen::gen_helpers \
--input-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
--boilerplate "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt"
kube::codegen::gen_client \
--with-watch \
@ -28,7 +28,7 @@ kube::codegen::gen_client \
--input-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \
--output-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/generated/client" \
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
--boilerplate "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt"
#bash "${CODEGEN_PKG}/kube_codegen.sh" client,deepcopy,informer,lister \
# "${OPERATOR_PACKAGE_ROOT}/pkg/generated" "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \
@ -36,6 +36,6 @@ kube::codegen::gen_client \
# --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt \
# -o ./
cp -r "${OPERATOR_PACKAGE_ROOT}"/pkg/* "${TARGET_CODE_DIR}"
#cp -r "${OPERATOR_PACKAGE_ROOT}"/pkg/* "${TARGET_CODE_DIR}"
cleanup

View File

@ -0,0 +1,6 @@
// Package v1 is the v1 version of the API.
// +k8s:deepcopy-gen=package,register
// +groupName=zalando.org
package v1