-
Notifications
You must be signed in to change notification settings - Fork 768
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
[BUG] Sidecarset sourceContainerNameFrom 并不支持name,namespace #1735
Comments
@magicsong 看起来是的,你愿意同步一下这段代码贡献一下吗? |
it is strange to use pod name and namespace as part of the container name , are there any reason of this usage? @magicsong |
"sourceContainerNameFrom should be a mechanism similar to the downward API, used to mount pod metadata to environment variables, rather than its literal name meaning." |
so what field do you need the complete downward api ? it make no sense to make sourceContainerNameFrom refer to the pod name. Do you mean other fields? TransferEnv can refer to the environment name of another container, this environment can use downward api. |
The sidecar needs to have the ability to know its own name and namespace without interfering with the main container. Not all main containers have the environment variables PodName and PodNamespace, and the names are fixed. Additionally, the OpenKruise documentation mentions support for [metadata.name], but it is not actually supported. |
you do not need to use transferEnv for this purpose, you can just use downward api related environment in the container part of sidecarset (sidecarset.spec.containers[].env[].valueFrom.fieldRef.fieldPath ) |
maybe you could have a try. it will be rejected |
you can try this example
|
considering the container name of the main container. if there is more than 2 sidecar, i need to know which is the main container according its name |
After some experimentation, I found that:
|
since sidecar and app container shares the same pod, sidecar can retrieve the pod information using downward api with sidecar's own environment, it is not necessary to transfer environment from app container. Anyway the document is indeed misleading, we will fix that. |
What happened:
https://github.com/pigletfly/kruise/blob/6a62320848f8e10e037c747eeef6b99552af7fa9/pkg/control/sidecarcontrol/util.go#L434
What you expected to happen:
这里hardcode枚举了,仅仅支持labels和annoation,sidecar无法获取自己的name,namepsace
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kubectl version
):The text was updated successfully, but these errors were encountered: