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

Cherry-pick fixes #971

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/bot/interactive/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ func (h *HelpMessage) configSections() []Section {
Base: Base{
Header: "View current Botkube configuration",
Body: Body{
CodeBlock: fmt.Sprintf("%s config\n", h.botName),
CodeBlock: fmt.Sprintf("%s show config\n", h.botName),
},
},
Buttons: []Button{
h.btnBuilder.ForCommandWithoutDesc("Display configuration", "config"),
h.btnBuilder.ForCommandWithoutDesc("Display configuration", "show config"),
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ By default, Botkube will notify only about cluster errors and recommendations.

*View current Botkube configuration*
```
@Botkube config
@Botkube show config
```
- `@Botkube config`
- `@Botkube show config`

*Run kubectl commands (if enabled)*
You can run kubectl commands directly from Platform!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Botkube is now active for "testing" cluster :rocket:<br><br>**Ping your cluster*
```<br> - `@Botkube enable notifications`<br> - `@Botkube disable notifications`<br> - `@Botkube status notifications`<br><br>**Notification settings for this channel**<br>By default, Botkube will notify only about cluster errors and recommendations.<br> - `@Botkube edit SourceBindings`<br><br>**Manage automated actions**<br>```
@Botkube [list|enable|disable] action [action name]
```<br> - `@Botkube list actions`<br><br>**View current Botkube configuration**<br>```
@Botkube config
```<br> - `@Botkube config`<br><br>**Run kubectl commands (if enabled)**<br>You can run kubectl commands directly from Platform!<br> - `@Botkube kubectl get services`<br> - `@Botkube kubectl get pods`<br> - `@Botkube kubectl get deployments`<br><br>To list all enabled executors<br> - `@Botkube list executors`<br><br>To list all command aliases<br> - `@Botkube list aliases`<br><br>**Filters (advanced)**<br>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://docs.botkube.io/filters<br><br>**Angry? Amazed?**<br>Give feedback: https://feedback.botkube.io<br><br>Read our docs: https://docs.botkube.io<br>Join our Slack: https://join.botkube.io<br>Follow us on Twitter: https://twitter.com/botkube_io<br>
@Botkube show config
```<br> - `@Botkube show config`<br><br>**Run kubectl commands (if enabled)**<br>You can run kubectl commands directly from Platform!<br> - `@Botkube kubectl get services`<br> - `@Botkube kubectl get pods`<br> - `@Botkube kubectl get deployments`<br><br>To list all enabled executors<br> - `@Botkube list executors`<br><br>To list all command aliases<br> - `@Botkube list aliases`<br><br>**Filters (advanced)**<br>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://docs.botkube.io/filters<br><br>**Angry? Amazed?**<br>Give feedback: https://feedback.botkube.io<br><br>Read our docs: https://docs.botkube.io<br>Join our Slack: https://join.botkube.io<br>Follow us on Twitter: https://twitter.com/botkube_io<br>
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Manage automated actions
- @Botkube list actions

View current Botkube configuration
@Botkube config
@Botkube show config

- @Botkube config
- @Botkube show config

Run kubectl commands (if enabled)
You can run kubectl commands directly from Platform!
Expand Down
17 changes: 4 additions & 13 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,10 @@ type Executors struct {
Plugins Plugins `koanf:",remain"`
}

// CollectEnabledCommandPrefixes returns list of command prefixes for enabled executors.
func (e Executors) CollectEnabledCommandPrefixes() []string {
var prefixes []string

// TODO: Remove this once we deprecate kubectl executor
if e.Kubectl.Enabled {
prefixes = append(prefixes, kubectlCommandName)
}

for pluginName, plugin := range e.Plugins {
if !plugin.Enabled {
continue
}
// CollectCommandPrefixes returns list of command prefixes for all executors, even disabled ones.
func (e Executors) CollectCommandPrefixes() []string {
prefixes := []string{kubectlCommandName}
for pluginName := range e.Plugins {
prefixes = append(prefixes, ExecutorNameForKey(pluginName))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ aliases:
foo:
command: foo --bar
displayName: "Foo"
eee:
command: echo --foo
displayName: "Echo"
helm:
command: helm version
displayName: "Helm version"
Expand All @@ -23,7 +26,7 @@ aliases:
executors:
'kubectl-read-only':
kubectl:
enabled: true
enabled: false
helm:
botkube/helm:
config: {}
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func aliasesStructValidator(sl validator.StructLevel) {
var prefixesToCheck []string
// collect executors
for _, exec := range conf.Executors {
prefixesToCheck = append(prefixesToCheck, exec.CollectEnabledCommandPrefixes()...)
prefixesToCheck = append(prefixesToCheck, exec.CollectCommandPrefixes()...)
}
// collect builtin commands
for _, verb := range command.AllVerbs() {
Expand Down