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

RuntimeHandlerResolver: interface invalid nil checking #125561

Open
augustoezq opened this issue Jun 18, 2024 · 5 comments · May be fixed by #125563
Open

RuntimeHandlerResolver: interface invalid nil checking #125561

augustoezq opened this issue Jun 18, 2024 · 5 comments · May be fixed by #125563
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. 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.

Comments

@augustoezq
Copy link

What happened?

the nil checking for interface RuntimeHandlerResolver in #L109 will never check whether the underlying struct is nil.
A reflect nil checking is needed to avoid panic in running 'rcManager.LookupRuntimeHandler'(#L111)

func NamespacesForPod(pod *v1.Pod, runtimeHelper kubecontainer.RuntimeHelper, rcManager RuntimeHandlerResolver) (*runtimeapi.NamespaceOption, error) {
runtimeHandler := ""
if pod != nil && rcManager != nil {
var err error
runtimeHandler, err = rcManager.LookupRuntimeHandler(pod.Spec.RuntimeClassName)
if err != nil {
return nil, err
}
}

What did you expect to happen?

Add reflect nil checking for rcManager

How can we reproduce it (as minimally and precisely as possible)?

  1. kubelet enable standaloneMode
  2. pod.Spec.SecurityContext not nil

Anything else we need to know?

No response

Kubernetes version

master

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

@augustoezq augustoezq added the kind/bug Categorizes issue or PR as related to a bug. label Jun 18, 2024
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 18, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@zhifei92
Copy link

Thank you for reporting the issue, I will create a PR to fix it.

@zhifei92
Copy link

/assign

@zhifei92
Copy link

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 18, 2024
@ThereWeGo
Copy link

@augustoezq 你好 借一层楼 我有个aliyun eci-profile 相关的问题想请教 如果方便请与我取得联系 谢谢 gblogbd@qq.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. 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.
Projects
Development

Successfully merging a pull request may close this issue.

4 participants