-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
k8s: Convert from Resource[Pod] to Table[LocalPod] #36101
Conversation
fed2d41
to
cd15e5f
Compare
/test |
cd15e5f
to
99557d3
Compare
/test |
99557d3
to
10ec1bd
Compare
10ec1bd
to
d5531f5
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This pull request has been automatically marked as stale because it |
d5531f5
to
c1616fb
Compare
/test |
2b1ff8a
to
2cc303d
Compare
/test |
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.
Seems like a good substitution as far as I can see
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.
Did a quick first pass, just a couple of nits, will do another pass soon.
2cc303d
to
f5407d8
Compare
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.
🍕
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.
✔️
/test |
ping @youngnick @sayboras |
Signed-off-by: Jussi Maki <jussi@isovalent.com>
As the first conversion of Resource[T] to Table[T], refactor Resource[Pod] into Table[LocalPod]. Signed-off-by: Jussi Maki <jussi@isovalent.com>
f5407d8
to
9d55fe7
Compare
/test |
time.Now = func() time.Time { | ||
return time.Date(2000, 1, 1, 10, 30, 0, 0, time.UTC) | ||
} | ||
os.Setenv("TZ", "") |
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.
These should probably be restored after the test finishes, so they don't influence any successive tests:
now := time.Now
time.Now = func() time.Time {
return time.Date(2000, 1, 1, 10, 30, 0, 0, time.UTC)
}
t.Cleanup(func() { time.Now = now })
t.Setenv("TZ", "")
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.
This kicks off the transition away from
Resource[T]
toTable[T]
by switchingResource[*Pod]
intoTable[LocalPod]
. I've talked about the benefits in #34060. Thedaemon/k8s/testdata/pod.txtar
somewhat show-cases the benefits to inspection, testing and indexing. By storing the K8s objects in StateDB tables we get all the machinery for querying, watching for changes, testing (with 'db' script commands) and inspecting with cilium-dbg.I'm starting with pods as that's needed for #35652.
I'm not making
Table[LocalPod]
aOnDemand[Table[LocalPod]]
, e.g. we'll start reflecting pods regardless of whether there's users for it or not, since it's one of the fundamental core k8s objects that we always pull regardless of configuration.For other conversions we'll need to consider carefully whether or not to start the reflection, or whether to expose the table as the reference counted
OnDemand
resource.