kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

✨ pass config between KB and external plugin

Open Eileen-Yu opened this issue 2 years ago • 12 comments
trafficstars

Description:

Todo:

  • [x] Add new specs Config in both the PluginRequest and PluginResponse
  • [x] Create a local type definition in the sampleexternalplugin path for easier testing
  • [x] Inject the config in PluginRequest and pass it to the external plugin
  • [x] Update the config on the sample external plugin side, send the updated config back via response
  • [x] Enable KB to update the config based on the modified the config passed back from PluginResponse
  • [x] Add e2e tests
  • Remove the replace once the PR gets merged (next PR)

Sample PROJECT updated by go sample external plugin:

Motivation:

Aims to fix the issue https://github.com/kubernetes-sigs/kubebuilder/issues/3396

Eileen-Yu avatar Aug 07 '23 23:08 Eileen-Yu

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

k8s-ci-robot avatar Aug 07 '23 23:08 k8s-ci-robot

/test pull-kubebuilder-e2e-k8s-1-27-1

Eileen-Yu avatar Aug 31 '23 16:08 Eileen-Yu

@Eileen-Yu: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test pull-kubebuilder-e2e-k8s-1-26-6
  • /test pull-kubebuilder-e2e-k8s-1-27-3
  • /test pull-kubebuilder-e2e-k8s-1-28-0
  • /test pull-kubebuilder-test

Use /test all to run all jobs.

In response to this:

/test pull-kubebuilder-e2e-k8s-1-26-1

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 15 '23 23:11 k8s-ci-robot

/test pull-kubebuilder-e2e-k8s-1-26-6

Eileen-Yu avatar Nov 15 '23 23:11 Eileen-Yu

/test pull-kubebuilder-e2e-k8s-1-28-0

Eileen-Yu avatar Nov 16 '23 00:11 Eileen-Yu

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Eileen-Yu, Kavinjsir 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

k8s-ci-robot avatar Feb 06 '24 07:02 k8s-ci-robot

Tried to update it with the suggestions.. Is this what we're looking for?

Guess I meet with the similar blocker when I did this last time: the project version would somehow be 0 (but by default it should be 3, and it did show as 3 in the scaffolded PROJECT, but if print it in the middle it's actually 0... not quite sure what caused this), and PROECT content failed to update with new fields... but these issues wouldn't happen when req/res.Config is set to string.

Screenshot 2024-02-13 at 12 25 35 AM

Not sure if there's any unexpected issues in between 🤔

Eileen-Yu avatar Feb 13 '24 04:02 Eileen-Yu

Hi @Eileen-Yu

Thank you for coming back on this one. it would be very nice if we could achieve it. Your help here is very appreciated.

Regards: https://github.com/kubernetes-sigs/kubebuilder/pull/3526#issuecomment-1940426602

When you try to run the commands from the external plugin, you create the Config struct instead of loading it from the Project file. More info: https://github.com/kubernetes-sigs/kubebuilder/pull/3526#discussion_r1487395021

camilamacedo86 avatar Feb 13 '24 08:02 camilamacedo86

Hi @camilamacedo86 , thx for the help!

a) squash the commits for we have just 1 here b) fix the lint issue c) rebase with master and push so that we can check it with the final state

I did all of the above lists.

And yes, I did see the unit tests still failed because of this version error:

 msg: "unable to create config for version \"0\": version 0 is not supported",
              err: <config.UnsupportedVersionError>{
                  Version: {Number: 0, Stage: 0},

I tried to fix this with this line: https://github.com/kubernetes-sigs/kubebuilder/pull/3526/files#diff-992e7a26b8776b12932c030601857ed56f364b1ecd7dc0fac9dcfd8c0cb903c6R66 but didn't get the luck 😔

Eileen-Yu avatar Feb 15 '24 04:02 Eileen-Yu

Hi @Eileen-Yu

Regards: https://github.com/kubernetes-sigs/kubebuilder/pull/3526#issuecomment-1945344498 thank you a lot I do not have this weekend to check it out. But up the following one, I will run it locally and see if I can fix the nit

camilamacedo86 avatar Feb 15 '24 13:02 camilamacedo86

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 Apr 03 '24 03:04 k8s-ci-robot

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-triage-robot avatar Nov 17 '24 11:11 k8s-triage-robot

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-triage-robot avatar Dec 17 '24 12:12 k8s-triage-robot

@Eileen-Yu: 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-28-6 924daa742ac59c9728572396658aaae3199b770f link true /test pull-kubebuilder-e2e-k8s-1-28-6
pull-kubebuilder-e2e-k8s-1-27-10 924daa742ac59c9728572396658aaae3199b770f link true /test pull-kubebuilder-e2e-k8s-1-27-10
pull-kubebuilder-e2e-k8s-1-29-0 924daa742ac59c9728572396658aaae3199b770f link true /test pull-kubebuilder-e2e-k8s-1-29-0
pull-kubebuilder-test 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-test
pull-kubebuilder-e2e-k8s-1-27-3 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-27-3
pull-kubebuilder-e2e-k8s-1-26-6 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-26-6
pull-kubebuilder-e2e-k8s-1-28-0 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-28-0
pull-kubebuilder-e2e-k8s-1-29-2 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-29-2
pull-kubebuilder-e2e-k8s-1-27-11 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-27-11
pull-kubebuilder-e2e-k8s-1-28-7 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-28-7
pull-kubebuilder-e2e-k8s-1-30-0 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-30-0
pull-kubebuilder-e2e-k8s-1-31-0 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-31-0
pull-kubebuilder-e2e-k8s-1-31-4 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-31-4
pull-kubebuilder-e2e-k8s-1-32-0 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-32-0
pull-kubebuilder-e2e-k8s-1-30-8 65ae4a3563d9a83d0a4203b95b8e902636e19f49 link true /test pull-kubebuilder-e2e-k8s-1-30-8

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

k8s-ci-robot avatar Dec 28 '24 02:12 k8s-ci-robot

Hi @Eileen-Yu

I think you are not working on this one anymore So, I am closing but feel free to re-open if you wish to rebase and work on it.

camilamacedo86 avatar Jan 01 '25 11:01 camilamacedo86