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

[WIP] Uber api server #21190

Closed
wants to merge 6 commits into from
Closed

[WIP] Uber api server #21190

wants to merge 6 commits into from

Conversation

jianhuiz
Copy link
Contributor

create separate uber api server with cluster api object added
duplicate /cmd/kube-apiserver and /pkg/master/ as suggested

@quinton-hoole, @deepak-vij, @XiaoningDing, @alfred-huangjian
#19313
#20733

@k8s-bot
Copy link

k8s-bot commented Feb 12, 2016

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

1 similar comment
@k8s-bot
Copy link

k8s-bot commented Feb 12, 2016

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/new-api size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 12, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/XXL

@bgrant0607
Copy link
Member

@jianhuiz Reference to proposal or issue?

Please also see:
https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md

cc @quinton-hoole

@bgrant0607
Copy link
Member

Also note that we're frozen while trying to converge the 1.2 release at the moment.

@ghost ghost assigned ghost and unassigned bgrant0607 Feb 13, 2016
@ghost
Copy link

ghost commented Feb 13, 2016

@bgrant0607 the proposal is #19313. I can take this one.

@bgrant0607
Copy link
Member

Thanks @quinton-hoole. Let me know when you want to discuss the API.

@lavalamp and/or @caesarxuchao may have suggestions about how to factor the apiserver code.

@bgrant0607 bgrant0607 changed the title Uber api server [WIP] Uber api server Feb 13, 2016
@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 13, 2016
"runtime"
"time"

"k8s.io/kubernetes/cmd/uber-apiserver/app"
Copy link

Choose a reason for hiding this comment

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

Should you reconsider the package name as ube instead of uber? same pattern with kubernetes -> kube

@lavalamp
Copy link
Member

I'm swamped today. I will try to look at this tomorrow.

@ghost ghost added this to the next-candidate milestone Feb 18, 2016
@ghost ghost added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. area/cluster-federation labels Feb 18, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2016
@huangyuqi
Copy link
Contributor

Hi, @jianhuiz

  • In ubernetes's proposal, cluster controller and scheduler will both operate the resource sub-RC. For example, cluster controller watches sub-RC and create corresponding RC in kubernetes cluster.
  • So, i think the resource sub-RC needs to be added in apiserver like cluster. Do you agree?

Would you please give us some suggestion? @quinton-hoole
Thanks.

@jianhuiz
Copy link
Contributor Author

Regarding the test failure at https://github.com/kubernetes/kubernetes/blob/master/pkg/apimachinery/registered/registered.go#L170)

  1. controlplane/v1alpha1 was not included in KUBE_TEST_API_VERSIONS or KUBE_TEST_API so registered.GroupOrDie panics when trying to get API groups of controlplane/v1alpha1
  2. add controlplane/v1alpha1 to KUBE_TEST_API_VERSIONS and KUBE_TEST_API, then it panics at https://github.com/kubernetes/kubernetes/blob/master/pkg/client/unversioned/import_known_versions.go#L35 since controlplane was not installed
  3. add _ "k8s.io/kubernetes/pkg/apis/controlplane/install" to pkg/client/unversioned/import_known_versions.go, the tests passes.
  4. However it will cause the kube-apiserver description mentioning controlplane/v1alpha1 at https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-apiserver/app/options/options.go#L199 which will also trigger the generation of docs/admin/kube-apiserver.md to include that.

All this happens because that now we have two apiservers but other packages and the scripts are dedicated to work with only the kube-apiserver.

Advises?
@quinton-hoole @lavalamp @caesarxuchao @colhom

@lavalamp
Copy link
Member

@nikhiljindal

@k8s-github-robot
Copy link

@jianhuiz PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 25, 2016
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := m.InstallAPIGroup(&apiGroupInfo); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Call InstallAPIGroups() It does more than just calling InstallAPIGroup.
It also adds swagger support. We can potentially add more stuff there as we move more logic to genericapiserver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

InstallAPIGroups() however can be called only once (due to this swagger support) which had been called in master.New()

Since ube-apiserver were to be compatible with uber-apiserver for most of the APIs, those codes are duplicated from uber-apiserver as suggested. I'd rather not to make much changes but try to keep sync with uber-apiserver while it's in refactoring. I therefore call InstallAPIGroup() instead to avoid installing swagger twice.

I disagree that swagger (as well as other potential stuff) should be put inside InstallAPIGroups() which makes the functions behaviors surprises than they look. It would be better move them to init() like the installGroupsDiscoveryHandler()

Copy link
Contributor

Choose a reason for hiding this comment

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

We cant move the swagger stuff to init since it has to be called after all api groups have been added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be modified to be re-installable, or lazy installed, or It can be moved to Run()
Rather than having InstallAPIGroups() can be called only once and all APIs have to be installed at that time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes moving it to Run is reasonable.
#23554.
Thanks!

@nikhiljindal
Copy link
Contributor

I have added some comments in the code.

This is a huge PR which we should split. Its going to be hard for anyone to understand or review this and going to be hard for you to keep in sync.

I think we can have one PR that just adds the ubernetes server (cmd/ube-apiserver code).
With that PR we should be able to do go run cmd/ube-apiserver/server/main.go which should bring up the server with common endpoints as provided by genericapiserver. It wont have any API group version. This should largely be a simple PR that we should be able to get in pretty soon.
The advantage of doing that first is that once it is submitted, we can work in parallel to remove the code duplication between cmd/ube-apiserver and cmd/kube-apiserver (by moving common code to genericapiserver). I can help you with that.
In another PR, we can add the group and then the API objects. I expect that adding API objects might take the most review time. We can get everything else in while API objects PR is being reviewed rather than holding everything for that (if all code is in one PR).

Does that sound reasonable to you?

glog.Fatalf("Failure to start kubelet client: %v", err)
}

apiGroupVersionOverrides, err := parseRuntimeConfig(s)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just so that you know there is #23067 which is refactoring a few things here

@nikhiljindal
Copy link
Contributor

Also, so that you know, there is another option than to duplicate cmd/api-server: We can start with code as in https://github.com/kubernetes/kubernetes/blob/master/examples/apiserver/apiserver.go. That will give us an apiserver to start with. We can add our group and api objects, etc.
And in parallel move more functionality from cmd/kube-apiserver to genericapiserver.

That will save us from keeping the duplicate code in sync (as i pointed there are PRs in flight that are changing that code)

cc @lavalamp

@jianhuiz
Copy link
Contributor Author

@nikhiljindal I personaly wouldn't mind either way, and didn't see either way is better than the other, I just don't want to struggle with the ongoing refactoring and would like to focus on the api objects to support the development of the cluster controler, u7s scheduler, etc. I think I can catch up with the apiserver it self later (when the refactoring of generic apiserver becomes clear)

@jianhuiz jianhuiz closed this Mar 25, 2016
@jianhuiz jianhuiz deleted the uber-api-server branch March 25, 2016 23:41
@huangyuqi huangyuqi mentioned this pull request Apr 1, 2016
20 tasks
k8s-github-robot pushed a commit that referenced this pull request Apr 2, 2016
Automatic merge from submit-queue

duplicate kube-apiserver to federated-apiserver

duplicate the kube-apiserver source code to ube-apiserver and update references
cluster specific api objects will be in separate PRs

#19313,  #21190
#21190 (comment)
@nikhiljindal
k8s-github-robot pushed a commit that referenced this pull request Apr 2, 2016
Automatic merge from submit-queue

genericapiserver: Moving InstallSwaggerAPI to Run

Ref #21190 (comment)

Moving InstallSwaggerAPI() from InstallAPIGroups() to Run(). This allows the use of InstallAPIGroups() multiple times or using InstallAPIGroup() directly.

cc @jianhuiz @kubernetes/sig-api-machinery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.