Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

✨ Continue to fix scaffolding hub and spoke interfaces #3201

Closed

Conversation

momom-i
Copy link

@momom-i momom-i commented Feb 4, 2023

This PR is based on #2084.
I opened the PR but I wanted to be simpler so recreated it.

To scaffold hub and spoke interface, command-line is supposed to be like the following.

kubebuilder create webhook --group crew --version v1 --kind FirstMate --conversion --hub
kubebuilder create webhook --group crew --version v2 --kind FirstMate --conversion --spoke

I will open another PR for document change.

Related issue: #2589

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 4, 2023
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 4, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @momom-i. 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 k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 4, 2023
@camilamacedo86
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 4, 2023
@momom-i momom-i force-pushed the feat/add-conversion-scaffold branch from 91e74d7 to ee1478c Compare February 4, 2023 17:23
fs.BoolVar(&p.options.DoHubScaffold, "hub", false,
"if set, scaffold ConvertTo function for Hub conversion")
fs.BoolVar(&p.options.DoSpokeScaffold, "spoke", false,
"if set, scaffold ConvertFrom function for Spoke conversion")
Copy link
Member

Choose a reason for hiding this comment

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

Could we have a hub and spoke interfaces for the other types that are not the Conversion ones?
If not, what about we add a validation?

Copy link
Member

Choose a reason for hiding this comment

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

Also, can we have both spoke and hub as true?

Copy link
Author

@momom-i momom-i Feb 5, 2023

Choose a reason for hiding this comment

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

You mean if you set spoke or hub flags true, conversion flag should be true, right?
I don’t understand exactly what conversion flag do besides it prints messages that says you have to implement Hub and Convertible interface here. If my understanding right, there is another option to eliminate conversion flag, I think.

As you mentioned, we can set both values true and might have to change that.

package v1

// Hub marks that a given type is the hub type for conversion. -- only the no-op method 'Hub()' is required.
// See https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/conversion#Hub.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

I agree with that. Adding it makes users helpful more.

@@ -0,0 +1,76 @@
package api
Copy link
Member

Choose a reason for hiding this comment

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

All go files must to have the license:

See that the check if failing because of that

./test/check-license.sh
Checking for license header...
license header checking failed:

Could you please copy and paste from other ones to here?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed it at 6947076 and 8d30477

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

That seems great. I just added some nits and questions
You did a terrific work 🥇

I think would be very nice to get a review from @varshaprasad96 on this one.

return err
}
}

if doConversion {
fmt.Println(`Webhook server has been set up for you.
Copy link
Member

Choose a reason for hiding this comment

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

Could we not here add a condition to improve the text message?
It is valid only the options are not used?

Copy link
Author

Choose a reason for hiding this comment

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

fixed at 40988d1

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

HI @momom-i,

I will need some time to read the docs and check the initial PR to see if that is right or not.
I think we need to ensure that what is scaffold is according to the docs.

I will let you know more about soon as possible.

@camilamacedo86
Copy link
Member

Hi @momom-i,

It seems that we have an old design doc to achieve this goal see: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/crd_version_conversion.md (a few things might be outdated because it was written prior we have the plugins ecosystem).

However, the initial idea was to scaffold the conversion appropriately. It is OK. We began from a version that still needs to do that. But we need to ensure that the base will allow us to grow to attend to these needs. So, it seems, for example, that we need to track in the PROJECT file and input what the GVK wants to convert instead of bool.

Could you please check the design doc and the documentation https://book.kubebuilder.io/multiversion-tutorial/conversion.html and ensure that this implementation addresses the basic required requirements?

@momom-i
Copy link
Author

momom-i commented Feb 27, 2023

@camilamacedo86
Thank you for your response. I've read the documentation and confirmed it seemed this PR change met the required requirements.

So, it seems, for example, that we need to track in the PROJECT file and input what the GVK wants to convert instead of bool.

How can I get this requirement statement? Is there any documentation anywhere?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2023
@k8s-ci-robot
Copy link
Contributor

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.

@momom-i
Copy link
Author

momom-i commented Mar 17, 2023

@camilamacedo86 👀

Copy link
Contributor

@lauchokyip lauchokyip left a comment

Choose a reason for hiding this comment

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

@momom-i I read your PR and the OP's PR and seem like there are some discrepancies.

i) this important function is missing , instead of getting the resource from input, it actually gets it from the config file
ii) As this comment mentioned, we would want to make --version as the --spoke flag and completely remove --spoke flag

}

c.Path = c.Resource.Replacer().Replace(c.Path)
fmt.Println(c.Path)
Copy link
Contributor

@lauchokyip lauchokyip May 10, 2023

Choose a reason for hiding this comment

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

Do we need the fmt.Println?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: momom-i
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. For more information see the Kubernetes Code Review Process.

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

@lauchokyip
Copy link
Contributor

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 10, 2023
@lauchokyip
Copy link
Contributor

@momom-i are you still interested in continue the effort? If not, I would love to dig deep into it 😄

@momom-i
Copy link
Author

momom-i commented May 15, 2023

@lauchokyip I'm sorry for my delay response. I'd like to continue to work on this. 🙏
Let me take a time to confirm your comment

@lauchokyip
Copy link
Contributor

@lauchokyip I'm sorry for my delay response. I'd like to continue to work on this. pray Let me take a time to confirm your comment

Sure, would you be able to provide a timeline?

@lauchokyip
Copy link
Contributor

Also please reach out on kubebuilder Slack channel if you need any help or more visibility

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all 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:

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

Please 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 Jan 21, 2024
@k8s-ci-robot
Copy link
Contributor

@momom-i: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubebuilder-e2e-k8s-1-27-1 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-27-1
pull-kubebuilder-e2e-k8s-1-28-6 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-28-6
pull-kubebuilder-e2e-k8s-1-27-10 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-27-10
pull-kubebuilder-e2e-k8s-1-28-0 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-28-0
pull-kubebuilder-e2e-k8s-1-27-3 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-27-3
pull-kubebuilder-e2e-k8s-1-26-6 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-26-6
pull-kubebuilder-e2e-k8s-1-29-0 2dfce41 link true /test pull-kubebuilder-e2e-k8s-1-29-0

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all 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:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this 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 Mar 2, 2024
@k8s-triage-robot
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants