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

move apiserver Configuration to k8s.io/apiserver/pkg/apis/config #66059

Merged
merged 4 commits into from
Aug 5, 2018

Conversation

hanxiaoshuai
Copy link
Contributor

What this PR does / why we need it:
ref #2354
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:
After the related componentconfig to be moved to staging, LeaderElectionConfiguration and DebuggingConfiguration should be clean up in pkg/apis/componentconfig
Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 11, 2018
@hanxiaoshuai
Copy link
Contributor Author

/cc @luxas @sttts

@hanxiaoshuai
Copy link
Contributor Author

/retest

@hanxiaoshuai
Copy link
Contributor Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 11, 2018
Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!
@rosti FYI
Please add OWNERS file as in the KEP. Fix verify. Add comment to DebuggingConfiguration. Lowercase the EnableContentionProfiling comment. Maybe add validation now or in a later PR. Move/duplicate the "endpoints" string to this package.

@luxas
Copy link
Member

luxas commented Jul 11, 2018

Feel free to add these packages that need it to .golint_failures btw

@neolit123
Copy link
Member

@kubernetes/sig-api-machinery-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jul 11, 2018
// leaderElect enables a leader election client to gain leadership
// before executing the main loop. Enable this when running replicated
// components for high availability.
LeaderElect *bool `json:"leaderElect"`
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, we should add probuf for all var , syncing with others api struct, so that prase easy . such as https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/apis/example/v1/types.go#L60. Even that may be unnecessary now. @luxas @sttts WDYT

Copy link
Contributor

Choose a reason for hiding this comment

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

do we support protobuf for configs? Do we want to?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, no need for now, Json enough.

@hanxiaoshuai hanxiaoshuai force-pushed the apicfg branch 2 times, most recently from 5b7f20b to aabee11 Compare July 12, 2018 09:53
@hanxiaoshuai
Copy link
Contributor Author

@luxas Done, and I will add validation later if it is need.
/assign @luxas @sttts


// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/apiserver/pkg/apis/config
// +k8s:openapi-gen=true
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want this in openapi?

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 seems we don't want it, I remove it

)

var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
Copy link
Contributor

Choose a reason for hiding this comment

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

remove TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, Thanks for your review

@hanxiaoshuai
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 12, 2018
@@ -0,0 +1,7 @@
approvers:
Copy link
Member

@liggitt liggitt Jul 12, 2018

Choose a reason for hiding this comment

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

the OWNERS file from k8s.io/apiserver would probably be a more appropriate starting point for the reviewers list (and the api approvers owners file for approvals, since config is considered API... see https://docs.google.com/document/d/1OkSQngGem7xaENqaO8jzHLDSSIGh2obPUaJGAFDwTUE/edit#)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luxas @sttts what's your opinions?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for @liggitt's suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

)

// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
Copy link
Member

Choose a reason for hiding this comment

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

does this belong in apiserver? lots of things that aren't apiservers use leader election. I expected it in apimachinery

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it discussed it in doc, in apiserver part, LeaderElectionConfiguration was in it.
@luxas @sttts can you show some info?

Copy link
Contributor

Choose a reason for hiding this comment

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

We were undecided about this one. It seems to be higher level than apimachinery, but also has no tight connections to apiserver. I don't feel strongly with either direction. As the types are kube independent, we can technically also move it to apimachinery. I would like to see some generic ResourceLock syntax which does not reference kube.

Copy link
Member

Choose a reason for hiding this comment

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

cc @mtaufen @wojtek-t who were working on the Lease API

Copy link
Contributor

Choose a reason for hiding this comment

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

does this belong in apiserver? lots of things that aren't apiservers use leader election. I expected it in apimachinery

I don't see this as related to our type system in the same way as TypeMeta, ObjectMeta, Time, or List. I don't even see it as quite as fundamental as ListOptions. Something common for many bits of config, sure. Something common for all types/schemes, not really.

Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, components can migrate to using the Lease API (it was designed to represent the same information as LeaderElectionRecord), but they still have to get related configuration from somewhere (i.e. LeaderElectionConfiguration).

So this is a question of where to put a common config struct type?

Copy link
Member

Choose a reason for hiding this comment

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

is this resolved?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think the consensus is to put it here, in k8s.io/apiserver vs putting it in k8s.io/apimachinery which should hold even more generic types.

RetryPeriod metav1.Duration
// resourceLock indicates the resource object type that will be used to lock
// during leader election cycles.
ResourceLock string
Copy link
Contributor

Choose a reason for hiding this comment

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

what are the value of this? resource plus apigroup plus version?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@fedebongio
Copy link
Contributor

/cc @roycaihw

@luxas
Copy link
Member

luxas commented Jul 27, 2018

/assign @jbeda

@sttts
Copy link
Contributor

sttts commented Jul 27, 2018

Can we at least create the clean-up PR now already to see possible issues early? Don't like to duplicate code and post-poin the cleanups.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2018
@luxas
Copy link
Member

luxas commented Jul 30, 2018

@sttts The PR that cleans this up/moves the usage is here: #66722.
I prefer having clean PRs like this so that one PR adds the net-new code and one PR cleans stuff up later if that is ok by you.
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 30, 2018
@luxas
Copy link
Member

luxas commented Aug 4, 2018

Can we please get a top-level approval of this to get the ball rolling so we can then cleanup the types (PR #66722) ASAP, and unblock the components' types moving (e.g. #66916).

We can always change the structure later if we feel we need to, before going beta with this, but if this is gonna be stuck forever we have no chance improving anything.

@jbeda
Copy link
Contributor

jbeda commented Aug 4, 2018

/approve

Just to get this moving.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2018
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 5, 2018
Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @hanxiaoshuai and @jbeda!
Let's get the ball rolling here and follow-up on minor nits and changes as we go.

)

// LeaderElectionConfiguration defines the configuration of leader election
// clients for components that can run with leader election enabled.
Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think the consensus is to put it here, in k8s.io/apiserver vs putting it in k8s.io/apimachinery which should hold even more generic types.


// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/apiserver/pkg/apis/config
// +k8s:defaulter-gen=TypeMeta
Copy link
Member

Choose a reason for hiding this comment

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

As said in the other PR, we're not sure if we actually need this, but we're leaving it as-is for now

obj.ResourceLock = EndpointsResourceLock
}
if obj.LeaderElect == nil {
obj.LeaderElect = &booltrue
Copy link
Member

Choose a reason for hiding this comment

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

nit: in the future you can use k8s.io/utils/pointer.BoolPtr(true)

kruntime "k8s.io/apimachinery/pkg/runtime"
)

func addDefaultingFuncs(scheme *kruntime.Scheme) error {
Copy link
Member

Choose a reason for hiding this comment

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

TODO: we haven't fully decided if we're gonna register the defaults like this in the scheme, but having this as it is the default way of doing things right now. We can always change stuff later.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hanxiaoshuai, jbeda, luxas

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-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 66058, 66059). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 7dcbdbb into kubernetes:master Aug 5, 2018
k8s-github-robot pushed a commit that referenced this pull request Aug 15, 2018
Automatic merge from submit-queue (batch tested with PRs 67071, 66906, 66722, 67276, 67039). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove references to the structs that have moved to their own packages

**What this PR does / why we need it**:
Follows-up #66058 and  #66059 to remove the structs that now aren't needed in `pkg/apis/componentconfig`

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
xref kubernetes/community#2354

**Special notes for your reviewer**:

This PR depends on:
 - [x] #67090
 - [x] #67149
 - [x] #67159
 - [x] #67207

**Only review commit 'Remove references to the structs that have moved to their own packages' please**

**Release note**:

```release-note
NONE
```
/kind cleanup
/assign @sttts @thockin @jbeda @liggitt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet