-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
kubeadm: sort pod Volumes and VolumeMounts #70027
kubeadm: sort pod Volumes and VolumeMounts #70027
Conversation
Order of Volumes and VolumeMounts in the pod objects created by kubeadm is undefined as they're represended as maps in the controlPlaneHostPathMounts struct. This influences 'kubeadm upgrade' logic in a way that even when manifest of the component is not changed kubeadm tries to upgrade it because most of the time current and new pods are not equal due to the different order of Volumes and VolumeMounts. For example 'kubeadm apply diff' almost always shows difference in Volumes and VolumeMounts because of this: volumeMounts: + - mountPath: /etc/kubernetes/pki + name: k8s-certs + readOnly: true - mountPath: /etc/ssl/certs name: ca-certs + readOnly: true + - mountPath: /etc/pki + name: etc-pki + readOnly: true + - mountPath: /usr/share/ca-certificates + name: usr-share-ca-certificates readOnly: true - mountPath: /etc/ca-certificates name: etc-ca-certificates readOnly: true - - mountPath: /etc/pki - name: etc-pki - readOnly: true - - mountPath: /etc/kubernetes/pki - name: k8s-certs - readOnly: true - - mountPath: /usr/share/ca-certificates - name: usr-share-ca-certificates - readOnly: true Sorting Volumes and VolumeMounts should fix this issue and help to avoid unnecessary upgrades.
/cc @neolit123 |
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.
@bart0sh thank you for this PR.
i think the PR is pretty self-explanatory and the sorted volumes is something we should definitely have.
one small request: please prefix the kubeadm release notes like so - e.g. kubeadm: note goes here....
.
thanks
/lgtm
/assign @timothysc
/assign @liztio
(as per upgrade diff
).
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bart0sh, timothysc The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Order of Volumes and VolumeMounts in the pod objects created by
kubeadm is undefined as they're represended as maps in the
controlPlaneHostPathMounts struct.
This influences 'kubeadm upgrade' logic in a way that even when
manifest of the component is not changed kubeadm tries to upgrade
it because most of the time current and new pods are not equal
due to the different order of Volumes and VolumeMounts.
For example 'kubeadm apply diff' almost always shows difference
in Volumes and VolumeMounts because of this:
Sorting Volumes and VolumeMounts should fix this issue and help
to avoid unnecessary upgrades.
Which issue(s) this PR fixes:
Fixes kubernetes/kubeadm#1054
Does this PR introduce a user-facing change?: