✨ Add header and year options for yaml generator#544
Conversation
|
Welcome @nak3! |
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
|
@k8s-triage-robot: Closed this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/reopen This seems like a valuable feature... |
|
@justinsb: Reopened this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This patch adds headerFile and year options to CRD, RBAC and Webhook generator
Currently headerFile and year options are available on only generate option.
This patch adds the option for YAMLs.
e.g. generate the crd with headerfile
```
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
crd:crdVersions=v1,year=2021,headerFile="${PATH_TO_YOUR_BOILDER_PLATE}" \
output:crd:artifacts:config=config/crd/bases \
paths=./...
```
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nak3, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Some tests would be good, to avoid regressions later :) |
Adds some test coverage to CRD generation, including for the new HeaderFile support for license headers (in kubernetes-sigs#544).
Adds some test coverage to CRD generation, including for the new HeaderFile support for license headers (in kubernetes-sigs#544).
Use the literal YEAR token in the scaffolded hack/boilerplate.go.txt file instead of resolving the current year at scaffold time and substitute YEAR when scaffolding/generating files. This aligns with the convention established in gengo [^1] and controller-gen [^2]. Closes kubernetes-sigs#5553 [^1]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59 [^2]: kubernetes-sigs/controller-tools#544
Use the literal YEAR token in the scaffolded hack/boilerplate.go.txt file instead of resolving the current year at scaffold time and substitute YEAR when scaffolding/generating files. This aligns with the convention established in gengo [^1] and controller-gen [^2]. Closes kubernetes-sigs#5553 [^1]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59 [^2]: kubernetes-sigs/controller-tools#544
Use the literal YEAR token in the scaffolded hack/boilerplate.go.txt file instead of resolving the current year at scaffold time and substitute YEAR when scaffolding/generating files. This aligns with the convention established in gengo [^1] and controller-gen [^2]. Closes kubernetes-sigs#5553 [^1]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59 [^2]: kubernetes-sigs/controller-tools#544
…5559) feat: support YEAR placeholder in boilerplate for copyright Use the literal YEAR token in the scaffolded hack/boilerplate.go.txt file instead of resolving the current year at scaffold time and substitute YEAR when scaffolding/generating files. This aligns with the convention established in gengo [^1] and controller-gen [^2]. Closes #5553 [^1]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59 [^2]: kubernetes-sigs/controller-tools#544
Define a YEAR Makefile variable (defaulting to the current year) when controller-gen is enabled, and pass it as year=$(YEAR) to the controller-gen object invocation when a headerFile is configured. This allows boilerplate header files containing the literal string "YEAR" to have it replaced with the actual year. [^1] The applyconfiguration generator handles this substitution automatically by using kubernetes/gengo and does not need the explicit parameter. [^2] [^1]: kubernetes-sigs/controller-tools#544 [^2]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59
Define a YEAR Makefile variable (defaulting to the current year) when controller-gen is enabled, and pass it as year=$(YEAR) to the controller-gen object invocation when a headerFile is configured. This allows boilerplate header files containing the literal string "YEAR" to have it replaced with the actual year. [^1] The applyconfiguration generator handles this substitution automatically by using kubernetes/gengo and does not need the explicit parameter. [^2] [^1]: kubernetes-sigs/controller-tools#544 [^2]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59
This patch adds headerFile and year options to CRD, RBAC and Webhook generator
Currently headerFile and year options are available on only generate option.
This patch adds the option for YAMLs.
e.g. generate the crd with headerfile
Fix #464