kubernetes-response-engine icon indicating copy to clipboard operation
kubernetes-response-engine copied to clipboard

Subscribing to multiple issues when deploying a playbook to GKE fails

Open jonnymcgow7 opened this issue 5 years ago • 4 comments

Due to the join method being used in the deploy_playbook_gke script, it is not possible to deploy a function with multiple subscriptions.

The current implementation uses commas as delimiters for both the dictionary containing environment variables, and the subscribed_alerts themselves. This results in an incorrect split happening between the multiple subscriptions, which causes the script to crash.

To replicate just use multiple -s tags, ie: $ ./deploy_playbook_gke -p delete -t falco-alerts -s falco.notice.terminal_shell_in_container -s falco.info.* -k <cluster_name> -z <gcloud_zone> -n <gcloud_project>

To fix this issue I suggest changing the join function to

function join { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }

And then you can use multiple characters for each delimiter, which will allow you to use two commas to separate env variables, and one comma to separate subscriptions.

I'll submit a PR with this functionality and link it below.

jonnymcgow7 avatar Jul 23 '19 00:07 jonnymcgow7

PR with fix: https://github.com/falcosecurity/kubernetes-response-engine/pull/5

jonnymcgow7 avatar Jul 23 '19 01:07 jonnymcgow7

I fix this adding ^:^ and : in the --set-env-vars in the gcloud functions command. --set-env-vars=^:^"$(join : ${environment[@]})"

I hope it helps

eihwaz-kob avatar Apr 28 '20 13:04 eihwaz-kob

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Nov 20 '20 19:11 poiana

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

poiana avatar Feb 18 '21 21:02 poiana