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

modifies the detect enforcer function in the controller #1497

Closed
wants to merge 1 commit into from

Conversation

swastik959
Copy link

Purpose of PR?:
kubearmor makes use of /sys/kernel/security/lsm to detect enforcer this can be removed as the operator now deploys the snitch which detects the enforcer and adds it to the node label
Fixes #1389

Does this PR introduce a breaking change?

If the changes in this PR are manually verified, list down the scenarios covered::

Additional information for reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs

Checklist:

  • Bug fix. Fixes #
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • PR Title follows the convention of <type>(<scope>): <subject>
  • Commit has unit tests
  • Commit has integration tests

Signed-off-by: swastik959 <Sswastik959@gmail.com>
@rksharma95
Copy link
Collaborator

@swastik959 thanks for your contribution, can you also handle the deployment related changes with this PR itself.

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.

Thank you for the PR. For (others) reference, the PR removes the need to depend on /sys/kernel/security/lsm file to detect enforcer settings. KubeArmor implemented an operator pattern sometime back that affixes a label on the node that specifies the policy enforcer in use.

However, my understanding is that this label is created only when the operator pattern is used and if someone deploys the kubearmor using the karmor cli then these labels are present.

@daemon1024 @Ankurk99 @achrefbensaad , isn't this correct?

I guess, we eventually intend to use operator mode of deployment even with karmor cli, but right now it is not present.

It is best to keep this PR active till next release and merge it along with the karmor changes.

@Ankurk99
Copy link
Member

if someone deploys the kubearmor using the karmor cli then these labels are present.

using the karmor cli then these labels are not present.
Correct 👍

@swastik959
Copy link
Author

@nyrahul can you create a seperate issue for that I would like to work on it .

.github/workflows/ci-latest-release.yml Show resolved Hide resolved
@@ -26,6 +27,9 @@ import (
securityv1 "github.com/kubearmor/KubeArmor/pkg/KubeArmorController/api/security.kubearmor.com/v1"
"github.com/kubearmor/KubeArmor/pkg/KubeArmorController/controllers"
"github.com/kubearmor/KubeArmor/pkg/KubeArmorController/handlers"
"github.com/kubearmor/KubeArmor/pkg/KubeArmorOperator/common"
Copy link
Member

Choose a reason for hiding this comment

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

Please do go mod tidy here and update the deps.

@@ -139,29 +143,29 @@ func main() {
}

// detect the enforcer on the node
func detectEnforcer(logger logr.Logger) string {
func detectEnforcer(logger logr.Logger, client client.Client, nodeName string) string {
Copy link
Member

Choose a reason for hiding this comment

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

We can use context.Context here instead of using context.TODO() later, but I think it's okay given we use context.TODO() at other places in the code as well.
// cc @daemon1024

w.r.t this change, please update the call where we are registering webhook with updated arguments.
We should update this Enforcer: detectEnforcer(setupLog), as well.

Copy link
Author

Choose a reason for hiding this comment

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

@kranurag7 should I make changes in podannotator struct itself or just add client anf node name in the same file's main function

pkg/KubeArmorController/main.go Show resolved Hide resolved
pkg/KubeArmorController/main.go Show resolved Hide resolved
@DelusionalOptimist
Copy link
Member

Folks, FYI kubearmor-client now installs KubeArmor using the operator, since it was a blocker to this PR earlier.
cc @swastik959 @rksharma95 @kranurag7

@Aryan-sharma11
Copy link
Member

Resolved with #1335. Thanks for the PR @swastik959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Remove kernel security path dependecy for kubearmor-controller
7 participants