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

fix(kuma-dp): reduce size of access log address #894

Merged

Conversation

xbauquet
Copy link
Contributor

When the name of the dataplane is too long an error stop the side-car
from starting. This update reduces the size of the address and log an
explicit error if the address is still too long.

  • reduce the size of access log address replacing 'kuma-access-logs' by
    'kal'
  • add explicit error log if the size of the address is still too long

Fix #853

@xbauquet xbauquet requested a review from a team July 10, 2020 08:05
When the name of the dataplane is too long an error stop the side-car
from starting. This update reduces the size of the address and log an
explicit error if the address is still too long.

* reduce the size of access log address replacing 'kuma-access-logs' by
'kal'
* add explicit error log if the size of the address is still too long

Fix kumahq#853
@xbauquet xbauquet force-pushed the fix/kumadp-access-log-address branch from 92e3145 to 7cf3fc3 Compare July 10, 2020 08:33
Copy link
Contributor

@nickolaev nickolaev left a comment

Choose a reason for hiding this comment

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

Looks good. Only a small nit from me.


// Log an explicit error when access log address is too long
// see: https://man7.org/linux/man-pages/man7/unix.7.html
// see: issue #853
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the reference to the issue here. The best way to track this will be through following the git history of this particular piece of code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

@lobkovilya
Copy link
Contributor

Great! @xbauquet could you please run make check and commit the result? We have to run it before every push, so maybe it will be easier to have it as a git hook. make check runs goimports, go mod tidy and etc, otherwise check job is failed on CI

go.mod Outdated
@@ -22,7 +22,7 @@ require (
github.com/go-logr/zapr v0.1.0
github.com/gogo/protobuf v1.3.1
github.com/golang-migrate/migrate/v4 v4.8.0
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.1
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason of this change in this PR? AFAIR we had some problems with 1.3.x -> 1.4.x upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No good reasons, this came with the make check requested by @lobkovilya.
I'm having troubles running make check anyway. It always finishes with make: *** [vet] Error but I don't have any error logs on my terminal.
I'm a bit lost on it as I don't know much about go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like it was a problem with the versions of the tools installed on my computer.
Using make dev/tools/all and redoing the make check fixed the problem.

Please reduce the size of your dataplane name.`,
dataplane.Name,
address))
}
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 do something more automatic here?
We are not so attached to this name, to be honest. We can just as well either:

  1. trim the name to 108 chars
  2. use UUID

As long as we log this path to the file, it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about using a UUID but I thought it would complicate debug.
In which file do you want to log the path ? In the normal logs (using logger.Info(...) ) ?

@xbauquet xbauquet force-pushed the fix/kumadp-access-log-address branch from eb1630d to 09a47a1 Compare July 15, 2020 07:42
@xbauquet xbauquet requested a review from a team as a code owner July 15, 2020 07:42
var address = fmt.Sprintf("/tmp/%s.sock", id)
logger.Info("Access log for pod",
"pod", fmt.Sprintf("/tmp/kal-%s-%s.sock", dataplane.Name, dataplane.Mesh),
"address", fmt.Sprintf("unix://%s", address))
Copy link
Contributor

Choose a reason for hiding this comment

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

Log is not needed here after all. We log the address on server start

@@ -33,10 +34,15 @@ func (s *accessLogServer) NeedLeaderElection() bool {
}

func NewAccessLogServer(dataplane kumadp.Dataplane) *accessLogServer {
id := guuid.New()
Copy link
Contributor

Choose a reason for hiding this comment

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

please use core.NewUUID() (from /pkg/core/alias.go)

@xbauquet xbauquet force-pushed the fix/kumadp-access-log-address branch 2 times, most recently from 56dd0da to db0f859 Compare July 15, 2020 08:15
@xbauquet xbauquet force-pushed the fix/kumadp-access-log-address branch from db0f859 to 438ed97 Compare July 15, 2020 08:19
@jakubdyszkiewicz jakubdyszkiewicz merged commit 2bec835 into kumahq:master Jul 15, 2020
nickolaev pushed a commit that referenced this pull request Jul 15, 2020
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
nickolaev pushed a commit that referenced this pull request Jul 15, 2020
Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
nickolaev pushed a commit that referenced this pull request Jan 7, 2021
This reverts commit 2bec835.

# Conflicts:
#	app/kuma-dp/pkg/dataplane/accesslogs/server.go

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
nickolaev pushed a commit that referenced this pull request Jan 7, 2021
* Revert "fix(kuma-dp): reduce size of access log address (#894)"

This reverts commit 2bec835.

* chore(*) shorten the unix socket name

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
mergify bot pushed a commit that referenced this pull request Jan 7, 2021
* Revert "fix(kuma-dp): reduce size of access log address (#894)"

This reverts commit 2bec835.

* chore(*) shorten the unix socket name

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
(cherry picked from commit 950448d)
nickolaev pushed a commit that referenced this pull request Jan 7, 2021
* Revert "fix(kuma-dp): reduce size of access log address (#894)"

This reverts commit 2bec835.

* chore(*) shorten the unix socket name

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
(cherry picked from commit 950448d)

Co-authored-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
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.

Kuma-sidecar not starting when using Telepresence
4 participants