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

tetra: transparently handle unix or tcp gRPC socket #967

Merged
merged 3 commits into from
May 4, 2023

Conversation

tixxdz
Copy link
Member

@tixxdz tixxdz commented May 3, 2023

Make tetra cli guess the best configuration to use when connecting to daemon. This saves users from explicitly specifying the server address in case it is a unix socket, as it works in localhost context anyway.

Since the client cli is run remotely, check if the server address was set

  • If yes: use it directly, users know better.

  • If no: then try the daemon tetragon-info.json file to find the best address
    if possible (could be unix socket). This also covers the case that default
    address is localhost so we are operating in localhost context anyway.
    If that address is set try it, if it fails for any reason then retry last
    time with the server address.

Signed-off-by: Djalal Harouni [email protected]

@tixxdz tixxdz requested a review from a team as a code owner May 3, 2023 12:41
@tixxdz tixxdz requested a review from mtardy May 3, 2023 12:41
@netlify
Copy link

netlify bot commented May 3, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 334c50b
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/645381c40281430008e6ce4f
😎 Deploy Preview https://deploy-preview-967--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@tixxdz tixxdz force-pushed the pr/tixxdz/client-auto-handle-unix-or-tcp-socket branch from 8163f27 to 4a58631 Compare May 3, 2023 12:44
@tixxdz tixxdz requested a review from michi-covalent May 3, 2023 12:51
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

Thanks, Djalal!! It's cool to leverage /run/tetragon/tetragon-info.json for detection. I guess it's in reaction to the recent user message on Slack regarding gRPC access. Thanks a lot for adding stuff to the documentation.

pkg/defaults/defaults.go Show resolved Hide resolved
cmd/tetra/common/client.go Show resolved Hide resolved
cmd/tetra/common/client.go Outdated Show resolved Hide resolved
cmd/tetra/common/client.go Outdated Show resolved Hide resolved
cmd/tetra/common/client.go Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
docs/content/en/docs/getting-started/configuration.md Outdated Show resolved Hide resolved
tixxdz added 2 commits May 4, 2023 11:47
Make tetra cli guess the best configuration to use when connecting to
daemon.

This saves users from explicitly specifying the server address in case
it is a unix socket.

Since the client cli is run remotely, check if the server address was set

- If yes: use it directly, users know better.

- If no: then try the daemon tetragon-info.json file to find the best address
  if possible (could be unix socket). This also covers the case that default
  address is localhost so we are operating in localhost context anyway.
  If that address is set try it, if it fails for any reason then retry last
  time with the server address.

Signed-off-by: Djalal Harouni <[email protected]>
@tixxdz tixxdz force-pushed the pr/tixxdz/client-auto-handle-unix-or-tcp-socket branch from 4a58631 to efe8114 Compare May 4, 2023 09:56
Signed-off-by: Djalal Harouni <[email protected]>
@tixxdz tixxdz force-pushed the pr/tixxdz/client-auto-handle-unix-or-tcp-socket branch from efe8114 to 334c50b Compare May 4, 2023 09:58
@tixxdz
Copy link
Member Author

tixxdz commented May 4, 2023

Thanks, Djalal!! It's cool to leverage /run/tetragon/tetragon-info.json for detection. I guess it's in reaction to the recent user message on Slack regarding gRPC access. Thanks a lot for adding stuff to the documentation.

Yes, much appreciated @mtardy @kkourt @michi-covalent for the review

@tixxdz tixxdz merged commit fff6d7c into main May 4, 2023
@tixxdz tixxdz deleted the pr/tixxdz/client-auto-handle-unix-or-tcp-socket branch May 4, 2023 11:48
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.

4 participants