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 for DaemonSet and Deployment have different behavior with RollingUpdate #43218
Comments
@kubernetes/sig-apps-bugs |
Hmm, it shouldn't happen. TemplateGeneration is updated only when something changed. I will debug it. |
I can reproduce this, and the DaemonSet In We used |
It's very strange. I tried to use pretty.Diff to print the differences but it returns empty slice. |
The key of the reported DaemonSet config is its affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "service"
operator: "In"
values: ["bind"]
topologyKey: "kubernetes.io/hostname"
namespaces: [] # <---- Note that in the config file, If we use From the // namespaces specifies which namespaces the labelSelector applies to (matches against);
// nil list means "this pod's namespace," empty list means "all namespaces"
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
Namespaces []string `json:"namespaces" protobuf:"bytes,2,rep,name=namespaces"` Feel it's api machinery related @kubernetes/sig-api-machinery-misc |
protobuf storage isn't able to store see #43203 (comment) |
cc @kubernetes/sig-scheduling-bugs for behavior of namespaces field |
@lukaszo so it's not a DaemonSet bug |
Well, still not sure whether Semantic.DeepEqual should be used or not. I'm still concerned with the behavior of the controller for other fields that can be populated with non-null empty lists by users, but serialize back out to null (or set omitempty) |
deployments are using |
If empty lists should be treated differently from null list, we should replace |
that distinction is going away in all the fields I know of... I'm not super happy with Semantic.DeepEqual masking the difference between those two things, but that's probably the right thing for you to be using |
Special meaning of [] was removed in #43271 I think a switch to Semantic.DeepEqual is still needed here |
Filed #43337 |
Automatic merge from submit-queue Use Semantic.DeepEqual to compare DaemonSet template on updates Switch to `Semantic.DeepEqual` when comparing templates on DaemonSet updates, since we can't distinguish between `null` and `[]` in protobuf. This avoids unnecessary DaemonSet pods restarts. I didn't touch `reflect.DeepEqual` used in controller because it's close to release date, and the DeepEqual in the controller doesn't cause serious issues (except for maybe causing more enqueues than needed). Fixes #43218 @liggitt @Kargakis @lukaszo @kubernetes/sig-apps-pr-reviews
Kubernetes version (use
kubectl version
):Environment:
uname -a
):What happened:
when I do:
it will run rolling update ONLY if there is a change. In case I do:
Each time I run it - it will execute rolling update, which is misleading.
What you expected to happen:
I would like to have consistent behavior for Deployment and DaemonSet
How to reproduce it (as minimally and precisely as possible):
Create any DaemonSet with following:
The text was updated successfully, but these errors were encountered: