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

Single group to multi-group guide has wrong paths for plugins go/v4 #3401

Closed
juanluisvaladas opened this issue May 10, 2023 · 2 comments · Fixed by #3403
Closed

Single group to multi-group guide has wrong paths for plugins go/v4 #3401

juanluisvaladas opened this issue May 10, 2023 · 2 comments · Fixed by #3403
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation.

Comments

@juanluisvaladas
Copy link
Contributor

juanluisvaladas commented May 10, 2023

What broke? What's expected?

The documentation says:

If you create your project using go/v4 plugin (you can verify it by looking at the PROJECT file ) then, all steps are the same but you need to keep in mind that the api and controllers directory path is now under the pkg directory instead. So, you need ensure that you update the paths accordingly.
However after starting a test project 

However after creating a test projeect with multigroup to begin with, the paths I see are different:

test $ ../kubebuilder init --domain test.io --repo github.com/test/test --plugins=go/v4
<snip>

test $ ../kubebuilder edit --multigroup=true
test $ ../kubebuilder create api --group test.io --version v1beta1 --kind MyResource
Create Resource [y/n]
y
Create Controller [y/n]
y
 <snip>

The result is:

test $ cat PROJECT
# 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.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: test.io
layout:
- go.kubebuilder.io/v4
multigroup: true
projectName: test
repo: github.com/test/test
resources:
- api:
    crdVersion: v1
    namespaced: true
  controller: true
  domain: test.io
  group: test.io
  kind: MyResource
  path: github.com/test/test/api/test.io/v1beta1
  version: v1beta1
version: "3"

test $ tree
.
├── Dockerfile
├── Makefile
├── PROJECT
├── README.md
├── api
│   └── test.io
│       └── v1beta1
│           ├── groupversion_info.go
│           ├── myresource_types.go
│           └── zz_generated.deepcopy.go
├── bin
│   └── controller-gen
├── cmd
│   └── main.go
├── config
│   ├── crd
│   │   ├── kustomization.yaml
│   │   ├── kustomizeconfig.yaml
│   │   └── patches
│   │       ├── cainjection_in_test.io_myresources.yaml
│   │       └── webhook_in_test.io_myresources.yaml
│   ├── default
│   │   ├── kustomization.yaml
│   │   ├── manager_auth_proxy_patch.yaml
│   │   └── manager_config_patch.yaml
│   ├── manager
│   │   ├── kustomization.yaml
│   │   └── manager.yaml
│   ├── prometheus
│   │   ├── kustomization.yaml
│   │   └── monitor.yaml
│   ├── rbac
│   │   ├── auth_proxy_client_clusterrole.yaml
│   │   ├── auth_proxy_role.yaml
│   │   ├── auth_proxy_role_binding.yaml
│   │   ├── auth_proxy_service.yaml
│   │   ├── kustomization.yaml
│   │   ├── leader_election_role.yaml
│   │   ├── leader_election_role_binding.yaml
│   │   ├── role_binding.yaml
│   │   ├── service_account.yaml
│   │   ├── test.io_myresource_editor_role.yaml
│   │   └── test.io_myresource_viewer_role.yaml
│   └── samples
│       ├── kustomization.yaml
│       └── test.io_v1beta1_myresource.yaml
├── go.mod
├── go.sum
├── hack
│   └── boilerplate.go.txt
└── internal
    └── controller
        └── test.io
            ├── myresource_controller.go
            └── suite_test.go

18 directories, 38 files

The layout is not as documented

Reproducing this issue

Happens always, steps above.

KubeBuilder (CLI) Version

Version: main.version{KubeBuilderVersion:"3.10.0", KubernetesVendor:"1.26.1", GitCommit:"0fa57405d4a892efceec3c5a902f634277e30732", BuildDate:"2023-04-15T08:10:35Z", GoOs:"darwin", GoArch:"arm64"}

PROJECT version

3

Plugin versions

go.kubebuilder.io/v4

Other versions

go version go1.20.4 darwin/arm64

k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
sigs.k8s.io/controller-runtime v0.14.4

Extra Labels

/kind documentation

@juanluisvaladas juanluisvaladas added the kind/bug Categorizes issue or PR as related to a bug. label May 10, 2023
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label May 10, 2023
@camilamacedo86
Copy link
Member

Hi @juanluisvaladas,

Thank you to raise this one. Within the go/v4 this doc gets outdated and wrong. Would you like to work on in this fix? Your help on that would be very welcome/

@juanluisvaladas
Copy link
Contributor Author

HI @camilamacedo86, I created #3403

I wasn't too sure when I created the issue, but I managed to do it successfully so I think the instructions should be good for everyone else.

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. kind/documentation Categorizes issue or PR as related to documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants