-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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: skip upgrade if manifest is not changed #69886
kubeadm: skip upgrade if manifest is not changed #69886
Conversation
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 thanks! added a couple of comments.
return false, err | ||
} | ||
|
||
return string(content1) == string(content2), nil |
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.
we should use https://golang.org/pkg/bytes/#Compare here
@@ -162,6 +163,19 @@ func (spm *KubeStaticPodPathManager) CleanupDirs() error { | |||
return nil | |||
} | |||
|
|||
func filesEqual(path1, path2 string) (bool, 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.
i couldn't find a utility for this in k8s and kubeadm.
we should probably move it here for now:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/staticpod/utils.go
and add a unit test.
possibly call it ManifestFilesAreEqual
?
return err | ||
} | ||
if equal { | ||
fmt.Printf("[upgrade/staticpods] current and new manifests of %s are equal, skipping upgrade", component) |
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 think it needs a \n
at the end.
i think it would be best to add a release note explaining the change. |
/kind bug |
3d30e73
to
9601f6e
Compare
@neolit123 thank you for the review. PR has been updated, please review again. |
9601f6e
to
af11ebb
Compare
af11ebb
to
b9ade1d
Compare
b9ade1d
to
0555f30
Compare
0555f30
to
8af5738
Compare
tests are failing with this error: I can't reproduce this locally. BUILD file is updated, so dependencies should be correct. 'make bazel-build' and 'make bazel-release' work just fine in my setup. Can anybody help? |
/test pull-kubernetes-e2e-gce-100-performance |
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 one nit. otherwise LGTM
@@ -288,3 +289,17 @@ func GetProbeAddress(cfg *kubeadmapi.InitConfiguration, componentName string) st | |||
} | |||
return "127.0.0.1" | |||
} | |||
|
|||
// ManifestFilesAreEqual compares 2 files. Returns true if their contents are equal, false otherwise |
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.
s/Returns/Return ?
8af5738
to
6c1c42c
Compare
When doing upgrades kubeadm generates new manifest and waits until kubelet restarts correspondent pod. However, kubelet won't restart pod if there are no changes in the manifest. That makes kubeadm stuck waiting for restarted pod. Skipping upgrade if new component manifest is the same as current manifest should solve this. Fixes: kubernetes/kubeadm#1054
6c1c42c
to
ad01798
Compare
@xiangpengzhao Thanks for the review. done. |
/retest |
/lgtm |
/assign @timothysc |
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.
/approve
thx @bart0sh !
[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 this PR does / why we need it:
When doing upgrades kubeadm generates new manifests and
waites for kubelet to restarts correspondent pods.
However, kubelet won't restart pods if there are no changes
in the manifests. That makes kubeadm stuck waiting for
restarted pod.
Skipping upgrades if new component manifest is the same as
current manifest should solve this.
Which issue(s) this PR fixes
Fixes: kubernetes/kubeadm#1054
Release note: