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

Plugins do not honor the path defined in the PROJECT file #2634

Closed
AlmogBaku opened this issue Apr 23, 2022 · 3 comments
Closed

Plugins do not honor the path defined in the PROJECT file #2634

AlmogBaku opened this issue Apr 23, 2022 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@AlmogBaku
Copy link
Member

What broke? What's expected?

When I configure a different path for my resource other than the default ./api path, the plugins do not honor it, and expect the default path.

I found that it impacting the following:

  1. go/v3: Creating a webhook for an existing API
  2. Kustomize: Creating a new webhook

Reproducing this issue

  1. change https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v3/PROJECT#L27 this line to

KubeBuilder (CLI) Version

master

PROJECT version

3

Plugin versions

- go.kubebuilder.io/v3

Other versions

No response

Extra Labels

No response

@AlmogBaku AlmogBaku added the kind/bug Categorizes issue or PR as related to a bug. label Apr 23, 2022
@camilamacedo86
Copy link
Member

Could you please describe the steps to reproduce this issue?
What do you mean with:

When I configure a different path for my resource other than the default ./api path

We have only 2 possible paths the default layout and the multi-group layout.
So, what are the circumstances where the path is not the default one in this case?

@camilamacedo86
Copy link
Member

camilamacedo86 commented Apr 26, 2022

Hi @AlmogBaku,

Thank you for providing the info and the steps:

clone https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v3/
move the api package to a different location (i.e., pkg/api)
update it accordingly in the PROJECT file
try to generate a new webhook

This operation is not supported so we do not have a bug here.
Kubebuilder does not support customizations of the paths and the info tracked in the PROJECT has not the purpose to allow this customization.

Since you are looking here for the plugins to be able to work with different paths it shows a duplication of: #932. After phase 2 users would be able to have and use their own plugins with Kubebuilder that does the scaffolds in the paths that please them.

However, if you are looking for a way to make the available plugins be able to work with customizations of the paths then that cannot be addressed ONLY for the apis and should work in general with all that is a scaffold for the plugins. In this way, this RFE would be much more complex than the changes suggested here and we would need a design doc proposal to discuss the approach.

@camilamacedo86
Copy link
Member

Hi @AlmogBaku,

I hope that you do not mind. I am closing this one in favor of #932. ( it is duplicated )

The above task is created to allow us to provide a feature where would be possible customize the path of what is scaffolded by default.

Note that the PROJECT file is used to track the info used to scaffold the projects and changing the behaviour reported as a bug is not supported. We could indeed try to add a comment on the top like:

# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.

But if we try to do so the current libs used to marchal / unmarchal the yaml will fail:

Error: unable to load the configuration: unable to determine config version: error converting YAML to JSON: yaml: line 18: mapping values are not allowed in this context

Because the comment is not ignored by them. However, I created a task to see if we can work on this, see: #2786

PLease, feel free to reach out or re-open this one if you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants