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

Figure out a way to manage the discrepancy on windows nodes from the linux node #60338

Open
dchen1107 opened this issue Feb 24, 2018 · 21 comments
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/windows Categorizes an issue or PR as relevant to SIG Windows.

Comments

@dchen1107
Copy link
Member

https://github.com/kubernetes/kubernetes/pull/60275/files/2d942dab68b64e684dd2b75232cf9daabc6e0a95#diff-10055ae93a8699af13ceba0482fc43c3

I am expecting we have more windows specific config like code coming to Kubelet and other node components. We should figure out a way to handle this, so that the code can be easily managed? Instead of letting windows-special handling code like this scattered everywhere in our codebase.

cc/ @feiskyer @michmike @kubernetes/sig-windows-bugs

@k8s-ci-robot k8s-ci-robot added sig/windows Categorizes an issue or PR as relevant to SIG Windows. kind/bug Categorizes issue or PR as related to a bug. labels Feb 24, 2018
@dchen1107 dchen1107 added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Feb 24, 2018
@feiskyer
Copy link
Member

feiskyer commented Feb 24, 2018

@dchen1107 Thanks. This is indeed a problem of windows containers. Usually, we handle this problem in three ways

  • (1) By checking runtime.GOOS == "windows"
  • (2) By splitting codes into platform specific files, e.g. file_linux.go, file_windows.go, file_unsupported.go
  • (3) By splitting codes into different packages.

I think (2) is our preferred way, because (1) would make codes too complex and scattered, while (3) would make codes duplicate.

Windows features have been also broken frequently as no upstream Windows tests are running.
#51540 is aiming to add windows node e2e tests, but the testing environment is still not ready yet. I'd like to clean up related codes after that.

@feiskyer
Copy link
Member

/assign

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2018
@feiskyer
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2018
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 23, 2018
@feiskyer feiskyer added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 23, 2018
@PatrickLang PatrickLang added this to Backlog in SIG-Windows Jan 11, 2019
@yujuhong
Copy link
Contributor

@feiskyer is there anything left to do for this bug?

@feiskyer
Copy link
Member

@yujuhong this is actually cleanup instead of bug. I think there're still many places needing to improve.

/kind cleanup

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 12, 2019
@feiskyer feiskyer removed the kind/bug Categorizes issue or PR as related to a bug. label Jun 12, 2019
@pacoxu
Copy link
Member

pacoxu commented Jun 25, 2021

(2) By splitting codes into platform specific files, e.g. file_linux.go, file_windows.go, file_unsupported.go

(2) is current preferred way. For cmd/kubelet and pkg\kubelet, there are 40 matches across 17 files for runtime.GOOS.

/triage accepted
/help
/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@pacoxu:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

(2) By splitting codes into platform specific files, e.g. file_linux.go, file_windows.go, file_unsupported.go

(2) is current preferred way. For cmd/kubelet and pkg\kubelet, there are 40 matches across 17 files for runtime.GOOS.

/triage accepted
/help
/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jun 25, 2021
@pmgk07
Copy link

pmgk07 commented Jul 18, 2021

I'd like to help out on this issue. Needed pointers on if anything more than the below is required:

  • I find a file with runtime.GOOS
  • Move that piece of code in "file" to "file_linux" / "file_windows" / "file_others"
  • Tag the platform specific things with // +build linux , // +build windows

@adisky
Copy link
Contributor

adisky commented Jul 23, 2021

I'd like to help out on this issue. Needed pointers on if anything more than the below is required:

  • I find a file with runtime.GOOS
  • Move that piece of code in "file" to "file_linux" / "file_windows" / "file_others"
  • Tag the platform specific things with // +build linux , // +build windows

@pmgk07 right, this has to be done, Make sure do it for all runtime.GOOS(wherever possible) instances

pmgk07 added a commit to pmgk07/kubernetes that referenced this issue Jul 23, 2021
Refactor platform dependencies of kubelet options
@pmgk07
Copy link

pmgk07 commented Jul 23, 2021

Thanks @adisky. Raising a simple PR for ./cmd/kubelet/options package to just get the idea of a general PR workflow in this repo

@sorkinl
Copy link
Contributor

sorkinl commented Feb 11, 2022

Is this still in need of cleanup? If not I'd like to work on this. @pmgk07
/assign

@pmgk07
Copy link

pmgk07 commented Feb 12, 2022

@sorkinl Yes, pkg/kubelet contains runtime.GOOS checks within them.

$ grep -rn "runtime.GOOS" pkg/kubelet|wc -l 
      61

@sorkinl
Copy link
Contributor

sorkinl commented Feb 15, 2022

I'd like to help out on this issue. Needed pointers on if anything more than the below is required:

  • I find a file with runtime.GOOS
  • Move that piece of code in "file" to "file_linux" / "file_windows" / "file_others"
  • Tag the platform specific things with // +build linux , // +build windows

@pmgk07 right, this has to be done, Make sure do it for all runtime.GOOS(wherever possible) instances

Thank you @pmgk07 ! I will try to follow these instructions and post here with updates.

@raphminkyu
Copy link

raphminkyu commented Feb 22, 2022

Hi @pmgk07, I'm working on the issue with @sorkinl . We tried making some changes and I was wondering if you could take a look and comment:

We made changes in pkg/kubelet/volume_host.go and changed

func (kvh *kubeletVolumeHost) GetPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string {
	dir := kvh.kubelet.getPodVolumeDir(podUID, pluginName, volumeName)
	if runtime.GOOS == "windows" {
		dir = util.GetWindowsPath(dir)
	}
	return dir
}

to pkg/kubelet/volume_host_others.go with

//go:build !windows
// +build !windows
...
func (kvh *kubeletVolumeHost) GetPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string {
	dir := kvh.kubelet.getPodVolumeDir(podUID, pluginName, volumeName)
	return dir
}

and made pkg/kubelet/volume_host_windows.go:

//go:build windows
// +build windows

package kubelet

func (kvh *kubeletVolumeHost) GetPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string {
	dir := util.GetWindowsPath(dir)
	return dir
}

Is this the right approach? Do we test with go test ./pkg/kubelet/...?

@pmgk07
Copy link

pmgk07 commented Mar 17, 2022

@raphminkyu Sorry for the late reply on this PR. Yes, that looks good enough.

So far these are the files that are in need of refactoring. I grepped on "runtime.GOOS" occurences, might have some false positives.

  • pkg/kubelet/cm/devicemanager/manager.go
  • pkg/kubelet/kuberuntime/kuberuntime_sandbox.go
  • pkg/kubelet/kubelet_test.go
  • pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go
  • pkg/kubelet/stats/cri_stats_provider_test.go
  • pkg/kubelet/kuberuntime/kuberuntime_container.go
  • pkg/kubelet/lifecycle/predicate_test.go
  • pkg/kubelet/lifecycle/predicate.go
  • pkg/kubelet/kubelet_pods.go
  • pkg/kubelet/nodestatus/setters.go
  • pkg/kubelet/volume_host.go
  • pkg/kubelet/kubelet.go
  • pkg/kubelet/kubelet_node_status_test.go
  • pkg/kubelet/kubelet_node_status.go

@raphminkyu & @sorkinl I'll pick up kubelet_pods / kubelet / kubelet_node_status files (& their corresponding test files) for refactoring.

pmgk07 added a commit to pmgk07/kubernetes that referenced this issue Mar 17, 2022
@sorkinl
Copy link
Contributor

sorkinl commented Mar 24, 2022

@pmgk07 Thank you this helps a lot. We will start with changes going down the list and will reach out if we have any questions.

@k8s-triage-robot
Copy link

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Mar 24, 2023
@pacoxu
Copy link
Member

pacoxu commented Mar 28, 2023

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 28, 2023
@k8s-triage-robot
Copy link

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/windows Categorizes an issue or PR as relevant to SIG Windows.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.