Skip to content

Commit

Permalink
Merge pull request #293 from h3poteto/update/codegen
Browse files Browse the repository at this point in the history
Update codegenerator script for kube_codegen.sh
  • Loading branch information
h3poteto authored Feb 5, 2025
2 parents 868e148 + 3f16127 commit b7a15da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif

CRD_OPTIONS ?= "crd"
CODE_GENERATOR=${GOPATH}/src/k8s.io/code-generator
CODE_GENERATOR_TAG=v0.29.5
CODE_GENERATOR_TAG=v0.30.5
CONTROLLER_TOOLS_TAG=v0.14.0
BRANCH := $(shell git branch --show-current)

Expand Down Expand Up @@ -39,10 +39,7 @@ clean:

# boilerplate is necessary to avoid: https://github.com/kubernetes/code-generator/issues/131
codegen: code-generator
${CODE_GENERATOR}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/h3poteto/fluentd-sidecar-injector/pkg/client github.com/h3poteto/fluentd-sidecar-injector/pkg/apis \
sidecarinjectorcontroller:v1alpha1 \
-h boilerplate.go.txt
CODE_GENERATOR=${CODE_GENERATOR} scripts/update-codegen.sh

manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=sidecar-injector-manager-role paths=./... output:crd:artifacts:config=./config/crd/
Expand Down
10 changes: 10 additions & 0 deletions pkg/client/informers/externalversions/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions scripts/update-codegen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
CODEGEN_PKG=${CODE_GENERATOR:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}

source "${CODEGEN_PKG}/kube_codegen.sh"

kube::codegen::gen_helpers \
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
"${SCRIPT_ROOT}/pkg/apis"

kube::codegen::gen_client \
--with-watch \
--output-dir "${SCRIPT_ROOT}/pkg/client" \
--output-pkg "github.com/h3poteto/fluentd-sidecar-injector/pkg/client" \
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
"${SCRIPT_ROOT}/pkg/apis"

0 comments on commit b7a15da

Please sign in to comment.