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

add clientset/lister/informer generation #1194

Merged
merged 5 commits into from
Jun 10, 2020

Conversation

sperlingxx
Copy link
Member

This PR is to refine kubernetes clients generation for katib. The major contribution is generating codes of clientset/lister/informer via k8s.io/code-generator/generate-groups.sh.

In order to run generate-groups.sh properly, project k8s.io/code-generator and k8s.io/gengo need to be unpruned.

Could you help to review this PR? @andreyvelich @gaocegege @johnugeorge

@kubeflow-bot
Copy link

This change is Reviewable

@gaocegege
Copy link
Member

Why do we need such a generation? Will you use it to build some upper-level projects?

@sperlingxx
Copy link
Member Author

sperlingxx commented May 21, 2020

Why do we need such a generation? Will you use it to build some upper-level projects?

Actually I want to preserve/track katib custom resources (experiments/suggestions/trials) with internal agent which requires listers and informers of CRDs. I think, as our internal agent, typed clients/listers/informers are usually essential, in order to interact with other kubernetes-native systems.

@gaocegege
Copy link
Member

/lgtm

We are using k8s-sigs/controller-runtime/pkg/client to do such things. But I think this feature is necessary.

@sperlingxx
Copy link
Member Author

@gaocegege Yes, many early-built controllers (such as tf-operator) are based on client-go instead of kube-builder. Thanks for review!

github.com/kubeflow/katib/pkg/client/controller \
github.com/kubeflow/katib/pkg/apis/controller \
"common:v1alpha3 experiments:v1alpha3 suggestions:v1alpha3 trials:v1alpha3" \
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need boilerplate.go.txt file in /hack folder for header?

Copy link
Member Author

@sperlingxx sperlingxx May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreyvelich Maybe we can change it to kubeflow specialized header ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be specific to Kubeflow licence, like here: https://github.com/kubeflow/katib/blob/master/hack/verify-gofmt.sh#L2-L14 ?

@johnugeorge
Copy link
Member

Instead of all files, why don't we just keep the generator files in the upstream? If someone needs it, it can run the generator files to generate all. Since Kubebuilder won't use this at all, I feel that we should avoid it in the upstream

@gaocegege
Copy link
Member

Instead of all files, why don't we just keep the generator files in the upstream? If someone needs it, it can run the generator files to generate all. Since Kubebuilder won't use this at all, I feel that we should avoid it in the upstream

I think it does not work since we cannot use vendor to install these packages. Then the users have to maintain a fork of katib. I think we should keep all the client and informer in the upstream, or just do not support it.


PROJECT_ROOT=${GOPATH}/src/github.com/kubeflow/katib
CODEGEN_PKG=${PROJECT_ROOT}/vendor/k8s.io/code-generator
VERSION_LIST=(v1alpha3 v1beta1)
SWAGGER_VERSION="0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each Katib version Swagger Version will be v0.1, is that fine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any suggestion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreyvelich I've refined the schema of swagger version, which became ${katib_version}-{swagger_sub_version}. So, with swagger version, we can figure out katib version who generated it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sperlingxx, SGTM.

@sperlingxx
Copy link
Member Author

/retest

@gaocegege
Copy link
Member

@andreyvelich @johnugeorge PTAL

/lgtm

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/cc @johnugeorge

@johnugeorge
Copy link
Member

/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnugeorge

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 917164a into kubeflow:master Jun 10, 2020
sperlingxx added a commit to sperlingxx/katib that referenced this pull request Jul 9, 2020
* adapt v1beta1

* add resources for v1alpha3

* fix

* refine update-codegen script

* add katib apiVersion as prefix of swagger version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants