diff --git a/pkg/bot/interactive/help.go b/pkg/bot/interactive/help.go index 3701d1084..11a93f44a 100644 --- a/pkg/bot/interactive/help.go +++ b/pkg/bot/interactive/help.go @@ -25,7 +25,7 @@ func Help(platform config.CommPlatformIntegration, clusterName, botName string) Header: "Using multiple instances", Description: fmt.Sprintf("If you are running multiple Botkube instances in the same channel to interact with %s, make sure to specify the cluster name when typing commands.", clusterName), Body: Body{ - CodeBlock: fmt.Sprintf("--cluster-name=%q\n", clusterName), + CodeBlock: fmt.Sprintf("--cluster-name=%s\n", clusterName), }, }, }, diff --git a/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_headers_and_default_new_lines.golden.txt b/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_headers_and_default_new_lines.golden.txt index 7736f6dee..dae8d2b3b 100644 --- a/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_headers_and_default_new_lines.golden.txt +++ b/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_headers_and_default_new_lines.golden.txt @@ -3,7 +3,7 @@ Botkube is now active for "testing" cluster :rocket: *Using multiple instances* If you are running multiple Botkube instances in the same channel to interact with testing, make sure to specify the cluster name when typing commands. ``` ---cluster-name="testing" +--cluster-name=testing ``` *Manage incoming notifications* diff --git a/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_new_lines_and_default_headers.golden.txt b/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_new_lines_and_default_headers.golden.txt index 0753888c8..400c34ca6 100644 --- a/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_new_lines_and_default_headers.golden.txt +++ b/pkg/bot/interactive/testdata/TestInteractiveMessageToMarkdown/render_with_custom_new_lines_and_default_headers.golden.txt @@ -1,5 +1,5 @@ Botkube is now active for "testing" cluster :rocket:

**Using multiple instances**
If you are running multiple Botkube instances in the same channel to interact with testing, make sure to specify the cluster name when typing commands.
``` ---cluster-name="testing" +--cluster-name=testing ```

**Manage incoming notifications**
``` @Botkube notifier [start|stop|status] ```
- `@Botkube notifier start`
- `@Botkube notifier stop`
- `@Botkube notifier status`

**Notification settings for this channel**
By default, Botkube will notify only about cluster errors and recommendations.
- `@Botkube edit SourceBindings`

**Ping your cluster**
Check the status of connected Kubernetes cluster(s).
- `@Botkube ping`

**Run kubectl commands (if enabled)**
You can run kubectl commands directly from Platform!
- `@Botkube kubectl get services`
- `@Botkube kubectl get pods`
- `@Botkube kubectl get deployments`

To list all supported kubectl commands
- `@Botkube commands list`

**Filters (advanced)**
You can extend Botkube functionality by writing additional filters that can check resource specs, validate some checks and add messages to the Event struct. Learn more at https://botkube.io/filters

**Angry? Amazed?**
Give feedback: https://feedback.botkube.io

Read our docs: https://botkube.io/docs
Join our Slack: https://join.botkube.io
Follow us on Twitter: https://twitter.com/botkube_io
\ No newline at end of file diff --git a/pkg/bot/interactive/testdata/TestInteractiveMessageToPlaintext.golden.txt b/pkg/bot/interactive/testdata/TestInteractiveMessageToPlaintext.golden.txt index 82e572dc9..47aabb85a 100644 --- a/pkg/bot/interactive/testdata/TestInteractiveMessageToPlaintext.golden.txt +++ b/pkg/bot/interactive/testdata/TestInteractiveMessageToPlaintext.golden.txt @@ -1,7 +1,7 @@ Using multiple instances If you are running multiple Botkube instances in the same channel to interact with testing, make sure to specify the cluster name when typing commands. ---cluster-name="testing" +--cluster-name=testing Manage incoming notifications diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index d60647437..d949b9d7c 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "regexp" + "strconv" "strings" coreV1 "k8s.io/api/core/v1" @@ -122,7 +123,13 @@ func GetClusterNameFromKubectlCmd(cmd string) string { if len(matchedArray) >= 2 { s = matchedArray[1] } - return s + + str, err := strconv.Unquote(s) + if err != nil { + return s + } + + return str } // GVRToString converts GVR formats to string diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index cd6226e2c..407ffb2cb 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -18,6 +18,7 @@ func TestGetClusterNameFromKubectlCmd(t *testing.T) { {input: "--cluster-name minikube1", expected: "minikube1"}, {input: "--cluster-name minikube2 -n default", expected: "minikube2"}, {input: "--cluster-name minikube -n=default", expected: "minikube"}, + {input: `--cluster-name="minikube"`, expected: "minikube"}, {input: "--cluster-name", expected: ""}, {input: "--cluster-name ", expected: ""}, {input: "--cluster-name=", expected: ""},