Skip to content

Commit

Permalink
Merge pull request #4091 from zendesk/grosser/karamada
Browse files Browse the repository at this point in the history
karmada: ignore sync errors since they are temporary
  • Loading branch information
grosser committed Feb 13, 2024
2 parents 52b8580 + 755a7b5 commit caf3c54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/kubernetes/app/models/kubernetes/resource_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class ResourceStatus
],
Service: [
"FailedToUpdateEndpointSlices"
],
# karmada can fail to sync a resource when something else also updated the resource,
# this does not necessarily indicate that sync will be broken forever
All: [
'ApplyPolicyFailed'
]
}.freeze

Expand Down Expand Up @@ -117,8 +122,9 @@ def bad_events(kind)
failures = events(type: "Warning")
ignored =
@resource.dig(:metadata, :annotations, :"samson/ignore_events").to_s.split(",") +
(IGNORED_EVENT_REASONS[kind.to_sym] || [])
failures.reject! { |e| ignored.include? e[:reason] } if ignored.any?
(IGNORED_EVENT_REASONS[kind.to_sym] || []) +
IGNORED_EVENT_REASONS[:All]
failures.reject! { |e| ignored.include? e[:reason] }
failures
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ def expect_event_request(&block)
}
expect_event_request { details.must_equal "Error event" }
end

it "ignores karmada sync" do
events[0][:reason] = "ApplyPolicyFailed"
expect_event_request { details.must_equal "Live" }
end
end
end
end
Expand Down

0 comments on commit caf3c54

Please sign in to comment.