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

kuma-dp: improve envoy binary lookup #268

Merged
merged 1 commit into from
Sep 17, 2019
Merged

kuma-dp: improve envoy binary lookup #268

merged 1 commit into from
Sep 17, 2019

Conversation

gszr
Copy link
Contributor

@gszr gszr commented Sep 17, 2019

Summary

  • Search in configured path
  • Fallback to same directory as kuma-dp and current working directory

Fixes #249

Copy link

@dhruv dhruv left a comment

Choose a reason for hiding this comment

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

Do you think it's beneficial to also look in pwd? I feel unsure so ok with whatever you decide. We can also always add that later.

@gszr gszr force-pushed the fix/envoy-path branch 2 times, most recently from f530a84 to 223377f Compare September 17, 2019 22:11
- Search in configured path
- Fallback to same directory as kuma-dp
@gszr gszr merged commit ccd31fc into master Sep 17, 2019
@gszr gszr deleted the fix/envoy-path branch September 17, 2019 22:48
Copy link
Contributor

@yskopets yskopets left a comment

Choose a reason for hiding this comment

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

Can we have a unit test for this feature ? Both positive and negative cases

@@ -38,6 +41,49 @@ type Envoy struct {
opts Opts
}

func getSelfPath() (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

getSelfDir() seems to be a more accurate name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The string returned by this function is the actual full path of the binary, so it's more accurate to call it "path".

}
}

return "", errors.New("could not find binary")
Copy link
Contributor

Choose a reason for hiding this comment

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

can we change the message to .Errorf("could not find Envoy binary at any of the following locations: %v", candidatePaths) ?

resolvedPath, err := lookupEnvoyPath(binaryPathConfig)
if err != nil {
runLog.Error(err, "Envoy binary not found; make sure it is in PATH or in the same directory as "+os.Args[0])
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment, if envoy binary is not found, konvoy-dp exists with status code 0 and prints nothing on the console.

You should return the error instead of logging it.

@@ -51,6 +97,13 @@ func (e *Envoy) Run(stop <-chan struct{}) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

binaryPathConfig := e.opts.Config.DataplaneRuntime.BinaryPath
resolvedPath, err := lookupEnvoyPath(binaryPathConfig)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a unit test for this ?

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.

Fallback when invoking envoy from kuma-dp.
3 participants