Skip to content

tetra: transparently handle unix or tcp gRPC socket#967

Merged
tixxdz merged 3 commits into
mainfrom
pr/tixxdz/client-auto-handle-unix-or-tcp-socket
May 4, 2023
Merged

tetra: transparently handle unix or tcp gRPC socket#967
tixxdz merged 3 commits into
mainfrom
pr/tixxdz/client-auto-handle-unix-or-tcp-socket

Conversation

@tixxdz

@tixxdz tixxdz commented May 3, 2023

Copy link
Copy Markdown
Member

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 tixxdz@gmail.com

@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

netlify Bot commented May 3, 2023

Copy link
Copy Markdown

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

@kkourt kkourt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! LGTM.

Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated

@mtardy mtardy left a comment

Copy link
Copy Markdown
Member

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.

Comment thread pkg/defaults/defaults.go
Comment thread cmd/tetra/common/client.go
Comment thread cmd/tetra/common/client.go Outdated
Comment thread cmd/tetra/common/client.go Outdated
Comment thread cmd/tetra/common/client.go
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
Comment thread docs/content/en/docs/getting-started/configuration.md Outdated
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 <tixxdz@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
@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 <tixxdz@gmail.com>
@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

tixxdz commented May 4, 2023

Copy link
Copy Markdown
Member Author

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

4 participants