cli: fix node list to show only cluster nodes - #127
Conversation
node list was using a container name prefix filter (name=k8s-) which matched all bink containers including infrastructure ones (DNS, HAProxy). It also did not scope to the requested cluster and displayed node names with the cluster prefix baked in. Switch to label-based filtering (bink.cluster-name) scoped to the active cluster, skip containers that carry a bink.component label, and read node names from the bink.node-name label. Also display the node role when available. Fixes: bootc-dev#108 Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
fa841da to
ab714bb
Compare
| listOutput := string(listSession.Out.Contents()) | ||
| Expect(listOutput).To(ContainSubstring(node1), "node list should contain node1") | ||
| Expect(listOutput).To(ContainSubstring(node2), "node list should contain node2") | ||
| Expect(listOutput).ToNot(ContainSubstring("dns"), "node list should not show DNS container") |
There was a problem hiding this comment.
Can we move this check to the test https://github.com/bootc-dev/bink/blob/main/test/integration/cluster_test.go#L24 ?
There was a problem hiding this comment.
Also it will be better to check the full list content instead of checking the non existence of the dns
There was a problem hiding this comment.
Yes, Thanks!
ab714bb to
e889409
Compare
|
cc @alicefr |
| nodeListOutput := string(nodeListSession.Out.Contents()) | ||
| Expect(nodeListOutput).To(ContainSubstring("Found 1 cluster node(s)")) | ||
| Expect(nodeListOutput).To(ContainSubstring(customNodeName)) | ||
| Expect(nodeListOutput).To(ContainSubstring("control-plane")) | ||
|
|
There was a problem hiding this comment.
nit: What you could do instead is to trim the data and hour of creation and the parethesis, then check the exact string like: Found 1 cluster node(s):\n\n ✓ node1 role: control-plane, status: running, created:. So we know we aren't missing any further line
|
One last nit on this, but the change looks good thanks! Also you need to update the last commit message |
e889409 to
d25ed0b
Compare
Add node list verification to the single-node cluster test checking the exact output content (minus timestamps). Add node count assertions to the multinode tests to verify the full list. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
d25ed0b to
4319f91
Compare
|
@alicefr Yes, Thank you very much! |
fixes bink node list which was showing all containers (DNS, HAProxy, registries) across all clusters instead of only the actual nodes for the requested cluster.
Before (bug):
Found 6 cluster node(s):
After (fixed):
Found 1 cluster node(s):
Fixes: #108