-
Notifications
You must be signed in to change notification settings - Fork 40k
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
rkt: rewrote GetPods to use rkt's api service #17969
Conversation
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
1 similar comment
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
Labelling this PR as size/L |
a6b9225
to
64ac183
Compare
} | ||
} | ||
|
||
manifest.Annotations = append(manifest.Annotations, []appctypes.Annotation{ |
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.
To be pedantic - you should check for any existing annotations by these names, since the spec says they must be unique:
Annotation names must be unique within the list.
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.
@jonboulle We should validate this when marshaling the manifest
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.
Sure but the behaviour is not going to be very user friendly in that case.
@dgonyeo I believe there should be other files in this PR right? |
Not sure what files I'm missing here. |
64ac183
to
4bf4079
Compare
@dgonyeo I was thinking you have modified rkt_info stuff. Never mind. |
@@ -71,6 +72,16 @@ const ( | |||
unitRktID = "RktID" | |||
unitRestartCount = "RestartCount" | |||
|
|||
k8sRktKubeletAnno = "k8s.io/rkt/managed-by-kubelet" | |||
k8sRktKubeletAnnoValue = "true" | |||
k8sRktUIDAnno = "k8s.io/rkt/uid" |
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 don't think these are valid annotations. you want rkt.kubernetes.io/uid, etc
b2410fe
to
8361f45
Compare
if countString, ok := manifest.Annotations.Get(k8sRktRestartCountAnno); ok { | ||
num, err := strconv.Atoi(countString) | ||
if err != nil { | ||
continue |
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.
print the error here?
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.
besides, why continue here, but return error in other places?
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 a feeling that if I errored on that, that one could prevent the kubelet from restarting a given pod by inserting a pod with a matching uid annotation and a garbage restart count annotation.
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.
@dgonyeo OK, but that can also happen by inserting random bytes in the pod manifest to let json.Unmarshal fail?
I am ok we all continue
in these places, with a warning message printed.
8361f45
to
2446c81
Compare
} | ||
|
||
manifest := appcschema.PodManifest{} | ||
err = json.Unmarshal(inspectResp.Pod.Manifest, manifest) |
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.
unmarshal needs a pointer
259e69a
to
6e39cd3
Compare
Please run gofmt.
|
6e39cd3
to
4bb45da
Compare
@k8s-bot ok to test |
9b5f87b
to
a80f280
Compare
@yifan-gu should be ready for another pass. |
Labelling this PR as size/XL |
}, opts.PortMappings, nil | ||
} | ||
|
||
func getMatchingPodsRequest(pod *api.Pod) *rktapi.ListPodsRequest { |
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.
probably not the best name, how about just return the filter, and call it kubernetesPodFilter
or something?
commented, just some small testing stuff. @dgonyeo |
This involved adding annotations to the rkt pod's manifest that contain information about the kubernetes pod, which is later read by the kubelet.
a80f280
to
5a16b47
Compare
Done. How's that look? |
LGTM. I think we need to do some further reorganizing on the code later. |
GCE e2e test build/test passed for commit 5a16b47. |
The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label? |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 5a16b47. |
@k8s-bot unit test this |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 5a16b47. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
This commit modifies the kubelet to use rkt's new API service when the kubelet wants to list all current pods.
This involved adding annotations to the rkt pod's manifest that contain
information about the kubernetes pod, which is later read by the
kubelet.