Skip to content

Conversation

@manusa
Copy link
Member

@manusa manusa commented Oct 23, 2025

Follows up on #384

  • Changed node_log tool name to nodes_log for consistency
  • Added access control check for nodes and configured denied resources
  • Migrated tests to testify
  • Added complete test coverage for nodes_log

/cc @blublinsky

It also seems that the tailLines param is not placed in the expected location. Will look into it as a subsequent fix: (might be an issue with the cluster itself)
https://kubernetes.io/docs/concepts/cluster-administration/system-logs/#log-query

- Changed node_log tool name to nodes_log for consistency
- Added access control check for nodes and configured denied resources
- Migrated tests to testify
- Added complete test coverage for nodes_log

https://kubernetes.io/docs/concepts/cluster-administration/system-logs/#log-query

Signed-off-by: Marc Nuri <[email protected]>
@manusa manusa requested review from Cali0707 and matzew October 23, 2025 10:35
@manusa manusa added this to the 0.1.0 milestone Oct 23, 2025
@blublinsky
Copy link
Contributor

Thanks @manusa, One other thing that I have noticed is that there is no default value for the tailLines. Should we use something like 500?

@manusa
Copy link
Member Author

manusa commented Oct 23, 2025

Thanks @manusa, One other thing that I have noticed is that there is no default value for the tailLines. Should we use something like 500?

At the moment there's a default value of 100 (you set this in the initial impl):

Default: api.ToRawMessage(100),

Clients should preset this value.

However, the value is not enforced. Maybe the minimum is not checked either (I need to verify this).

@manusa
Copy link
Member Author

manusa commented Oct 23, 2025

I added an additional test to verify the current behavior with negative (unsupported) tail arguments.

In this case, we're not validating and simply defaulting to show the entire log.
I'm not sure if this behavior will change with #385, but at least we'll be aware of any changes in the behavior.

Copy link
Collaborator

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

Overall LGTM - left one comment I wasn't sure about @manusa

Feel free to merge if you want

Comment on lines 63 to +68
switch v := tail.(type) {
case float64:
tailInt = int64(v)
case int: case int64:
tailInt = int64(v)
case int:
case int64:
tailInt = v
Copy link
Collaborator

Choose a reason for hiding this comment

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

@manusa I feel like I've seen this code/similar code in other places in the codebase - is it worth extracting to a util?

Or with the sdk migration I guess if we define the paramaters to a tool using a struct with json tags, this would be handled by the sdk

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's in the same function for pod logs (although it's not exactly the same),

With our approach towards the go-sdk and decoupled toolsets, it might not be the case that the SDK takes care of this, but I need to evaluate first.

If it's not the case, and we do want to support reading number values with diverse input format or types, we definitely need to extract this to some util.
Similarly to extract strings, etc.

@manusa
Copy link
Member Author

manusa commented Oct 23, 2025

Overall LGTM - left one comment I wasn't sure about @manusa

Feel free to merge if you want

Merging, I'll take care of argument parsing in the scope of #385

@manusa manusa merged commit 56f7ede into containers:main Oct 23, 2025
6 checks passed
@manusa manusa deleted the review/nodes branch October 23, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants