controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

✨ New kubebuilder:skipDescriptions CRD marker

Open armsnyder opened this issue 4 years ago • 17 comments

Signed-off-by: Adam Snyder [email protected]

Overview

Closes #441

I added a new marker kubebuilder:skipDescriptions. When added to a field it skips adding property descriptions for all nested properties under that field, recursively. When added to a package it skips adding property descriptions for all types in the package, recursively.

The benefit of this marker is it allows a user to embed types from external packages without causing the types to generate descriptions.

Details

I had trouble implementing this because the marker system currently can only process one type at a time, meaning that markers do not have access to nested properties. This was a problem for removing descriptions in imported packages.

My solution was a new marker interface PostFlattenMarker that a marker can implement so that it gets invoked much later, after the JSON schema has been flattened.

How this was tested

I added integration tests for both the package-type and field-type kubebuilder:skipDescriptions marker. The tests are modeled after the existing gen_integration_test.go test. They check the controller-gen output against go-generated CRD files.

(Half of this PR diff is testdata files.)

armsnyder avatar Nov 07 '21 05:11 armsnyder

Welcome @armsnyder!

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. :smiley:

k8s-ci-robot avatar Nov 07 '21 05:11 k8s-ci-robot

Hi @armsnyder. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 avatar Nov 07 '21 05:11 k8s-ci-robot

@armsnyder What is the status of this? You probably need to request a review (see https://github.com/kubernetes-sigs/controller-tools/pull/635#issuecomment-962556381).

sathieu avatar Dec 07 '21 12:12 sathieu

Thanks @sathieu, I wasn't sure that message was for me. The PR should be ready for review.

/assign @pwittrock

armsnyder avatar Dec 10 '21 06:12 armsnyder

/ok-to-test

camilamacedo86 avatar Dec 10 '21 09:12 camilamacedo86

That shows OK for me. /ok-to-test @christopherhein wdyt?

camilamacedo86 avatar Dec 10 '21 09:12 camilamacedo86

CLA Signed

The committers are authorized under a signed CLA.

  • :white_check_mark: Adam Snyder (bef343c6abf276bc2f7164df089e8f9fcf4212a2)

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: armsnyder To complete the pull request process, please ask for approval from pwittrock after the PR has been reviewed.

The full list of commands accepted by this bot can be found 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 avatar Dec 10 '21 09:12 k8s-ci-robot

Thanks @armsnyder !

/lgtm

christopherhein avatar Dec 10 '21 16:12 christopherhein

What's the next step for this PR?

armsnyder avatar Jan 07 '22 21:01 armsnyder

@armsnyder: PR needs rebase.

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 avatar Jan 31 '22 18:01 k8s-ci-robot

@christopherhein @camilamacedo86 Do we still want this feature?

armsnyder avatar Jan 31 '22 18:01 armsnyder

The Kubernetes project currently lacks enough 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 stale
  • Mark this issue or PR as rotten with /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 stale

k8s-triage-robot avatar May 01 '22 18:05 k8s-triage-robot

/remove-lifecycle stale

armsnyder avatar May 01 '22 19:05 armsnyder

@armsnyder I've been using your changes to great effect! Thanks!

Unfortunately, the PR does not work on the latest master. Tests fail as well. Can you rebase, please?

zuzzas avatar Jun 07 '22 07:06 zuzzas

The Kubernetes project currently lacks enough 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 stale
  • Mark this issue or PR as rotten with /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 stale

k8s-triage-robot avatar Sep 05 '22 07:09 k8s-triage-robot

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-triage-robot avatar Oct 05 '22 07:10 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this 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-triage-robot avatar Nov 04 '22 08:11 k8s-triage-robot

@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 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 PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this 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.

k8s-ci-robot avatar Nov 04 '22 08:11 k8s-ci-robot