Skip to content

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

Merged
aanm merged 1 commit intomasterfrom
pr/fix-cnp-update
Jun 18, 2020
Merged

pkg/k8s: ignore status field in CNP DeepEqual#12171
aanm merged 1 commit intomasterfrom
pr/fix-cnp-update

Conversation

@aanm
Copy link
Copy Markdown
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 area/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
@aanm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
@aanm aanm deleted the pr/fix-cnp-update branch June 18, 2020 11:43
@aanm aanm mentioned this pull request Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants