Skip to content
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

pkg/k8s: ignore status field in CNP DeepEqual #12171

Merged
merged 1 commit into from Jun 18, 2020
Merged

Conversation

aanm
Copy link
Member

@aanm aanm commented Jun 18, 2020

The status field should be ignored when comparing 2 CNPs as this field
does not matter to the policy enforcement of the CNP.

This fixes a bug introduced by 134fdb5 which make Cilium to process
all CNP events from k8s including the ones where a status was the only
field modified. This made a cluster with 2 or more nodes to concurrently
trying the update its own status in the CNP causing the other node to
receive and process the CNP event.

Fixes: 134fdb5 ("k8s/watchers: fix missing missing CNP/CCNP updates")
Signed-off-by: André Martins andre@cilium.io

The status field should be ignored when comparing 2 CNPs as this field
does not matter to the policy enforcement of the CNP.

This fixes a bug introduced by 134fdb5 which make Cilium to process
all CNP events from k8s including the ones where a status was the only
field modified. This made a cluster with 2 or more nodes to concurrently
trying the update its own status in the CNP causing the other node to
receive and process the CNP event.

Fixes: 134fdb5 ("k8s/watchers: fix missing missing CNP/CCNP updates")
Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm added priority/release-blocker sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers. kind/regression This functionality worked fine before, but was broken in a newer release of Cilium. release-note/misc This PR makes changes that have no direct user impact. labels Jun 18, 2020
@aanm aanm requested a review from a team as a code owner June 18, 2020 08:10
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Jun 18, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.8.0 Jun 18, 2020
@aanm
Copy link
Member Author

aanm commented Jun 18, 2020

test-me-please

Comment on lines +78 to +79
// DeepEqual compares 2 CNPs while ignoring the LastAppliedConfigAnnotation and
// ignoring the Status field of the CNP.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
// DeepEqual compares 2 CNPs while ignoring the LastAppliedConfigAnnotation and
// ignoring the Status field of the CNP.
// DeepEqual compares 2 CNPs while ignoring the LastAppliedConfigAnnotation and
// Status fields of the CNP.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 37.099% when pulling 15a24a0 on pr/fix-cnp-update into 0ee0458 on master.

@aanm aanm merged commit 82e36cd into master Jun 18, 2020
1.8.0 automation moved this from In progress to Merged Jun 18, 2020
@aanm aanm deleted the pr/fix-cnp-update branch June 18, 2020 11:43
@aanm aanm mentioned this pull request Jun 18, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.0 Jun 18, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.0 Jun 18, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.0 Jun 18, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.0 Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/regression This functionality worked fine before, but was broken in a newer release of Cilium. release-note/misc This PR makes changes that have no direct user impact. sig/k8s Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
Projects
No open projects
1.8.0
  
Merged
1.8.0
Backport done to v1.8
Development

Successfully merging this pull request may close these issues.

None yet

5 participants