-
Notifications
You must be signed in to change notification settings - Fork 40.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
Put pod full name, namespace and uid into docker label #16414
Put pod full name, namespace and uid into docker label #16414
Conversation
Labelling this PR as size/L |
GCE e2e test build/test passed for commit 998413c4ccc83748273b4f5fbfda06e71c30193f. |
GCE e2e test build/test passed for commit 99b9207798f0876c64b8ba198fad8e3d5a224d8c. |
@kubernetes/rh-cluster-infra @mfojtik @smarterclayton |
GCE e2e test build/test passed for commit 99b9207798f0876c64b8ba198fad8e3d5a224d8c. |
Shippable failure is likely a flake:
|
Yeah, maybe. I passed the test locally. |
GCE e2e test build/test passed for commit 99b9207798f0876c64b8ba198fad8e3d5a224d8c. |
GCE e2e test build/test passed for commit 99b9207798f0876c64b8ba198fad8e3d5a224d8c. |
@ashcrow Thanks! :) |
GCE e2e test build/test passed for commit f22dbc26286164356e191d48527a9e87ea134112. |
GCE e2e test build/test passed for commit f22dbc26286164356e191d48527a9e87ea134112. |
@@ -211,6 +211,7 @@ func (p throttledDockerPuller) IsImagePresent(name string) (bool, error) { | |||
return p.puller.IsImagePresent(name) | |||
} | |||
|
|||
// TODO (random-liu) Almost never used, should we remove this? |
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 is used by GetKubeletDockerContainers
. Do you want to rewrite the function?
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.
Ha, what I mean is that we defined the the type "DockerContainers", and defined the function "FindPodContainer". But it seems that we just use "DockerContainers" as slice of APIcontainers (https://github.com/kubernetes/kubernetes/search?utf8=%E2%9C%93&q=GetKubeletDockerContainers&type=Code), never use function like FindPodContainer. So I just wonder whether we should remove this type, :)
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.
Just curious when reading the code, so add a comment 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.
I believe it was used in other places but we gradually migrated off. Personally I'd be happy to see the type be removed. Feel free to send a PR for this :)
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.
OK. :) Thanks! Haha~
@Random-Liu, could you remove the "label filtering" code from this PR? I think this PR should focus on writing the labels :-) |
kubernetesPodNameLabel = "io.kubernetes.pod.name" | ||
kubernetesPodNamespaceLabel = "io.kubernetes.pod.namespace" | ||
|
||
kubernetesPodLabel = "io.kubernetes.pod.data" |
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.
What is this meant for? It is not clear from the variable name. Can you add comments?
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.
@vishh, @Random-Liu didn't add this. This was added for PreStop hook and the label contains the entire serialized pod... I want to remove this. See #/14768 for the details.
edit: we only found out about this label yesterday
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.
@yujuhong I read code about this yesterday, it seems that one of the options is to add some "better-formatted" labels on each container (rather than add the whole pod data), for example add a label like "container_metadata" and write all needed data like PreStop handler into it...
OK. I'll remove the filter related code in this PR. :) |
GCE e2e test build/test passed for commit 68dab7f0b430421f3f4c3a0008ccb67be2932b14. |
// Get restartCount from docker label. If there is no restart count label in an container, | ||
// it should be an old container or an invalid container, we just set restart count to 0. | ||
// Don't report error, because there must be many old containers without the label now | ||
glog.V(3).Infof("Container doesn't have label %s, it may be an old or invalid container", kubernetesContainerRestartCountLabel) |
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.
For the logging message to be meaningful in anyway, we need the container id. I'd suggest returning (int, error) and let the caller handle the error.
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.
Ok!
@@ -1643,8 +1620,8 @@ func (dm *DockerManager) createPodInfraContainer(pod *api.Pod) (kubetypes.Docker | |||
return "", err | |||
} | |||
|
|||
// There is no meaningful labels for infraContainer now, so just pass nil. | |||
id, err := dm.runContainerInPod(pod, container, netNamespace, getIPCMode(pod), getPidMode(pod), nil) | |||
// Current now we don't care about restart count of infra container, just set it to 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.
Remove "Current now"
FYI, you can use "currently" or not use it at all (implied). "Current now" is not grammatically correct :-)
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.
Oops(corrected)...I don't even know where I learned it. I really need more suggestions like this about my grammar, words etc. Thank you very much! :)
lgtm with some nits :) |
GCE e2e test build/test passed for commit 29bb7941200da8923895f5f7bd31afb9400de8c6. |
lgtm. please squash. |
Sure. Thanks :) |
…pod namespace and pod uid into docker label
29bb794
to
b3585a5
Compare
Squashed. :) |
GCE e2e build/test failed for commit b3585a5. |
GCE e2e test build/test passed for commit b3585a5. |
@k8s-bot unit test this |
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 b3585a5. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
This PR mainly did 3 things:
Some questions or TODOs:
(For issue #15089)