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

kubelet: group all container-runtime-specific flags/options into a separate struct #44061

Merged
merged 1 commit into from
May 31, 2017

Conversation

yujuhong
Copy link
Contributor

@yujuhong yujuhong commented Apr 4, 2017

They don't belong in the KubeletConfig.

This addresses #43253

@yujuhong yujuhong added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 4, 2017
@yujuhong yujuhong self-assigned this Apr 4, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 4, 2017
@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 4, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@yujuhong yujuhong changed the title [WIP] kubelet: group all docker flags/options into a separate struct kubelet: group all docker flags/options into a separate struct Apr 5, 2017
@yujuhong yujuhong assigned mtaufen and dchen1107 and unassigned yujuhong Apr 5, 2017
@yujuhong
Copy link
Contributor Author

yujuhong commented Apr 5, 2017

/cc @Random-Liu

@@ -80,6 +80,7 @@ type KubeletFlags struct {
type KubeletServer struct {
KubeletFlags
componentconfig.KubeletConfiguration
DockerOptions *DockerOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not take DockerOptions as an embedded field of KubeletServer like KubeletFlags? Then the fields of DockerOptions can be directly accessed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intentional. DockerOptions may be nil in the future.

@@ -156,7 +156,7 @@ func UnsecuredKubeletDeps(s *options.KubeletServer) (*kubelet.KubeletDeps, error
KubeClient: nil,
ExternalKubeClient: nil,
Mounter: mounter,
NetworkPlugins: ProbeNetworkPlugins(s.NetworkPluginDir, s.CNIConfDir, s.CNIBinDir),
NetworkPlugins: ProbeNetworkPlugins(s.DockerOptions.NetworkPluginDir, s.DockerOptions.CNIConfDir, s.DockerOptions.CNIBinDir),
Copy link
Contributor

Choose a reason for hiding this comment

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

If take DockerOptions as an embedded field of KubeletServer, these and other changes are not needed, as the fields of DockerOptions such as s.DockerOptions.NetworkPluginDir can be directly accessed by s.NetworkPluginDir like before.

@yujuhong yujuhong changed the title kubelet: group all docker flags/options into a separate struct [WIP] kubelet: group all docker flags/options into a separate struct Apr 5, 2017
@yujuhong
Copy link
Contributor Author

yujuhong commented Apr 5, 2017

Unfortunately some of the flags are shared by rktnetes, which complicates things. I am going to go through the list of options again. Tagging this as WIP.

DockerEndpoint string
// networkPluginName is the name of the network plugin to be invoked for
// various events in kubelet/pod lifecycle
NetworkPluginName string
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we take these network flags as docker options?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the new CRI world, network plugins are container runtime details. kubelet is not aware of them.

The tricky part is that these are still consumed by rkt since they haven't switched to CRI. That's why I marked this PR as WIP.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explanation!

@@ -248,8 +241,6 @@ func (c *kubeletConfiguration) addFlags(fs *pflag.FlagSet) {
fs.BoolVar(&c.BabysitDaemons, "babysit-daemons", c.BabysitDaemons, "If true, the node has babysitter process monitoring docker and kubelet.")
fs.MarkDeprecated("babysit-daemons", "Will be removed in a future version.")
fs.Int32Var(&c.MaxPods, "max-pods", c.MaxPods, "Number of Pods that can run on this Kubelet.")
// TODO(#40229): Remove the docker-exec-handler flag.
fs.StringVar(&c.DockerExecHandlerName, "docker-exec-handler", c.DockerExecHandlerName, "Handler to use when executing a command in a container. Valid values are 'native' and 'nsenter'. Defaults to 'native'.")
fs.MarkDeprecated("docker-exec-handler", "this flag will be removed and only the 'native' handler will be supported in the future.")
Copy link
Contributor

Choose a reason for hiding this comment

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

delete this line?

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 the issue states, we can't really remove this yet.

@mtaufen
Copy link
Contributor

mtaufen commented Apr 9, 2017

Should --enable-custom-metrics also get demoted to flag-only?

@mtaufen
Copy link
Contributor

mtaufen commented Apr 9, 2017

And what about fields like:

  // dockerEndpoint is the path to the docker endpoint to communicate with.
  DockerEndpoint string `json:"dockerEndpoint"`

  // dockerExecHandlerName is the handler to use when executing a command
  // in a container. Valid values are 'native' and 'nsenter'. Defaults to
  // 'native'.
  DockerExecHandlerName string `json:"dockerExecHandlerName"`

  // rktPath is the  path of rkt binary. Leave empty to use the first rkt in
  // $PATH.
  RktPath string `json:"rktPath"`

  // rktApiEndpoint is the endpoint of the rkt API service to communicate with.
  RktAPIEndpoint string `json:"rktAPIEndpoint"`

  // rktStage1Image is the image to use as stage1. Local paths and
  // http/https URLs are supported.
  RktStage1Image string `json:"rktStage1Image"

This stuff seems pretty runtime-specific and probably shouldn't be fed through the Kubelet.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2017
@yujuhong
Copy link
Contributor Author

And what about fields like:

// dockerEndpoint is the path to the docker endpoint to communicate with.
DockerEndpoint string json:"dockerEndpoint"

// dockerExecHandlerName is the handler to use when executing a command
// in a container. Valid values are 'native' and 'nsenter'. Defaults to
// 'native'.
DockerExecHandlerName string json:"dockerExecHandlerName"

// rktPath is the path of rkt binary. Leave empty to use the first rkt in
// $PATH.
RktPath string json:"rktPath"

// rktApiEndpoint is the endpoint of the rkt API service to communicate with.
RktAPIEndpoint string json:"rktAPIEndpoint"

// rktStage1Image is the image to use as stage1. Local paths and
// http/https URLs are supported.
RktStage1Image string `json:"rktStage1Image"
This stuff seems pretty runtime-specific and probably shouldn't be fed through the Kubelet.

The docker endpoint and exec handler are already included in the DockerOptions in this PR :-|
Not sure about the rkt fields yet. I am not too keen on creating a generic "container runtime options" since rkt and docker are integrated in very different ways (non-CRI vs. CRI) today.

@mtaufen
Copy link
Contributor

mtaufen commented Apr 25, 2017

Please ping me when this is ready for re-review.

Copy link
Contributor

@mtaufen mtaufen left a comment

Choose a reason for hiding this comment

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

We should also use this PR to mark deprecated any runtime-related flags that are planned for removal from the Kubelet.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 25, 2017
@yujuhong
Copy link
Contributor Author

@mtaufen I changed the PR to include all runtime-specific flags. It's not complete though. I think it's ok as a start. Let me know what you think.

@yujuhong yujuhong changed the title [WIP] kubelet: group all docker flags/options into a separate struct kubelet: group all container-runtime-specific flags/options into a separate struct May 25, 2017
Copy link
Contributor

@mtaufen mtaufen left a comment

Choose a reason for hiding this comment

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

Nice work, I had a few comments.

@@ -87,6 +83,7 @@ type KubeletFlags struct {
// a kubelet. These can either be set via command line or directly.
type KubeletServer struct {
KubeletFlags
ContainerRuntimeOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in this PR, but very soon we'll have to actually name these sub-objects. It's getting very confusing what comes from where in KubeletServer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, would it make sense for these to be subordinate to the KubeletFlags object, rather than directly on the KubeletServer, given that they all come in as flags-only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I named it in the original PR but changed it to be consistent with other fields in the struct. Will switch it back.

Also, would it make sense for these to be subordinate to the KubeletFlags object, rather than directly on the KubeletServer, given that they all come in as flags-only?

Make sense. We still need to pass the container runtime options as a whole to kubelet, but I think that's fine. Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's fine. Thanks!

@@ -172,6 +175,6 @@ func GetHollowKubeletConfig(
// have actually wanted the default).
// The default will be present in the KubeletConfiguration contstructed above.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can delete this TODO as well. It's old and irrelevant these days.

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@yujuhong
Copy link
Contributor Author

We should also use this PR to mark deprecated any runtime-related flags that are planned for removal from the Kubelet.

I'll continue evaluate other options to see what can be moved to this new struct, but I think getting this in would help prevent people from adding more fields to KubeletConfig.
As for deprecating the flags, it's to early to do that since we don't have replacement yet.

@mtaufen
Copy link
Contributor

mtaufen commented May 25, 2017

Yeah, SGTM

@mtaufen
Copy link
Contributor

mtaufen commented May 25, 2017

/lgtm
/approve

@yujuhong
Copy link
Contributor Author

@k8s-bot node-e2e test this
@k8s-bot e2e-gce-etcd3 test this
@k8s-bot e2e-kops-aws test this

@yujuhong
Copy link
Contributor Author

/cc @gmarek for approval.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2017
@yujuhong
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

1 similar comment
@yujuhong
Copy link
Contributor Author

@k8s-bot pull-kubernetes-unit test this

@yujuhong
Copy link
Contributor Author

@k8s-bot pull-kubernetes-e2e-kops-aws test this

I've been pasting the wrong one :-|

@yujuhong yujuhong assigned shyamjvs and unassigned gmarek and wojtek-t May 27, 2017
@shyamjvs
Copy link
Member

/approve

@yujuhong
Copy link
Contributor Author

Assigned to @shyamjvs. I found a new victim to approve the kubemark changes before I have to rebase again :-)

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtaufen, shyamjvs, yujuhong

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 27, 2017
Do not store them in kubelet's configuration. Eventually, we would like
to deprecate all these flags as they should not be part of kubelet.
@yujuhong
Copy link
Contributor Author

Rebased and re-applying the lgtm & approved labels based on #44061 (comment) and #44061 (comment)

@yujuhong yujuhong added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 30, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

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. 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