Skip to content

Commit

Permalink
Fixing generated files
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Aggarwal <[email protected]>
  • Loading branch information
rohitagg2020 committed Nov 17, 2024
1 parent 2545ad0 commit 1d1afad
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 5,092 deletions.
2 changes: 1 addition & 1 deletion config-dev/values-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dev:
#@schema/desc "Whether to use the faster deployment type whilst developing (must have deployed to a cluster once fully first)"
rapid_deploy: false
#@schema/desc "Location of kapp-controller image"
image_repo: docker.io/rohitagg2020/kapp-controller-test
image_repo: docker.io/k14s/kapp-controller-test
#@schema/desc "Development version"
version: develop
#@schema/desc "Comma separated list of supported architectures"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module carvel.dev/kapp-controller

go 1.22.7
go 1.22.9

require (
carvel.dev/vendir v0.40.0
Expand Down
3 changes: 1 addition & 2 deletions hack/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ set -e
# makes the get_kappctrl_ver function available (scrapes version from git tag)
source $(dirname "$0")/version-util.sh

# ./hack/build.sh && ytt -f config/config -f config/values-schema.yml -f config-dev -v dev.version="$(get_kappctrl_ver)+develop" | kbld -f- | kapp deploy -a kc -f- -c -y
./hack/build.sh && ytt -f config/config -f config/values-schema.yml -f config-dev -v dev.version="$(get_kappctrl_ver)+develop" | kbld -f- | kapp deploy -a kc -f- -c -y

./hack/build.sh && ytt -f config/config -f config/values-schema.yml -f config-dev -v dev.version="$(get_kappctrl_ver)+develop" | kbld -f- > output.yml
source ./hack/secretgen-controller.sh
deploy_secretgen-controller
6 changes: 3 additions & 3 deletions hack/gen-apiserver-namer.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/vendor/k8s.io/gengo/namer/namer.go b/vendor/k8s.io/gengo/namer/namer.go
diff --git a/vendor/k8s.io/gengo/v2/namer/namer.go b/vendor/k8s.io/gengo/v2/namer/namer.go
index 6feb2d0c..5ae36b12 100644
--- a/vendor/k8s.io/gengo/namer/namer.go
+++ b/vendor/k8s.io/gengo/namer/namer.go
--- a/vendor/k8s.io/gengo/v2/namer/namer.go
+++ b/vendor/k8s.io/gengo/v2/namer/namer.go
@@ -61,6 +61,7 @@ func NewPublicNamer(prependPackageNames int, ignoreWords ...string) *NameStrateg
// arguments to this constructor.
func NewPrivateNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy {
Expand Down
50 changes: 29 additions & 21 deletions hack/gen-apiserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ KC_PKG="carvel.dev/kapp-controller"

# Following patch allows us to name gen-s with a name Package
# (without it generated Go code is not valid since word "package" is reserved)
git checkout vendor/k8s.io/gengo/namer/namer.go
git checkout vendor/k8s.io/gengo/v2/namer/namer.go
git apply ./hack/gen-apiserver-namer.patch

rm -rf pkg/apiserver/{client,openapi}
Expand All @@ -22,47 +22,55 @@ go run vendor/k8s.io/code-generator/cmd/client-gen/main.go \
--clientset-name versioned \
--input-base "${KC_PKG}/pkg/apiserver/apis/" \
--input "datapackaging/v1alpha1" \
--output-package "${KC_PKG}/pkg/apiserver/client/clientset" \
--output-dir "pkg/apiserver/client/clientset" \
--output-pkg "${KC_PKG}/pkg/apiserver/client/clientset" \
--go-header-file hack/gen-boilerplate.txt

echo "Generating listers"
go run vendor/k8s.io/code-generator/cmd/lister-gen/main.go \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--output-package "${KC_PKG}/pkg/apiserver/client/listers" \
"${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--output-dir "pkg/apiserver/client/listers" \
--output-pkg "${KC_PKG}/pkg/apiserver/client/listers" \
--go-header-file hack/gen-boilerplate.txt

echo "Generating informers"
go run vendor/k8s.io/code-generator/cmd/informer-gen/main.go \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
"${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--versioned-clientset-package "${KC_PKG}/pkg/apiserver/client/clientset/versioned" \
--listers-package "${KC_PKG}/pkg/apiserver/client/listers" \
--output-package "${KC_PKG}/pkg/apiserver/client/informers" \
--output-dir "pkg/apiserver/client/informers" \
--output-pkg "${KC_PKG}/pkg/apiserver/client/informers" \
--go-header-file hack/gen-boilerplate.txt

echo "Generating deepcopy"
rm -f $(find pkg/apiserver|grep zz_generated.deepcopy)
go run vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging" \
-O zz_generated.deepcopy \
"${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
"${KC_PKG}/pkg/apiserver/apis/datapackaging" \
--output-file zz_generated.deepcopy.go \
--go-header-file hack/gen-boilerplate.txt

echo "Generating conversions"
rm -f $(find pkg/apiserver|grep zz_generated.conversion)
go run vendor/k8s.io/code-generator/cmd/conversion-gen/main.go \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1,${KC_PKG}/pkg/apiserver/apis/datapackaging" \
-O zz_generated.conversion \
"${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
"${KC_PKG}/pkg/apiserver/apis/datapackaging" \
--output-file zz_generated.conversion.go \
--go-header-file hack/gen-boilerplate.txt

echo "Generating openapi"
rm -f $(find pkg/apiserver|grep zz_generated.openapi)
go run vendor/k8s.io/code-generator/cmd/openapi-gen/main.go \
--input-dirs "${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--input-dirs "${KC_PKG}/pkg/apis/kappctrl/v1alpha1" \
--input-dirs "carvel.dev/vendir/pkg/vendir/versions/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/util/intstr" \
--input-dirs "k8s.io/api/core/v1" \
--output-package "${KC_PKG}/pkg/apiserver/openapi" \
-O zz_generated.openapi \
go run vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go \
"${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
"${KC_PKG}/pkg/apis/kappctrl/v1alpha1" \
"carvel.dev/vendir/pkg/vendir/versions/v1alpha1" \
"k8s.io/apimachinery/pkg/apis/meta/v1" \
"k8s.io/apimachinery/pkg/runtime" \
"k8s.io/apimachinery/pkg/util/intstr" \
"k8s.io/api/core/v1" \
--output-pkg "${KC_PKG}/pkg/apiserver/openapi" \
--output-dir "pkg/apiserver/openapi" \
--output-file zz_generated.openapi.go \
--go-header-file hack/gen-boilerplate.txt

# Install protoc binary as directed by https://github.com/gogo/protobuf#installation
Expand All @@ -83,11 +91,11 @@ export PATH=$GOBIN:$PATH

rm -f $(find pkg|grep '\.proto')

# TODO It seems this command messes around with protos in vendor directory
go-to-protobuf \
--proto-import "${GOPATH}/src/${KC_PKG}/vendor" \
--packages "-carvel.dev/vendir/pkg/vendir/versions/v1alpha1,${KC_PKG}/pkg/apis/kappctrl/v1alpha1,${KC_PKG}/pkg/apiserver/apis/datapackaging/v1alpha1" \
--vendor-output-base="${GOPATH}/src/${KC_PKG}/vendor" \
--go-header-file hack/gen-boilerplate.txt
--apimachinery-packages "-k8s.io/apimachinery/pkg/runtime/schema,-k8s.io/apimachinery/pkg/runtime,-k8s.io/apimachinery/pkg/apis/meta/v1" \
--go-header-file hack/gen-boilerplate.txt \
--output-dir "${GOPATH}/src"

echo "GEN SUCCESS"
23 changes: 16 additions & 7 deletions hack/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ rm -rf pkg/client
echo "Generating deepcopy funcs"
rm -f $(find pkg/apis|grep zz_generated.deepcopy.go)
go run vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go \
--input-dirs ${KC_PKG}/pkg/apis/kappctrl/v1alpha1,${KC_PKG}/pkg/apis/packaging/v1alpha1,${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
-O zz_generated.deepcopy \
${KC_PKG}/pkg/apis/kappctrl/v1alpha1 \
${KC_PKG}/pkg/apis/packaging/v1alpha1 \
${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
--output-file zz_generated.deepcopy.go \
--bounding-dirs ${KC_PKG}/pkg/apis \
--go-header-file ./hack/gen-boilerplate.txt

Expand All @@ -28,21 +30,28 @@ go run vendor/k8s.io/code-generator/cmd/client-gen/main.go \
--clientset-name versioned \
--input-base '' \
--input ${KC_PKG}/pkg/apis/kappctrl/v1alpha1,${KC_PKG}/pkg/apis/packaging/v1alpha1,${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
--output-package ${KC_PKG}/pkg/client/clientset \
--output-pkg ${KC_PKG}/pkg/client/clientset \
--output-dir pkg/client/clientset \
--go-header-file ./hack/gen-boilerplate.txt

echo "Generating listers"
go run vendor/k8s.io/code-generator/cmd/lister-gen/main.go \
--input-dirs ${KC_PKG}/pkg/apis/kappctrl/v1alpha1,${KC_PKG}/pkg/apis/packaging/v1alpha1,${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
--output-package ${KC_PKG}/pkg/client/listers \
${KC_PKG}/pkg/apis/kappctrl/v1alpha1 \
${KC_PKG}/pkg/apis/packaging/v1alpha1 \
${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
--output-pkg ${KC_PKG}/pkg/client/listers \
--output-dir pkg/client/listers \
--go-header-file ./hack/gen-boilerplate.txt

echo "Generating informers"
go run vendor/k8s.io/code-generator/cmd/informer-gen/main.go \
--input-dirs ${KC_PKG}/pkg/apis/kappctrl/v1alpha1,${KC_PKG}/pkg/apis/packaging/v1alpha1,${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
${KC_PKG}/pkg/apis/kappctrl/v1alpha1 \
${KC_PKG}/pkg/apis/packaging/v1alpha1 \
${KC_PKG}/pkg/apis/internalpackaging/v1alpha1 \
--versioned-clientset-package ${KC_PKG}/pkg/client/clientset/versioned \
--listers-package ${KC_PKG}/pkg/client/listers \
--output-package ${KC_PKG}/pkg/client/informers \
--output-pkg ${KC_PKG}/pkg/client/informers \
--output-dir pkg/client/informers \
--go-header-file ./hack/gen-boilerplate.txt

echo GEN SUCCESS
Loading

0 comments on commit 1d1afad

Please sign in to comment.