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

new(cmd/driver): driver config namespace from env variable #560

Merged
merged 4 commits into from
May 16, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented May 16, 2024

What type of PR is this?

/kind bug
/kind cleanup

Any specific area of the project related to this PR?

/area cli

What this PR does / why we need it:

This PR enables the namespace parameter of driver config command to be passed as FALCOCTL_DRIVER_CONFIG_NAMESPACE env variable.

Also, it fixes k8s configMap commit code, switching from Patch to Update command.
Finally, logs are a little improved.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
…nfigmap.

Moreover fixes some issues with the k8s config map updater.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP
Copy link
Contributor Author

FedeDP commented May 16, 2024

/cc @alacuku

@poiana poiana requested review from leogr and loresuso May 16, 2024 07:06
@poiana poiana requested a review from alacuku May 16, 2024 07:06
@FedeDP
Copy link
Contributor Author

FedeDP commented May 16, 2024

/milestone v0.8.0

@poiana poiana added the size/L label May 16, 2024
@poiana poiana added this to the v0.8.0 milestone May 16, 2024
@FedeDP FedeDP force-pushed the new/driver_config_namespace_env branch from df0175c to 72dc74f Compare May 16, 2024 07:07
@@ -108,12 +128,6 @@ func checkFalcoRunsWithDrivers(engineKind string) error {

func (o *driverConfigOptions) replaceDriverTypeInFalcoConfig(driverType drivertype.DriverType) error {
falcoCfgFile := filepath.Clean(filepath.Join(string(os.PathSeparator), "etc", "falco", "falco.yaml"))
type engineCfg struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now used from both replaceDriverTypeInFalcoConfig and replaceDriverTypeInK8SConfigMap.

configMap := configMapList.Items[i]
currEngineKind := configMap.Data[configMapEngineKindKey]
if err = checkFalcoRunsWithDrivers(currEngineKind); err != nil {
updated := false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check that at least a configMap was updated, otherwise return error.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP FedeDP force-pushed the new/driver_config_namespace_env branch from 72dc74f to ee4d280 Compare May 16, 2024 07:12
Copy link
Member

@alacuku alacuku left a comment

Choose a reason for hiding this comment

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

That's nice!

/lgtm

@poiana
Copy link
Contributor

poiana commented May 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alacuku, FedeDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit da932e4 into main May 16, 2024
17 checks passed
@poiana poiana deleted the new/driver_config_namespace_env branch May 16, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants