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

Refactor the kube-controller-manager ComponentConfig structs #66993

Merged

Conversation

luxas
Copy link
Member

@luxas luxas commented Aug 5, 2018

What this PR does / why we need it:

This PR cleans up the kube-controller-manager structs in the componentconfig package and fixes various structural issues in the current code, in order to make it possible to later move the code out to external API groups (as a starting point GenericControllerManagerConfiguration to k8s.io/controller-manager).

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

This PR depends on:

Special notes for your reviewer:

Please only review the following commits:

  • Refactor the k-c-m ComponentConfig structs to they can be moved out
  • Fixup cmd/kube-controller-manager code after struct changes.

Release note:

NONE

/assign @sttts @stewart-yu @liggitt @thockin

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Aug 5, 2018
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. labels Aug 5, 2018
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 5, 2018
@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 labels Aug 5, 2018
@luxas
Copy link
Member Author

luxas commented Aug 5, 2018

/hold
This PR is WIP currently and depends on an other PR but I really want to get feedback on the direction. After this PR merges we can move out the controller manager structs properly to staging repos

@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 Aug 5, 2018
CloudProvider CloudProviderConfiguration `json:"cloudProvider"`
// externalCloudVolumePlugin specifies the plugin to use when cloudProvider is "external".
// It is currently used by the in repo cloud providers to handle node and volume control in the KCM.
ExternalCloudVolumePlugin string `json:"externalCloudVolumePlugin"`
Copy link
Contributor

Choose a reason for hiding this comment

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

ExternalCloudVolumePlugin not belong to cloud-controller-manager now, should not place in KubeCloudSharedConfiguration. WDYT

// '-foo' means "disable 'foo'"
// first item for a particular name wins
Controllers []string `json:"controllers"`
// DebuggingConfiguration holds configuration for Debugging related features.
Copy link
Contributor

Choose a reason for hiding this comment

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

Controllers also belong to kube-cc, does we want add it to cloud-cc?

zero := metav1.Duration{}
// Port
if obj.Address == "" {
obj.Address = "0.0.0.0"
}
if obj.RouteReconciliationPeriod == zero {
obj.RouteReconciliationPeriod = metav1.Duration{Duration: 10 * time.Second}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does RouteReconciliationPeriod in KubeCloudSharedConfiguration?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@luxas luxas changed the title Clean up the componentconfig types and fix API violations WIP: Clean up the componentconfig types and fix API violations Aug 6, 2018
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 6, 2018
@luxas luxas force-pushed the cleanup_componentconfig_types branch from 6c17d45 to 584e09b Compare August 8, 2018 21:07
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 8, 2018
@luxas luxas changed the title WIP: Clean up the componentconfig types and fix API violations Clean up the componentconfig types and fix API violations Aug 9, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2018
@luxas luxas force-pushed the cleanup_componentconfig_types branch from de82b24 to e54c52b Compare August 9, 2018 20:06
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2018
@luxas luxas changed the title Clean up the componentconfig types and fix API violations Refactor the kube-controller-manager ComponentConfig structs Aug 9, 2018
cdkbot-zz pushed a commit to juju-solutions/kubernetes that referenced this pull request Aug 9, 2018
Automatic merge from submit-queue (batch tested with PRs 67160, 67090, 67159, 66866, 62111). 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 `pkg/apis/componentconfig/install` and fix inconsistencies

**What this PR does / why we need it**:
This PR fixes a bunch of problems with the (deprecated, monolithic, to be removed) componentconfig API group:
 - As discussed with @liggitt, the current structure of k-c-m componentconfig types is really bad, and we don't want anyone to think it can be serialized (not that we have any such code, but anyway). So we deciided to remove all JSON tags from the types to be consistent, register the violations, then move types out, get the structure right, and **first then** add JSON tags.
 - There should not be an `install` package for componentconfigs that installs stuff in `legacyscheme`,  removed the package and references to it.
 - Added myself and @sttts to approvers for `pkg/apis/componentconfig`, which we intend to remove in favor for dedicated API groups in different staging repos.
 - Removed the componentconfig types from the API testing in `pkg/api/testing`, that roundtrip and defaulting testing will exist in the dedicated API groups instead. Added a TODO to add roundtrip, defaulting and type tag testing later.
 - Made the `register.go` files more consistent to the common template.

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

**Special notes for your reviewer**:

This PR must merge before kubernetes#66722 and kubernetes#66993

**Release note**:

```release-note
NONE
```
@kubernetes/sig-api-machinery-pr-reviews @kubernetes/sig-cluster-lifecycle-pr-reviews 
/assign @sttts @thockin @jbeda @liggitt
@sttts
Copy link
Contributor

sttts commented Aug 29, 2018

TestSchedulerOptions is broken, nil pointer panic.

@jbeda
Copy link
Contributor

jbeda commented Aug 29, 2018

/approve

Based on @sttts giving it an lgtm.

@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 29, 2018
@@ -110,12 +108,14 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_config_KubeSchedulerConf
if err := Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_config_KubeSchedulerLeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
return err
}
if err := configv1alpha1.Convert_v1alpha1_ClientConnectionConfiguration_To_config_ClientConnectionConfiguration(&in.ClientConnection, &out.ClientConnection, s); err != nil {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ClientConnection, &out.ClientConnection, 0); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

this conversion isn't right

Copy link
Member Author

Choose a reason for hiding this comment

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

ugh, I have no idea what happened there wrt the autogenerated code. Can't reproduce either

Copy link
Contributor

Choose a reason for hiding this comment

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

I have seen this independently from this PR. Looks like we have another code generation bug, maybe in the vicinity of Makefile.generated_files. /cc @thockin

@liggitt
Copy link
Member

liggitt commented Aug 29, 2018

/hold

there are some outstanding issues to resolve before merge:

  • test failure
  • unexpected generated conversion in scheduler (maybe related to test failure)
  • apparent double flag registration (for Debugging.AddFlags() and CloudProvider.AddFlags())

@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 Aug 29, 2018
@luxas luxas force-pushed the cleanup_componentconfig_types branch from ed69833 to b4a51f1 Compare August 30, 2018 16:31
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 30, 2018
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@luxas
Copy link
Member Author

luxas commented Aug 30, 2018

Ugh, I have no idea what happened with the generated code on the last push. Good you and the tests noticed the wrongly-autogenerated file in the last push.
Now that is fixed though, files generated correctly (as everytime but last time 😟)

apparent double flag registration (for Debugging.AddFlags() and CloudProvider.AddFlags())

adressed

@luxas
Copy link
Member Author

luxas commented Aug 30, 2018

/hold cancel
Bad autogenerated code removed, so now this passes all tests.
Please re-review 🙏

@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 Aug 30, 2018
@luxas luxas added this to the v1.12 milestone Aug 30, 2018
@luxas
Copy link
Member Author

luxas commented Aug 30, 2018

/retest

@liggitt
Copy link
Member

liggitt commented Aug 31, 2018

lgtm, but has conflicts according to github

fs.DurationVar(&o.ControllerStartInterval.Duration, "controller-start-interval", o.ControllerStartInterval.Duration, "Interval between starting controller managers.")
// TODO: complete the work of the cloud-controller-manager (and possibly other consumers of this code) respecting the --controllers flag
fs.StringSliceVar(&o.Controllers, "controllers", o.Controllers, fmt.Sprintf(""+
"A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller "+
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space too much

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

if err := o.Debugging.ApplyTo(&cfg.Debugging); err != nil {
return err
}
cfg.Port = o.Port
Copy link
Contributor

Choose a reason for hiding this comment

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

newline above port

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

if o == nil {
return nil
}

errs := []error{}
errs = append(errs, o.Debugging.Validate()...)
allControllersSet := sets.NewString(allControllers...)
Copy link
Contributor

Choose a reason for hiding this comment

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

newline above

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 1, 2018
@luxas luxas force-pushed the cleanup_componentconfig_types branch from b4a51f1 to b17d7bf Compare September 2, 2018 11:11
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 2, 2018
@luxas
Copy link
Member Author

luxas commented Sep 2, 2018

Rebased, e2e's are green, and both @sttts and @liggitt have given their LGTMs (thanks).
Applying the label

@luxas luxas added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 2, 2018
@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. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

@k8s-github-robot k8s-github-robot merged commit b8e97d3 into kubernetes:master Sep 2, 2018
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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants