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

use random grpc port #672

Merged
merged 5 commits into from
Jun 14, 2022
Merged

use random grpc port #672

merged 5 commits into from
Jun 14, 2022

Conversation

nthnieljson
Copy link
Contributor

KubeArmor/config/config.go : define a constant for the pid file path
KubeArmor/feeder/feeder.go : use a random grpc port number and save it to a file

previously we can't use random grpc port

now we can use random grpc port number by specifying "0" as the port number, by using port number 0, we will listen on random port and then we save the random port number to a pid file located in /opt/kubearmor

Signed-off-by: nthnieljson nthnieljson@gmail.com

Signed-off-by: nthnieljson <nthnieljson@gmail.com>
@nthnieljson
Copy link
Contributor Author

this is addressing the issue on #623 to use random grpc port number

Signed-off-by: nthnieljson <nthnieljson@gmail.com>
@daemon1024 daemon1024 linked an issue Apr 18, 2022 that may be closed by this pull request
3 tasks
Copy link
Contributor

@seswarrajan seswarrajan left a comment

Choose a reason for hiding this comment

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

LGTM. @nyrahul need to approve.

Signed-off-by: nthnieljson <nthnieljson@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #672 (38028e1) into main (925a26a) will decrease coverage by 7.46%.
The diff coverage is 9.67%.

@@            Coverage Diff             @@
##             main     #672      +/-   ##
==========================================
- Coverage   43.35%   35.89%   -7.47%     
==========================================
  Files          23       25       +2     
  Lines        8530     9033     +503     
==========================================
- Hits         3698     3242     -456     
- Misses       4378     5336     +958     
- Partials      454      455       +1     
Impacted Files Coverage Δ
KubeArmor/config/config.go 85.85% <ø> (+1.95%) ⬆️
KubeArmor/monitor/systemMonitor.go 48.06% <0.00%> (-1.28%) ⬇️
KubeArmor/feeder/feeder.go 53.10% <16.66%> (-0.94%) ⬇️
KubeArmor/monitor/syscallParser.go 54.54% <0.00%> (-23.71%) ⬇️
KubeArmor/feeder/policyMatcher.go 37.56% <0.00%> (-3.09%) ⬇️
KubeArmor/core/kubeUpdate.go 43.68% <0.00%> (-1.10%) ⬇️
KubeArmor/enforcer/appArmorEnforcer.go 48.29% <0.00%> (-0.60%) ⬇️
KubeArmor/enforcer/SELinuxEnforcer.go 0.00% <0.00%> (ø)
KubeArmor/enforcer/appArmorHostProfile.go 0.00% <0.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d78301...38028e1. Read the comment docs.

Copy link
Contributor

@nyrahul nyrahul left a comment

Choose a reason for hiding this comment

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

Thanks @nthnieljson for handling this. LGTM.

So as i understand the logic is:
If GRPC config is set to 0, then we listen on port 0 which means we will get a dynamically allocated port, whose value will be written in the pid file.
There is another PR in kubearmor-client which will check for this pid file and use the port number.

@nam-jaehyun , WDYT? I like this solution.

…Jason nthnieljson@gmail.com

Signed-off-by: Nathaniel Jason <nthnieljson@gmail.com>
…eljson@gmail.com

Signed-off-by: Nathaniel Jason <nthnieljson@gmail.com>
@nam-jaehyun
Copy link
Collaborator

@nthnieljson can you make all the changes in a single commit in order to merge this PR?

Copy link
Collaborator

@nam-jaehyun nam-jaehyun left a comment

Choose a reason for hiding this comment

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

after squashing the commits, let's merge the PR.

@nam-jaehyun nam-jaehyun merged commit b5eb99b into kubearmor:main Jun 14, 2022
rksharma95 pushed a commit to rksharma95/KubeArmor that referenced this pull request Jul 19, 2022
* use random grpc port by Nathaniel Jason

Signed-off-by: nthnieljson <nthnieljson@gmail.com>
Signed-off-by: rk <ramakant@accuknox.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.

using random kubearmor GRPC server port
7 participants