-
Notifications
You must be signed in to change notification settings - Fork 40.7k
add generation / observedGeneration test for mirror pods #132198
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: natasha41575 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
for annotationKey, _ := range pod.Annotations { | ||
if annotationKey == v1.MirrorPodAnnotationKey { | ||
gomega.Expect(pod.Generation).To(gomega.BeEquivalentTo(1)) | ||
gomega.Expect(pod.Status.ObservedGeneration).To(gomega.BeEquivalentTo(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had been thinking about updating the podspec here to demonstrate / test that bumping the mirror podspecs result in generation
getting bumped, something like this:
ginkgo.By("updating tolerations to trigger generation bump")
pod.Spec.Tolerations = append(pod.Spec.Tolerations, v1.Toleration{
Key: "pod-generation-test-" + string(uuid.NewUUID()),
Operator: v1.TolerationOpEqual,
Value: "bar",
Effect: v1.TaintEffectNoSchedule,
})
_, err := f.ClientSet.CoreV1().Pods("kube-system").Update(ctx, &pod, metav1.UpdateOptions{})
framework.ExpectNoError(err, "failed to update pod")
updatedPod, err := f.ClientSet.CoreV1().Pods("kube-system").Get(ctx, pod.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to get pod")
gomega.Expect(updatedPod.Generation).To(gomega.BeEquivalentTo(currentGeneration + 1))
gomega.Expect(updatedPod.Status.ObservedGeneration).To(gomega.BeEquivalentTo(0))
but I felt that modifying the kube-system pods seems dangerous... not sure if there is a simple way to test the behavior of static pods here when their spec is modified (please let me know if there is). If not, then maybe best to leave it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two ways:
- in test/e2e you can hack around and schedule a pod that will drop a new static pod into the manifests folder. This is not a great way forward.
- Use test/e2e_node and follow examples https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/mirror_pod_test.go and https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/standalone_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aojea is it a good thing to make tests rely on existence of at least one kube-system static pod? I remember somebody mentioned kube-proxy may go away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pointer! Will follow 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kube-proxy is only used as static pod in gke and gce scripts 🙃 , kubeadm uses a daemonset to deploy kube-proxy ... e2e test has to be agnostic of the cluster type so it does not seem a good idea to assume any cluster will have a kube-system static pod ...
/assign @SergeyKanzhelev |
@natasha41575: The following tests failed, say
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. |
What type of PR is this?
/kind cleanup
/area test
What this PR does / why we need it:
Add a test for generation and observedGeneration of mirror pods.
Which issue(s) this PR is related to:
Fixes #132162
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/sig node
/priority important-soon
/triage accepted