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
staticpod: improve operator messages #913
Conversation
mfojtik
commented
Oct 7, 2020
- Do proper pluralization in messages
- Show total node count (so we can determine if all expected control plane nodes are there)
- Unify on terminology ("achieve" vs. "is on")
- Add messages to unit test to make sure we have them correct
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mfojtik The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
count := counts[currentRevision] | ||
revisionStrings = append(revisionStrings, fmt.Sprintf("%d nodes are at revision %d", count, currentRevision)) | ||
if count := counts[currentRevision]; count == 1 { | ||
revisionStrings = append(revisionStrings, fmt.Sprintf("1 node achieved revision %d", currentRevision)) |
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.
is "achieved" the right word?
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.
we should pick one and be consistent "are at" vs. "achieved" I don't care much which one, I liked "achieved" better.
} | ||
// if we are progressing and no nodes have achieved that level, we should indicate | ||
if numProgressing > 0 && counts[newStatus.LatestAvailableRevision] == 0 { | ||
revisionStrings = append(revisionStrings, fmt.Sprintf("%d nodes have achieved new revision %d", 0, newStatus.LatestAvailableRevision)) | ||
revisionStrings = append(revisionStrings, fmt.Sprintf("none of the nodes have achieved new revision %d", newStatus.LatestAvailableRevision)) |
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.
all these strings are a lot of text. Shouldn't we rather try to be more brief?
some nodes are on old revisions (34, 35), 1 is on latest.
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 think it will read better than 3 semicolons
} | ||
revisionDescription := strings.Join(revisionStrings, "; ") | ||
|
||
if numAvailable > 0 { | ||
message := fmt.Sprintf("%d nodes are active; %s", numAvailable, revisionDescription) |
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.
what does active mean?
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.
good question, I think "active" means "available" which means "they achieved the desired levels and are running" ?
257962a
to
e60740e
Compare
latestCount++ | ||
} | ||
if c != 0 { | ||
availableCount++ |
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.
why does this mean anything about availability?
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.
in the existing code "numAvailable" is determined by CurrentRevision!=0 ... So i guess CurrentRevision==0 means the node is not available or not actively making progress? i'm a bit confused here as well.
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 has nothing to do with availability. It only says that this revision was the last that got ready eventually.
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.
lastReadyRevision
?
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.
call it nonZeroCount
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.
lastReadyRevision
It's a count.
|
||
if !currentRevisions.Has(r.latestRevision) { | ||
if r.progressing { | ||
return fmt.Sprintf("%snodes progressing towards revision %d", notAvailable, r.latestRevision) |
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.
am confused about notAvailable
(e.g. none of the nodes are available
) to be plugged into the first %s
.
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.
i tried to incorporate that into message, so we don't lose it but also get rid of the ;
.... I think it will read as "none of the nodes are available and nodes progressing towards revision N"
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.
!currentRevisions.Has(r.latestRevision)
does not match message. Better check that there is at least one node that is not at latestRevision
.
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.
oh. you mean "all nodes progressing ..."
@@ -422,15 +422,77 @@ func setNodeStatusFn(status *operatorv1.NodeStatus) v1helpers.UpdateStaticPodSta | |||
} | |||
} | |||
|
|||
type revisionDescriptionPrinter 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.
doc
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.
Why is this an object in the first place and not just a simple func?
} | ||
} | ||
|
||
notAvailable := fmt.Sprintf("%d %s are not available and ", availableCount, pluralizedNode(availableCount)) |
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.
cannot follow. This must be len(nodes)-availableCount
, no?
And better turn the wording into: %d %s have never been available and
notAvailable = "" | ||
} | ||
if availableCount == 0 { | ||
return "none of the nodes are available" |
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.
none of the nodes was ever available.
} | ||
if currentRevisions.Has(r.latestRevision) { | ||
oldRevisionStringList := []string{} | ||
for _, i := range currentRevisions.Difference(sets.NewInt32(r.latestRevision)).List() { |
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.
loop over currentRevisions and exclude latestRevision
. No need for set arithmetic.
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
@mfojtik: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@openshift-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |