-
Notifications
You must be signed in to change notification settings - Fork 210
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
Encryption status output enriched with IPsec details #2454
Conversation
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.
Looks good. Then we should consider using cilium-cli to perform key rotation in ci-ipsec-e2e, (and even in the ipsec doc).
encrypt/model.go
Outdated
XfrmErrorNodeCount map[string]int64 `json:"xfrm-error-node-count,omitempty"` | ||
} | ||
|
||
type encryptionStatus struct { |
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.
Rather than calculate these additional fields per node, they should be calculated once for the entire cluster, and thus shouldn't appear in this type (this new type is not needed).
encrypt/status.go
Outdated
@@ -184,6 +249,9 @@ func clusterNodeStatus(res map[string]models.EncryptionStatus) (clusterStatus, e | |||
} | |||
if v.Mode == "IPsec" { | |||
cs.EncIPsecNodeCount++ | |||
cs.IPsecExpectedKeyCount = v.IPsecExpectedKeyCount |
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.
This silently uses the value of these fields from the last encryptionStatus
.
Rather than store these fields on each encryptionStatus
, they should be calculated once for the entire cluster (as mentioned above), by using the values from the first models.EncryptionStatus
with mode "IPSec".
This eliminates some anti-patterns:
- Copying fields into each element of a collection before they are presented
- Storing overlapping data in a structure that could diverge over time
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.
Yeah, I agree it looks ugly.
But if I remove the helper model I won't be able to inject IPsec details into per-node output:
https://github.com/cilium/cilium-cli/pull/2454/files#diff-6d172ad17f4677d4b688b3202dda47a51a3a73196c7e0b4fca422f5f53faa83cR314
I can see two options:
- implement this logic in Cilium and extend
EncryptionStatus
model instead - ignore per-node details output (looks inconsistent and might be confusing for user)
WDYT?
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.
Viktor: how about making clusterStatus
as a return value of enrichWithIPsecDetails()
, where we can store expectedKeyCount
in clusterStatus
. In this way, we don't have to store expectedKeyCount
in nodes' encryptionStatus
and read from there later.
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.
@asauber @jschwinger233 I've refactored IPsec status but still have no idea how to get rid of nodeStatus
struct.
Could you please review one more time?
Thanks!
3736b65
to
8841e61
Compare
@jschwinger233 I've refactored |
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.
The revised expectedKeyCount
looks good, thank you!
encrypt/status.go
Outdated
@@ -184,6 +249,9 @@ func clusterNodeStatus(res map[string]models.EncryptionStatus) (clusterStatus, e | |||
} | |||
if v.Mode == "IPsec" { | |||
cs.EncIPsecNodeCount++ | |||
cs.IPsecExpectedKeyCount = v.IPsecExpectedKeyCount |
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.
Viktor: how about making clusterStatus
as a return value of enrichWithIPsecDetails()
, where we can store expectedKeyCount
in clusterStatus
. In this way, we don't have to store expectedKeyCount
in nodes' encryptionStatus
and read from there later.
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.
Moving the formatting closer to the I/O looks good.
LGTM
@brb kind ping ) |
Expected IPsec key count, IPsec key type and IPsec key rotation in progress status added to the encrypt output. Signed-off-by: viktor-kurchenko <[email protected]> Please enter the commit message for your changes. Lines starting
7c7dfd5
to
0a2dc09
Compare
Expected IPsec key count, IPsec key type and IPsec key rotation in progress status added to the encrypt output.