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

Refactored kubelet's kuberuntime_sandbox #114185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claudiubelu
Copy link
Contributor

What type of PR is this?

/kind cleanup
/sig windows

/milestone v1.27

What this PR does / why we need it:

Refactors platform specific code into separate files (*_linux.go / *_windows.go / *_others.go)

Adds unit tests for the kuberuntime_sandbox changes.

Co-Authored-By: Claudiu Belu cbelu@cloudbasesolutions.com

Which issue(s) this PR fixes:

Partial cleanup of issue #60338

Special notes for your reviewer:

Original PR: #109761

This PR contains only the kuberuntime_sandbox changes. Contains a few additional unit tests and cleanups.

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/windows Categorizes an issue or PR as relevant to SIG Windows. labels Nov 29, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.27 milestone Nov 29, 2022
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.26 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.26.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Tue Nov 29 15:38:53 UTC 2022.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 29, 2022
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 29, 2022
@matthyx
Copy link
Contributor

matthyx commented Nov 30, 2022

/remove-sig node
/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from matthyx November 30, 2022 14:05
@k8s-ci-robot k8s-ci-robot removed the sig/node Categorizes an issue or PR as relevant to SIG Node. label Nov 30, 2022
@claudiubelu
Copy link
Contributor Author

/retest

2 similar comments
@claudiubelu
Copy link
Contributor Author

/retest

@claudiubelu
Copy link
Contributor Author

/retest

@claudiubelu
Copy link
Contributor Author

/assign @endocrimes

@claudiubelu
Copy link
Contributor Author

/retest

3 similar comments
@claudiubelu
Copy link
Contributor Author

/retest

@claudiubelu
Copy link
Contributor Author

/retest

@marosset
Copy link
Contributor

/retest

@marosset
Copy link
Contributor

/assign

@marosset
Copy link
Contributor

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Dec 15, 2022
SIG Node PR Triage automation moved this from Needs Reviewer to Done Apr 25, 2024
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

@claudiubelu
Copy link
Contributor Author

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Apr 25, 2024
@k8s-ci-robot
Copy link
Contributor

@claudiubelu: Reopened this PR.

In response to this:

/reopen

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.

SIG Node PR Triage automation moved this from Done to Triage Apr 25, 2024
@claudiubelu
Copy link
Contributor Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Apr 25, 2024
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-capz-windows-master

1 similar comment
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-capz-windows-master

@bart0sh bart0sh moved this from Triage to Needs Reviewer in SIG Node PR Triage Apr 25, 2024
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-capz-windows-master

}
if sc.RunAsGroup != nil && runtime.GOOS != "windows" {
lc.SecurityContext.RunAsGroup = &runtimeapi.Int64Value{Value: int64(*sc.RunAsGroup)}
}
namespaceOptions, err := runtimeutil.NamespacesForPod(pod, m.runtimeHelper, m.runtimeClassManager)
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 one linux only? Is there something we configure for Windows for user namespaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took a quick glance in NamespaceForPod: it would seem so. First of all, it does have the Network field, which may be runtimeapi.NamespaceMode_NODE (host network) or runtimeapi.NamespaceMode_POD, which is relevant for Windows as well. Not sure about the other fields though (UsernsOptions may be relevant, since it's based on the Spec's RuntimeClassName). I'd leave this here for the time being. But yeah, it's a bit strange that we need LinuxPodSandboxConfig for Windows.

@@ -141,14 +140,11 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *v1.Pod, attemp
return nil, err
}
podSandboxConfig.Linux = lc
Copy link
Member

Choose a reason for hiding this comment

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

do we need to set linux context on Windows node? Looks counterintuitive

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 so, according to the other comment I've left.

@@ -141,14 +140,11 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *v1.Pod, attemp
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

I have similar desire to refactor this file when I look at it. This PR is taking a very shallow step in refactoring, which makes it a matter of taste as later comment of @bart0sh indicated.

I would suggest to make a little bit bigger effort of separating clearly Windows-only, Linux-only, and shared settings. So when somebody adds a new feature they will not be confused where they put code for it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, added a bit more to this PR. Keep in mind that most of this comes from another PR (#109761), which was split into 3 (so it's easier to merge, one of them merged, this is still in review: #114186), some comments were addressed, a bit extra cleaning.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 7, 2024
@claudiubelu claudiubelu force-pushed the refactor-platform-deps-1 branch 4 times, most recently from 5c0e21b to 129626e Compare May 13, 2024 15:47
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-capz-windows-master

1 similar comment
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-capz-windows-master

@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-unit

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 3, 2024

@claudiubelu: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-e2e-inplace-pod-resize-containerd-main-v2 9de08903ee28d8649915e040c16686ee893ab90d link false /test pull-kubernetes-e2e-inplace-pod-resize-containerd-main-v2
pull-kubernetes-e2e-capz-windows-containerd 5e605d8 link false /test pull-kubernetes-e2e-capz-windows-containerd

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

Refactors platform specific code into separate files (*_linux.go / *_windows.go / *_others.go)

Adds unit tests for the kuberuntime_sandbox changes.

Co-Authored-By: Claudiu Belu <cbelu@cloudbasesolutions.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Needs Reviewer
Status: Tracked
Status: Done
SIG Node PR Triage
Needs Reviewer
Development

Successfully merging this pull request may close these issues.

None yet