-
Notifications
You must be signed in to change notification settings - Fork 703
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
Unify code structure of training job api #1300
Unify code structure of training job api #1300
Conversation
- Clean up register.go and use reference in groupversion_info.go (generated by kubebuilder) instead - Add doc.go and register.go for framework missing them - Remove global tag “+k8s:deepcopy-gen=package,register” and this should be taken care of by controller-gen. Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
1. Update codegen scripts to generate defaulters and openapi spec for all frameworks 2. Create defaults.go for framework which miss it. Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
/cc @kubeflow/wg-training-leads @zw0610 Please have a review on this change |
@Jeffwan: GitHub didn't allow me to request PR reviews from the following users: a, review, on, change, Please, have, this. Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good.
@gaocegege @zw0610 Please have another check. Rerun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Consider adding goimports
check to the CI?
Yeah, that's a good idea. I will add it in a separate PR. there're some more cleanups on the CI tools. |
Great @Jeffwan |
@@ -123,7 +123,7 @@ type MXJobReconciler struct { | |||
|
|||
func (r *MXJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | |||
_ = log.FromContext(ctx) | |||
logger := r.Log.WithValues(mxjobv1.Singular, req.NamespacedName) | |||
logger := r.Log.WithValues("mxjobs", req.NamespacedName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jeffwan Do we want to keep Singular
and Plural
in the constants also ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, nice catch. I've moved them to constants.go now
Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
@@ -12,7 +12,6 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
// +k8s:deepcopy-gen=package,register |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need deepcopy-gen
to generate file anymore since we have controller-gen
from kubebuilder. They do the same work
Seems it looks good to most reviewers. Can someone leave a /cc @kubeflow/wg-training-leads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Jeffwan, terrytangyuan, zw0610 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Add docs, register in job apis - Clean up register.go and use reference in groupversion_info.go (generated by kubebuilder) instead - Add doc.go and register.go for framework missing them - Remove global tag “+k8s:deepcopy-gen=package,register” and this should be taken care of by controller-gen. Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com> * Generate defaults and openapi for all frameworks 1. Update codegen scripts to generate defaulters and openapi spec for all frameworks 2. Create defaults.go for framework which miss it. Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com> * Add Kind in constants.go Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com> * Update update-codegen to generate openapi-gen Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com> * Run goimports to format the files * Add Plural and Singular to apis constants.go Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
This PR is part of #1299 kubeflow/common#138
It resolves "1. Eliminate difference between operators and make them have same coding structure (including apis, docs, openapi specs)"
We use this opportunity to unify the apis code structure.
kubebuilder
andcode-generator
will be used together to achieve the goalcontroller-runtime
to generate codes. However, it won't give us clientset, openapis, etc. Ideally, we would like to generate clientset,informer,lister for any tools that want to interact with training jobs. In this case, we still needcode-generator
.Kubebuilder only gives us following objects.