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

FakeClient: list pod err after an pod evicted #110424

Closed
LY-today opened this issue Jun 7, 2022 · 7 comments · Fixed by #110425
Closed

FakeClient: list pod err after an pod evicted #110424

LY-today opened this issue Jun 7, 2022 · 7 comments · Fixed by #110425
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/testing Categorizes an issue or PR as relevant to SIG Testing. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@LY-today
Copy link

LY-today commented Jun 7, 2022

What happened?

After I evicted an pod, I performed the operation of the full list instance, but found something that did not meet expectations

item[0]: can't assign or convert v1beta1.Eviction into v1.Pod

What did you expect to happen?

After pods are evicted, non-evicted ones can be listed normally

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

package main

import (
	"context"
	v1 "k8s.io/api/core/v1"
	policy "k8s.io/api/policy/v1"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes/fake"
)

func main() {
	client := fake.NewSimpleClientset()
	client.CoreV1().Pods("default").Create(context.Background(),&v1.Pod{
		ObjectMeta: meta_v1.ObjectMeta{
			Name:      "pod-1",
			Namespace: "default",
		},
	},meta_v1.CreateOptions{})
	_ = client.CoreV1().Pods("default").EvictV1(context.Background(), &policy.Eviction{
		ObjectMeta: meta_v1.ObjectMeta{
			Name: "pod-1",
		},
	})
	_, err := client.CoreV1().Pods("default").List(context.Background(),meta_v1.ListOptions{})
	//err: item[0]: can't assign or convert v1beta1.Eviction into v1.Pod
}

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
# paste output here
v1.20.0

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)

@LY-today LY-today added the kind/bug Categorizes issue or PR as related to a bug. label Jun 7, 2022
@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 7, 2022
@pacoxu

This comment was marked as abuse.

@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 8, 2022
@endocrimes endocrimes added this to Triage in SIG Node Bugs Jun 8, 2022
@endocrimes
Copy link
Member

#110425

/sig api-machinery
/remove-sig node

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jun 8, 2022
@endocrimes endocrimes moved this from Triage to Done in SIG Node Bugs Jun 8, 2022
@leilajal
Copy link
Contributor

leilajal commented Jun 9, 2022

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jun 9, 2022
@leilajal
Copy link
Contributor

leilajal commented Jun 9, 2022

/assign @yliaog since you are tagged on the PR. Thanks!
/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 Jun 9, 2022
@LY-today
Copy link
Author

/sig testing

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 10, 2022
@LY-today
Copy link
Author

@yliaog If you have time, please help to look at this pr, thanks

@liggitt liggitt changed the title list pod err after an pod evicted FakeClient: list pod err after an pod evicted Jun 14, 2022
@liggitt
Copy link
Member

liggitt commented Jun 14, 2022

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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging a pull request may close this issue.

6 participants