-
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
kubectl apply ignoring changes to spec.initcontainers field #47264
Comments
@dhawal55 There are no sig labels on this issue. Please add a sig label by: |
/sig cli |
Same issue report in kubernetes/kubectl#27. I believe Strategic Merge Patch works kubernetes/kubectl#27 (comment). It seems not a cli issue. |
Do we have the same issue in 1.7? cc/ @kubernetes/kubernetes-release-managers |
Yes. |
seems according to the doc, only "Changes to the Init Container spec are limited to the container image field.", IIUC, kubernetes/kubectl#27 is trying to update the image field, if @mengqiy you are not working on this, I can help take a look at the issue. |
@xingzhou Thanks for triaging the issue. |
@erictune, I think the root cause of this issue is from these lines of code here. While when we try to update a pod object, we need to convert from One solution is to move the logic in the conversion function to pod's storage methods like create/update, in this case, at least we can realize that user is modifying the fields in |
@xingzhou Is there any workaround? |
@JulianWei you can just go back to specifying your init containers using the beta annotation ( |
In 1.8 we should remove the beta annotation since init containers are GA.
On Jul 13, 2017, at 7:33 PM, Martino di Filippo <notifications@github.com> wrote:
@JulianWei <https://github.com/julianwei> you can just go back to
specifying your init containers using the beta annotation (
pod.beta.kubernetes.io/init-containers), it works correctly. When this bug
is fixed, you will be able to use the stable InitContainers field. A bit
annoying, but easy to fix :)
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#47264 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pwnDUdZ48185RRLcG5xqKxChtP1Wks5sNqlZgaJpZM4N1vty>
.
|
@MartinodF, thank you |
I don't know if this is relevant or not, but it appears that if you never used annotations at all and have only ever used initContainers in your yaml, apply doesn't seem to touch that, either. |
The beta annotations do not work for us. We've even tried to delete our daemonset and and only use the beta annotations but changes don't get noticed. |
Is there any way this could be fixed for 1.7.x? Due to this bug, on 1.7 and earlier, the only reliable way to use init containers is to use the Fixing this in 1.7.x -- so the initContainers field is supported for updates -- would make the migration smoother, as the initContainers field could be used always. Is it too late to get this narrow problem fixed in the next 1.7 release? |
Unfortunately, the annotations have to take precedence as long as 1.5 kubelets are supported (which is through 1.7.x), or updates from those kubelets would not correctly update the objects. 1.8 is the earliest that behavior could be dropped, and was why 6ec80ea was possible. That conflict between honoring the earliest API representation (via annotations) to preserve skewed compatibility and having an API that isn't insane to use is why annotations are no longer used as an alpha/beta-stage mechanism for new fields. |
fixed in #51816 |
So do I understand correctly that currently the safe way is to always duplicate the init container between the annotation and the actual field, and then after upgrading to 1.8 drop the annotation? |
Correct. Pre-1.8, the information is duplicated in two places in the object, with the annotation taking precedence. 1.8+, only the field is honored. You should set the field for forward compatibility, and set the annotation if you want your changes to be effective against a pre-1.8 server. |
Perfect!
…On Thu, Sep 7, 2017 at 1:39 PM Jordan Liggitt ***@***.***> wrote:
So do I understand correctly that currently the safe way is to always
duplicate the init container between the annotation and the actual field,
and then after upgrading to 1.8 drop the annotation?
Correct. Pre-1.8, the information is duplicated in two places in the
object, with the annotation taking precedence. 1.8+, only the field is
honored. You should set the field for forward compatibility, and set the
annotation if you want your changes to be effective against a pre-1.8
server.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#47264 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAICBtiXgBQoDq2gvcHMQM_mU5u_BjOKks5sf_BZgaJpZM4N1vty>
.
|
Rather than manually duplicating the same content to multiple places, I've found that if you explicitly set both the alpha and the beta annotations to |
Thanks @clhodapp -- that's super clever, and it works on 1.6 as well. |
@clhodapp I'm working with @kevingessner and found today that your fix worked only for existing deployments and not for new ones on 1.6. |
Thanks for posting your finding, @linse. It sounds like the only real fix here is updating to 1.8 then. |
I am still encountering this issue with Kubernetes version:
I have tried setting the alpha and beta annotations to null. |
@linse, @clhodapp, @Noah-Huppert Actually, there is a way to avoid
and left only
with
|
BUG REPORT
Kubernetes version (use
kubectl version
):Environment:
uname -a
): Linux 4.11.2-coreos Unit test coverage in Kubelet is lousy. (~30%) #1 SMP Tue May 23 22:04:34 UTC 2017 x86_64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz GenuineIntel GNU/LinuxWhat happened:
kubectl apply
ignores changes inspec.initcontainers
field. Thespec.initContainers
field is also mirrored into alpha and beta annotations. I think the annotations from the previous run overwrite the changes specified inspec.initcontainers
field. If I apply my changes as annotations, it works. Also, there is no--feature-gates
option in kube-apiserver to turn it off annotations for initcontainers.What you expected to happen:
spec.initcontainers
changes should trump over annotationsHow to reproduce it (as minimally and precisely as possible):
Create a deployment with
spec.initcontainer
field populated in pod template. Apply the deployment. Make changesspec.initcontainer
field and apply again. kubectl says deployment is configured but your changes are not appliedThe text was updated successfully, but these errors were encountered: