Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

✨ Add header and year options for yaml generator #544

Merged
merged 1 commit into from
Jan 5, 2023
Merged

✨ Add header and year options for yaml generator #544

merged 1 commit into from
Jan 5, 2023

Conversation

nak3
Copy link
Member

@nak3 nak3 commented Feb 11, 2021

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=./...

Fix #464

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 11, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @nak3!

It looks like this is your first PR to kubernetes-sigs/controller-tools 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-tools has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 11, 2021
@nak3 nak3 changed the title Add header and year options for yaml generator ✨ Add header and year options for yaml generator Feb 11, 2021
@nak3 nak3 changed the title ✨ Add header and year options for yaml generator ✨ Add header and year options for yaml generator Feb 11, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 20, 2021
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 19, 2021
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 18, 2021
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

@justinsb
Copy link
Contributor

justinsb commented Jan 4, 2023

/reopen

This seems like a valuable feature...

@k8s-ci-robot
Copy link
Contributor

@justinsb: Reopened this PR.

In response to this:

/reopen

This seems like a valuable feature...

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.

@k8s-ci-robot k8s-ci-robot reopened this Jan 4, 2023
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=./...
```
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 5, 2023
@justinsb
Copy link
Contributor

justinsb commented Jan 5, 2023

Thanks for updating @nak3

This LGTM and solves a problem I'm encountering where it's hard to use controller-tools / go-generate and then add boilerplate.

WDYT @vincepri ? I'm also happy to add some tests if another PR if that's desired.

/assign @vincepri

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 5, 2023
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot
Copy link
Contributor

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 5, 2023
@vincepri
Copy link
Member

vincepri commented Jan 5, 2023

Some tests would be good, to avoid regressions later :)

@k8s-ci-robot k8s-ci-robot merged commit 54a2e9f into kubernetes-sigs:master Jan 5, 2023
justinsb added a commit to justinsb/controller-tools that referenced this pull request Jan 6, 2023
Adds some test coverage to CRD generation, including for the new
HeaderFile support for license headers (in kubernetes-sigs#544).
justinsb added a commit to justinsb/controller-tools that referenced this pull request Jan 18, 2023
Adds some test coverage to CRD generation, including for the new
HeaderFile support for license headers (in kubernetes-sigs#544).
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

controller-gen unable to set file headers
6 participants