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 1779490: Handle missing pids during sidecar teardown #148
Bug 1779490: Handle missing pids during sidecar teardown #148
Conversation
@ironcladlou: This pull request references Bugzilla bug 1779491, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@ironcladlou: This pull request references Bugzilla bug 1779490, which is valid. The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Need to add diffing logic to the operator to detect/apply container command changes |
b9bb6b7
to
008bca9
Compare
@@ -194,6 +194,14 @@ func daemonsetConfigChanged(current, expected *appsv1.DaemonSet) (bool, *appsv1. | |||
changed = true | |||
} | |||
|
|||
for i, a := range current.Spec.Template.Spec.Containers { | |||
b := expected.Spec.Template.Spec.Containers[i] |
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.
It would be prudent to verify that len(current.Spec.Template.Spec.Containers)
equals len(expected.Spec.Template.Spec.Containers)
.
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.
Good catch — I updated the logic and expanded the test cases
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.
The additional test case checks for a change in the number of words in the command, not a change in the number of containers. Did you mean to test the latter?
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.
The new command diffing and the existing image diffing are against the contents of container arrays which are assumed to be the same structurally.
Seems like we would want a separate check entirely to detect changes to length of containers and if so just take the expected containers and don't bother diffing the contents of the container arrays — agree?
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 suggested comparing lengths of the container arrays because you were using the iterator of one container array to index the other container array. Detecting changes to the length of the containers arrays would be orthogonal but for that—we don't want the operator to panic if a naughty administrator or a future version of the operator changes the number of containers.
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 agree that we can just copy the containers array wholesale if any change is detected.
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 suggested comparing lengths of the container arrays because you were using the iterator of one container array to index the other container array. Detecting changes to the length of the containers arrays would be orthogonal but for that—we don't want the operator to panic if a naughty administrator or a future version of the operator changes the number of containers.
That was my understanding as well, and I implemented that guard. Then you said
The additional test case checks for a change in the number of words in the command, not a change in the number of containers. Did you mean to test the latter?
Which led to the discussion about the containers array itself (not the command array), which you now seem to say is orthogonal (which I would agree with).
I think the current patch is correct — agree?
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.
Which led to the discussion about the containers array itself (not the command array), which you now seem to say is orthogonal (which I would agree with).
I think the current patch is correct — agree?
It is correct. I asked about the intention of the additional test case because it seemed unnecessary to test both that daemonsetConfigChanged
detects a change to the command and a that daemonsetConfigChanged
detects a change to the length of the command when we're just using cmp.Equal
to compare the command arrays, and since you were adding logic to detect changes to the length of the containers array, I thought maybe your intention was to add a test case for that. If not, never mind. We've probably spent more time discussing this matter than it deserves—sorry for the distraction!
Make the sidecar container script tolerate missing pids during cleanup to prevent spurious errors on shutdown.
008bca9
to
52362da
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ironcladlou, Miciah 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 |
/cherrypick release-4.3 |
@ironcladlou: failed to push cherry-picked changes in GitHub: pushing failed, output: "remote: Not Found\nfatal: repository 'https://openshift-cherrypick-robot:CENSORED@github.com/openshift-cherrypick-robot/openshift/cluster-dns-operator/' not found\n", error: exit status 128 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -194,6 +194,21 @@ func daemonsetConfigChanged(current, expected *appsv1.DaemonSet) (bool, *appsv1. | |||
changed = true | |||
} | |||
|
|||
// Detect changes to container commands |
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.
The fact you are having to write this code is terrifying. Is there a library-go function you should be using instead?
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.
Looks like library-go's resourceapply package might work. However, the prospect of using library-go presents at least two salient challenges for us: (1) library-go is poorly documented and (2) library-go uses client-go whereas the DNS operator uses the controller-runtime client library. Given these considerations, I don't see why using library-go would be less terrifying.
/cherrypick release-4.3 |
@ironcladlou: new pull request created: #149 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Make the sidecar container script tolerate missing pids during cleanup
to prevent spurious errors on shutdown.