kpt
kpt copied to clipboard
generate kpt package from kubebuilder project + related functions/operations
To increase the adoption of Kpt, the goal is to generate a kpt package from a kubebuilder project. We can have 2 approaches:
- generate kpt package using a plugin in kubebuilder.
- generate a kpt package from an existing kubebuilder project.
On top a set of operations would be performed on the generated package. These can be implemented as functions, but they should be grouped together since they are related to the operation someone wants to perform on the package.
Examples of such operations are:
- set serviceAccount to a different name
- set service to a different name
- add/delete web hooks
- inject rbac proxy
- change args of a container
- add env variables of a container
- change deployment to statefulset
- set image: available
- set namespace: available
Thank you so much for filing these cases!
Here is my current thought on the above and potential workflow.
export KPT_BLUEPRINT_DIR=./blueprint/admin
- create kubebuilder project
- mkdir -p ${KPT_BLUEPRINT_DIR}
- kpt pkg init ${KPT_BLUEPRINT_DIR}
- set namespace
- kpt-gen copy SRC_DIR TGT_DIR -> gets role/rolebinding, clusterrole/clusterrolebindin + CRDs
- kpt-gen init -> creates deployment or statefulset or other + service Account
- kpt-gen create namespace
- kpt-gen create webhooks
- kpt-gen create metrics/prometheus
- kpt-gen create brace-proxy
-> the kpt-gen are used to initialise the package but don't do pure mutators and validators. These can generate new resources based on the input and as such would be done using kpt-gen (or whatever we call this tool eventually). -> the kpt-gen uses KptFile and an additional fn-config to perform its operations.
After we can use the kpt fn mutators and validators to execute the kpt pipeline