Can't find PROJECT file layout for kubebuilder < v3

41 views
Skip to first unread message

Dan Arad

unread,
Nov 13, 2022, 4:53:52 AM11/13/22
to kubebuilder
Hey all,

In our project we still use kubebuilder v2. We are updating one of our CRDs, and I noticed that in the kubebuilder PROJECT file there's a list of all CRDs with their version. 
I wanted to understand the effect of changing the version of a CRD in that file but couldn't find the documentation. I did find the v3 documentation, but it seems like this file didn't exist prior to v3.
So I have two questions:
1. What is the effect of updating the CRD version in the PROJECT file?
2. Where is the relevant documentation for v1/v2 (assuming it exists)?

Thanks 🙂,
Dan

Varsha Prasad Narsing

unread,
Nov 13, 2022, 1:28:23 PM11/13/22
to Dan Arad, kubebuilder
Hi Dan

The PROJECT file in any version of the scaffolding should only affect the CLI tool. It can be considered as the 'metadata' file that stores information which CLI then uses while executing other commands. For example, if one uses `kubebuilder create webhook` for a gvk which is not present in the PROJECT file, the tool would error. Overall, any changes in the `PROJECT` file shouldn't affect the other project scaffoldings.

Most important of all, I would highly suggest updating your project to the v3 plugin. We would soon be deprecating and removing support for v2 plugin based scaffolding: https://github.com/kubernetes-sigs/kubebuilder/issues/3002, as the newer versions have a better plugin model, and support for updated dependencies. Because of this, you can expect only legacy documentation around v2 in the KB book (https://book-v2.book.kubebuilder.io). We also have migration guides to help support the transition between v2 to v3 in case that helps (https://book.kubebuilder.io/migration/v2vsv3.html), since you can expect a considerable level of changes in the scaffoldings. 

Thank you
Varsha

--
You received this message because you are subscribed to the Google Groups "kubebuilder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubebuilder...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubebuilder/bb08f490-543f-41e6-8ebe-fb16e1d28e61n%40googlegroups.com.


--
Varsha Prasad
Software Engineer
Operator SDK Team
Red Hat Inc. San Francisco

Dan Arad

unread,
Nov 13, 2022, 4:22:59 PM11/13/22
to kubebuilder
Thanks! That clears up things a bit.
I have brought the migration issue with my team and I hope we get to do so soon.

Camila Macedo

unread,
Nov 13, 2022, 11:54:01 PM11/13/22
to Varsha Prasad Narsing, Dan Arad, kubebuilder
Hi Dan, 

To supplement Varsha's answer. 

What PROJECT file stores?

The PROJECT file was introduced since Kubebuilder release 3.0.0, where the Plugins design was introduced. Its purpose is mainly to track all data used to do the scaffolds. It stores more information about what resources and plugins are in use, to better enable plugins to make useful decisions when scaffolding. ( see an example[1] )

Why do we need to store the plugins used?

Kubebuilder allows and provides you opt-in to use plugins, indeed optional ones. Track the information required, for example: 
  • we can check if one plugin can or not be used/supported in the scaffold done
  • what operations can or not be done
  • what data can or not be used in the CLI operations
Note that Kubebuilder is no longer only a CLI tool but can also be used as a lib to allow others to create their plugins/tools and provide helpers and customizations on top of what is done for it, such as it is done by Operator-SDK[2]. SDK leverages Kubebuilder to create plugins to allow users to work with other languages and provide helpers for their users to integrate their projects with the Operator Framework solutions/OLM[3]. Check here[4] to know more about the plugin's vision. 

Additionally motivations

On top of that, another motivation for the PROJECT file would help us to create a feature to allow users easier upgrade their projects by providing allowing to automatically re-scaffold the project: Since we scaffold all data used to do the scaffold, we could automate the steps and have a command that would re-create the project in the latest version by re-doing all commands. More info: https://github.com/kubernetes-sigs/kubebuilder/pull/2895



Dan Arad

unread,
Nov 17, 2022, 9:05:40 AM11/17/22
to Camila Macedo, Varsha Prasad Narsing, kubebuilder
Thanks! This clarifies a lot!

You received this message because you are subscribed to a topic in the Google Groups "kubebuilder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubebuilder/5c4_Xc3Fjx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubebuilder...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubebuilder/CABe7kzOHbCTpZAF5MC72ps7KA0esMMweLnQN1p3vABGaC1Rj2A%40mail.gmail.com.

Camila Macedo

unread,
Nov 17, 2022, 10:40:26 AM11/17/22
to Dan Arad, Varsha Prasad Narsing, kubebuilder
Hi Dan, 

It is great to know that this info helps out. I was looking and all this info is not described into the docs: https://book.kubebuilder.io/reference/project-config.html

Could you raise a ticket/issue for us to track the need to add this there? 
Also, would you like to collaborate with the project by writing this down in the docs? 

Collaborations are very welcome !!!!

Thank you. 

Dan Arad

unread,
Nov 17, 2022, 11:03:17 AM11/17/22
to Camila Macedo, Varsha Prasad Narsing, kubebuilder
Sure. I would love to help out. 
Reply all
Reply to author
Forward
0 new messages