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

Fixing endpoint status #339

Merged
merged 3 commits into from Mar 20, 2017
Merged

Fixing endpoint status #339

merged 3 commits into from Mar 20, 2017

Conversation

aanm
Copy link
Member

@aanm aanm commented Mar 18, 2017

@tgraf I can squash the last 2 commits if you want.

Fixes #207
Fixes #316

  •  File: pkg/endpoint/endpoint.go:L229-236
  • What kind of Validation you were talking about?
  • The case where the value of state is not one of the model enum.
  •  File: pkg/endpoint/endpoint.go:L255-279
  • Can you explain this priority system a bit. I assume the point is to not undo failure state unless we know that the actual failure is gone. How does this priority actual fix it?
    Don't we need a bitmask which indicates the status of each failure mode and if any of them is set to failure the entire endpoint is marked as failed?
  •  File: pkg/endpoint/endpoint.go:L249-305
  • @tgraf Tell me if by only reading this explanation it makes sense to you or if you had any doubts.
  • I'm not sure I fully understand the concept yet. The fundamental problem is that you have multiple causes for an endpoint to be considered in an failed state:
  • bpf generation or compilation
  • policy calculation
  • ....
    Each of these causes can be OK/warning/failure. You want to report an overall status. You also want to store a log of status changes for each. The priority seems to indicate that a BPF failure always overwrites a policy failure but that seems incomplete.
    Let's assume:
  1. bpf fails
  2. policy fails
  3. bpf succeeds
    You still want the overall state to say failure.
    I think instead of priority, what you want is this:
    map[StatusComponent]statusLogMsg
    BPF and priority are both StatusComponent
    OverallStatus is Failure if any of the components failed, else warning if any component is warning, else OK.
    The log shows the latest n status changes of the endpoint.
  •  General Comment
  • TODO: Implement map for CurrentStatus to keep low priority non-OK messages.
  •  File: pkg/endpoint/endpoint.go:L236-305
  • Looks great. What does priority mean in this context? I would rename this to componentStatus
  • Should I renamed the StatusPriority to StatusComponent?
  • It needs to have a sense of a priority in the name. Suggestions?
  • I think you want a struct ComponentStatus which is a member Latest in EndpointStatus. I know what you mean by priority but it's misleading. I think you really mean the latest status.
  • Or ComponentStatuses which is a slice of ComponentStatus
  • And the StatusPriority should I keep it as is?
  • How about EndpointComponentName?
  • Change it to StatusType, I think it makes sense.
  •  File: pkg/endpoint/endpoint.go:L236-305
  • Minor as it is private but I would rename this as well to statusTypeSlice

  

@aanm aanm added the kind/bug This is a bug in the Cilium logic. label Mar 18, 2017
@aanm aanm requested a review from tgraf March 18, 2017 02:38
@@ -224,7 +229,7 @@ func (e *Endpoint) GetModel() *models.Endpoint {
InterfaceName: e.IfName,
Mac: e.LXCMAC.String(),
HostMac: e.NodeMAC.String(),
State: models.EndpointState(e.State), // TODO: Validate
State: currentState, // TODO: Validate
Copy link
Member Author

Choose a reason for hiding this comment

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

What kind of Validation you were talking about?

Copy link
Member

Choose a reason for hiding this comment

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

The case where the value of state is not one of the model enum.

Copy link
Member

@tgraf tgraf left a comment

Choose a reason for hiding this comment

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

Separation into commits as-is OK, see question on priority.

return idx
}

func (e *EndpointStatus) addStatusLog(s *statusLog) {
func (e *EndpointStatus) addStatusLog(s *statusLogMsg) {
if e.CurrentStatus.Status.Code == OK {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain this priority system a bit. I assume the point is to not undo failure state unless we know that the actual failure is gone. How does this priority actual fix it?

Don't we need a bitmask which indicates the status of each failure mode and if any of them is set to failure the entire endpoint is marked as failed?

@aanm aanm force-pushed the fixing-endpoint-status branch 2 times, most recently from 21bd7f8 to 6286b30 Compare March 18, 2017 04:14
return idx
}

func (e *EndpointStatus) addStatusLog(s *statusLog) {
// addStatusLog adds statusLogMsg to endpoint log.
Copy link
Member Author

Choose a reason for hiding this comment

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

@tgraf Tell me if by only reading this explanation it makes sense to you or if you had any doubts.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I fully understand the concept yet. The fundamental problem is that you have multiple causes for an endpoint to be considered in an failed state:

  • bpf generation or compilation
  • policy calculation
  • ....

Each of these causes can be OK/warning/failure. You want to report an overall status. You also want to store a log of status changes for each. The priority seems to indicate that a BPF failure always overwrites a policy failure but that seems incomplete.

Let's assume:

  1. bpf fails
  2. policy fails
  3. bpf succeeds

You still want the overall state to say failure.

I think instead of priority, what you want is this:
map[StatusComponent]statusLogMsg

BPF and priority are both StatusComponent

OverallStatus is Failure if any of the components failed, else warning if any component is warning, else OK.

The log shows the latest n status changes of the endpoint.

@aanm aanm added the wip label Mar 18, 2017
@aanm
Copy link
Member Author

aanm commented Mar 18, 2017

TODO: Implement map for CurrentStatus to keep low priority non-OK messages.

@tgraf tgraf added this to the 0.8 release milestone Mar 18, 2017
@aanm aanm requested a review from tgraf March 18, 2017 21:01
@aanm aanm added pending-review and removed wip labels Mar 18, 2017
type statusLog []*statusLogMsg

// priorityStatus represents a map of a single statusLogMsg by StatusPriority.
type priorityStatus map[StatusPriority]*statusLogMsg
Copy link
Member

Choose a reason for hiding this comment

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

Looks great. What does priority mean in this context? I would rename this to componentStatus

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I renamed the StatusPriority to StatusComponent?

Copy link
Member Author

Choose a reason for hiding this comment

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

It needs to have a sense of a priority in the name. Suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

I think you want a struct ComponentStatus which is a member Latest in EndpointStatus. I know what you mean by priority but it's misleading. I think you really mean the latest status.

Copy link
Member

Choose a reason for hiding this comment

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

Or ComponentStatuses which is a slice of ComponentStatus

Copy link
Member Author

Choose a reason for hiding this comment

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

And the StatusPriority should I keep it as is?

Copy link
Member

@tgraf tgraf Mar 18, 2017

Choose a reason for hiding this comment

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

How about EndpointComponentType?

Copy link
Member Author

@aanm aanm Mar 19, 2017

Choose a reason for hiding this comment

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

I change it to StatusType, I think it makes sense.

@aanm aanm requested a review from tgraf March 19, 2017 23:07
e.indexMU.RLock()
defer e.indexMU.RUnlock()
// sPriority represents a slice of StatusType, is used for sorting purposes.
type sPriority []StatusType
Copy link
Member

Choose a reason for hiding this comment

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

Minor as it is private but I would rename this as well to statusTypeSlice

Copy link
Member

@tgraf tgraf left a comment

Choose a reason for hiding this comment

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

Despite the minor comment, this looks fine now.

Signed-off-by: André Martins <andre@cilium.io>
Signed-off-by: André Martins <andre@cilium.io>
Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm merged commit 8361b36 into master Mar 20, 2017
@aanm aanm deleted the fixing-endpoint-status branch March 20, 2017 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is a bug in the Cilium logic.
Projects
None yet
2 participants