Skip to content

Commit b7a15da

Browse files
authored
Merge pull request #293 from h3poteto/update/codegen
Update codegenerator script for kube_codegen.sh
2 parents 868e148 + 3f16127 commit b7a15da

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif
99

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

@@ -39,10 +39,7 @@ clean:
3939

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

4744
manifests: controller-gen
4845
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=sidecar-injector-manager-role paths=./... output:crd:artifacts:config=./config/crd/

pkg/client/informers/externalversions/factory.go

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

scripts/update-codegen.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
8+
CODEGEN_PKG=${CODE_GENERATOR:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
9+
10+
source "${CODEGEN_PKG}/kube_codegen.sh"
11+
12+
kube::codegen::gen_helpers \
13+
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
14+
"${SCRIPT_ROOT}/pkg/apis"
15+
16+
kube::codegen::gen_client \
17+
--with-watch \
18+
--output-dir "${SCRIPT_ROOT}/pkg/client" \
19+
--output-pkg "github.com/h3poteto/fluentd-sidecar-injector/pkg/client" \
20+
--boilerplate "${SCRIPT_ROOT}/boilerplate.go.txt" \
21+
"${SCRIPT_ROOT}/pkg/apis"

0 commit comments

Comments
 (0)