-
Notifications
You must be signed in to change notification settings - Fork 35
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
Aggregate ServiceExport conflict conditions #1624
Conversation
🤖 Created branch: z_pr1624/tpantelis/conflict_condition |
3e4e92b
to
852a01e
Compare
Changed UpdateStatusConditions and RemoveStatusCondition public to facilitate. Signed-off-by: Tom Pantelis <[email protected]>
It's possible there could be more than one concurrent conflict however the MCS API only defines one conflict type so a second conflict would overwrite the first. We could define our own conflict types but the MCS spec does specifically reference the ServiceExportConflict type, defined as "Conflict", in the conflict resolution section. It doesn't mention what the behavior should be if there's more than one conflict. To represent multiple conflicts, We can still use the ServiceExportConflict type but aggregate the differing condition reasons and messages. For the Reason field, join multiple reasons separated by a comma and, for the Message field, join with a new line. When a particular conflict is resolved, remove it's reason and message. When there's no more conflicts, ie Reason is empty, set the condition Status to False. Signed-off-by: Tom Pantelis <[email protected]>
This was used to remove the Conflict condition when the conflict was resolved but we now update the the condition as there can be multiple conflicts. In general, the pattern is to update the condition status rather than removing a condition. Signed-off-by: Tom Pantelis <[email protected]>
852a01e
to
b6f1b06
Compare
index := goslices.Index(reasons, *from.Reason) | ||
if index >= 0 { | ||
if from.Status == corev1.ConditionTrue { | ||
if index < len(messages) { |
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.
When will this be true? Message is already present but not at end? Means this code is updating the message for this reason in case it changed?
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.
index
should always be < len(messages)
b/c it's size mirrors reason
. This is just a sanity check.
If you're referring to if from.Status == corev1.ConditionTrue
, yes, if the reason
already exists but the message
changed.
🤖 Closed branches: [z_pr1624/tpantelis/conflict_condition] |
It's possible there could be more than one concurrent conflict however the MCS API only defines one conflict type so a second conflict would overwrite the first. We could define our own conflict types but the MCS spec does specifically reference the
ServiceExportConflict
type, defined as "Conflict", in the conflict resolution section. It doesn't mention what the behavior should be if there's more than one conflict.To represent multiple conflicts, we can still use the
ServiceExportConflict
type but aggregate the differing condition reasons and messages. For theReason
field, join multiple reasons separated by a comma and, for theMessage
field, join with a new line. When a particular conflict is resolved, remove its reason and message. When there's no more conflicts, ieReason
is empty, set the conditionStatus
toFalse
.See individual commits for details.