From 31098f6b1a3c2695e54401e12dddaa34c90af944 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 12 Jul 2023 12:32:34 +0200 Subject: [PATCH 1/2] Rename x plugin to exec --- .github/workflows/process-chart.yml | 4 +- .goreleaser.plugin.yaml | 6 +-- cmd/executor/{x => exec}/main.go | 16 ++++---- cmd/executor/{x => exec}/templates/argo.yaml | 0 cmd/executor/{x => exec}/templates/flux.yaml | 38 +++++++++---------- cmd/executor/{x => exec}/templates/helm.yaml | 24 ++++++------ helm/botkube/README.md | 8 ++-- helm/botkube/values.yaml | 8 ++-- internal/executor/x/cmd_parse_test.go | 16 ++++---- internal/executor/x/config.go | 4 +- internal/executor/x/output/message_parser.go | 6 +-- .../executor/x/output/message_tutorial.go | 4 +- 12 files changed, 67 insertions(+), 67 deletions(-) rename cmd/executor/{x => exec}/main.go (93%) rename cmd/executor/{x => exec}/templates/argo.yaml (100%) rename cmd/executor/{x => exec}/templates/flux.yaml (71%) rename cmd/executor/{x => exec}/templates/helm.yaml (67%) diff --git a/.github/workflows/process-chart.yml b/.github/workflows/process-chart.yml index 3cff1feac..9cf44fef1 100644 --- a/.github/workflows/process-chart.yml +++ b/.github/workflows/process-chart.yml @@ -6,7 +6,7 @@ env: HELM_DOCS_VERSION: 1.11.0 CHART_REPOSITORY: https://charts.botkube.io/ LATEST_PLUGIN_INDEX_URL: https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml - LATEST_X_PLUGIN_TPLS_URL: github.com/kubeshop/botkube//cmd/executor/x/templates?ref=main + LATEST_X_PLUGIN_TPLS_URL: github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=main on: workflow_call: @@ -54,7 +54,7 @@ jobs: find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s/${CHART_CURRENT_VERSION}/${{ inputs.next-version }}/g" {} + find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s/${CHART_DEV_VERSION}/${{ inputs.next-version }}/g" {} + find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_PLUGIN_INDEX_URL}~https://github.com/kubeshop/botkube/releases/download/${{ inputs.next-version }}/plugins-index.yaml~g" {} + - find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_X_PLUGIN_TPLS_URL}~github.com/kubeshop/botkube//cmd/executor/x/templates?ref=${{ inputs.next-version }}~g" {} + + find ${HELM_FOLDER} -name "*.yaml" -exec sed -i "s~${LATEST_X_PLUGIN_TPLS_URL}~github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=${{ inputs.next-version }}~g" {} + - name: Set up chart-testing uses: helm/chart-testing-action@v2.2.1 diff --git a/.goreleaser.plugin.yaml b/.goreleaser.plugin.yaml index 747693288..4fa09388f 100644 --- a/.goreleaser.plugin.yaml +++ b/.goreleaser.plugin.yaml @@ -33,9 +33,9 @@ builds: goarch: *goarch goarm: *goarm - - id: x - main: cmd/executor/x/main.go - binary: executor_x_{{ .Os }}_{{ .Arch }} + - id: exec + main: cmd/executor/exec/main.go + binary: executor_exec_{{ .Os }}_{{ .Arch }} no_unique_dist_dir: true env: *env diff --git a/cmd/executor/x/main.go b/cmd/executor/exec/main.go similarity index 93% rename from cmd/executor/x/main.go rename to cmd/executor/exec/main.go index 57d41a6f9..f7e7bcdcb 100644 --- a/cmd/executor/x/main.go +++ b/cmd/executor/exec/main.go @@ -24,7 +24,7 @@ import ( // version is set via ldflags by GoReleaser. var version = "dev" -const pluginName = "x" +const pluginName = "exec" // XExecutor implements Botkube executor plugin. type XExecutor struct{} @@ -32,17 +32,17 @@ type XExecutor struct{} func (i *XExecutor) Help(_ context.Context) (api.Message, error) { help := heredoc.Doc(` Usage: - x run [COMMAND] [FLAGS] Run a specified command with optional flags - x install [SOURCE] Install a binary using the https://github.com/zyedidia/eget syntax. + exec run [COMMAND] [FLAGS] Run a specified command with optional flags + exec install [SOURCE] Install a binary using the https://github.com/zyedidia/eget syntax. Usage Examples: # Install the Helm CLI - x install https://get.helm.sh/helm-v3.10.3-linux-amd64.tar.gz --file helm + exec install https://get.helm.sh/helm-v3.10.3-linux-amd64.tar.gz --file helm # Run the 'helm list -A' command. - x run helm list -A + exec run helm list -A Options: -h, --help Show this help message`) @@ -151,7 +151,7 @@ func (i *XExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (exec case cmd.Install != nil: var ( tool = Normalize(strings.Join(cmd.Install.Tool, " ")) - command = x.Parse(fmt.Sprintf("x install %s", tool)) + command = x.Parse(fmt.Sprintf("exec install %s", tool)) dir, isCustom = cfg.TmpDir.Get() downloadCmd = fmt.Sprintf("eget %s", tool) ) @@ -210,7 +210,7 @@ func jsonSchema() api.JSONSchema { return api.JSONSchema{ Value: heredoc.Docf(`{ "$schema": "http://json-schema.org/draft-07/schema#", - "title": "x", + "title": "exec", "description": "Install and run CLIs directly from the chat window without hassle. All magic included.", "type": "object", "properties": { @@ -247,7 +247,7 @@ func getDefaultTemplateSource() string { if ver == "dev" { ver = "main" } - return fmt.Sprintf("github.com/kubeshop/botkube//cmd/executor/x/templates?ref=%s", ver) + return fmt.Sprintf("github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=%s", ver) } func Normalize(in string) string { diff --git a/cmd/executor/x/templates/argo.yaml b/cmd/executor/exec/templates/argo.yaml similarity index 100% rename from cmd/executor/x/templates/argo.yaml rename to cmd/executor/exec/templates/argo.yaml diff --git a/cmd/executor/x/templates/flux.yaml b/cmd/executor/exec/templates/flux.yaml similarity index 71% rename from cmd/executor/x/templates/flux.yaml rename to cmd/executor/exec/templates/flux.yaml index 28604d48d..89ee71c2e 100644 --- a/cmd/executor/x/templates/flux.yaml +++ b/cmd/executor/exec/templates/flux.yaml @@ -18,12 +18,12 @@ templates: - trigger: command: - prefix: "x install github.com/fluxcd/flux2" + prefix: "exec install github.com/fluxcd/flux2" type: "wrapper" message: buttons: - name: "Quickstart" - command: "{{BotName}} x run quickstart flux" + command: "{{BotName}} exec run quickstart flux" style: "primary" - trigger: @@ -36,14 +36,14 @@ templates: header: "Flux Quick Start tutorial" buttons: - name: "Check prerequisites" - command: "{{BotName}} x run flux check --pre" + command: "{{BotName}} exec run flux check --pre" description: "{{BotName}} flux check --pre" - name: "Install Flux" - command: "{{BotName}} x run flux install" + command: "{{BotName}} exec run flux install" description: "{{BotName}} flux install" - name: "Create Git source" command: | - {{BotName}} x run flux create source git webapp-latest + {{BotName}} exec run flux create source git webapp-latest --url=https://github.com/stefanprodan/podinfo --branch=master --interval=3m @@ -53,17 +53,17 @@ templates: --branch=master --interval=3m - name: "List Git sources" - command: "{{BotName}} x run flux get sources git" + command: "{{BotName}} exec run flux get sources git" description: "{{BotName}} flux get sources git" - name: "Reconcile Git source" - command: "{{BotName}} x run flux reconcile source git flux-system" + command: "{{BotName}} exec run flux reconcile source git flux-system" description: "{{BotName}} flux reconcile source git flux-system" - name: "Export Git sources" - command: "{{BotName}} x run flux export source git --all" + command: "{{BotName}} exec run flux export source git --all" description: "{{BotName}} flux export source git --all" - name: "Create Kustomization" command: | - {{BotName}} x run flux create kustomization webapp-dev + {{BotName}} exec run flux create kustomization webapp-dev --source=webapp-latest --path='./deploy/webapp/' --prune=true @@ -72,7 +72,7 @@ templates: --health-check='Deployment/frontend.webapp' --health-check-timeout=2m description: | - {{BotName}} x run flux create kustomization webapp-dev + {{BotName}} exec run flux create kustomization webapp-dev --source=webapp-latest --path='./deploy/webapp/' --prune=true @@ -81,29 +81,29 @@ templates: --health-check='Deployment/frontend.webapp' --health-check-timeout=2m - name: "Reconcile Kustomization" - command: "{{BotName}} x run flux reconcile kustomization webapp-dev --with-source" + command: "{{BotName}} exec run flux reconcile kustomization webapp-dev --with-source" description: "{{BotName}} flux reconcile kustomization webapp-dev --with-source" - name: "Suspend Kustomization" - command: "{{BotName}} x run flux suspend kustomization webapp-dev" + command: "{{BotName}} exec run flux suspend kustomization webapp-dev" description: "{{BotName}} flux suspend kustomization webapp-dev" - name: "Export Kustomizations" - command: "{{BotName}} x run flux export kustomization --all" + command: "{{BotName}} exec run flux export kustomization --all" description: "{{BotName}} flux export kustomization --all" - name: "Resume Kustomization" - command: "{{BotName}} x run flux resume kustomization webapp-dev" + command: "{{BotName}} exec run flux resume kustomization webapp-dev" description: "{{BotName}} flux resume kustomization webapp-dev" - name: "Delete Kustomization" - command: "{{BotName}} x run flux delete kustomization webapp-dev" + command: "{{BotName}} exec run flux delete kustomization webapp-dev" description: "{{BotName}} flux delete kustomization webapp-dev" - name: "Delete Git source" - command: "{{BotName}} x run flux delete source git webapp-latest" + command: "{{BotName}} exec run flux delete source git webapp-latest" description: "{{BotName}} flux delete source" - name: "Delete Kustomization" - command: "{{BotName}} x run flux delete kustomization webapp-dev" + command: "{{BotName}} exec run flux delete kustomization webapp-dev" description: "{{BotName}} flux delete kustomization webapp-dev" - name: "Delete Git source" - command: "{{BotName}} x run flux delete source git webapp-latest --silent" + command: "{{BotName}} exec run flux delete source git webapp-latest --silent" description: "{{BotName}} flux delete source git webapp-latest --silent" - name: "Uninstall Flux" - command: "{{BotName}} x run flux uninstall" + command: "{{BotName}} exec run flux uninstall" description: "{{BotName}} flux uninstall" diff --git a/cmd/executor/x/templates/helm.yaml b/cmd/executor/exec/templates/helm.yaml similarity index 67% rename from cmd/executor/x/templates/helm.yaml rename to cmd/executor/exec/templates/helm.yaml index 6c603b1f9..3b355e792 100644 --- a/cmd/executor/x/templates/helm.yaml +++ b/cmd/executor/exec/templates/helm.yaml @@ -19,12 +19,12 @@ templates: - trigger: command: - prefix: "x install https://get.helm.sh/helm-v" + prefix: "exec install https://get.helm.sh/helm-v" type: "wrapper" message: buttons: - name: "Quickstart" - command: "{{BotName}} x run quickstart helm" + command: "{{BotName}} exec run quickstart helm" style: "primary" - trigger: @@ -38,31 +38,31 @@ templates: buttons: - name: "Global Help" description: "{{BotName}} helm help" - command: "{{BotName}} x run helm help" + command: "{{BotName}} exec run helm help" - name: "Version" description: "{{BotName}} helm version" - command: "{{BotName}} x run helm version" + command: "{{BotName}} exec run helm version" - name: "Install help" description: "{{BotName}} helm install -h" - command: "{{BotName}} x run helm install -h" + command: "{{BotName}} exec run helm install -h" - name: "Install by absolute URL" description: "{{BotName}} helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'" - command: "{{BotName}} x run helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'" + command: "{{BotName}} exec run helm install\n--repo https://charts.bitnami.com/bitnami psql postgresql\n--set clusterDomain='testing.local'" - name: "Install by chart reference:" description: "{{BotName}} helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name" - command: "{{BotName}} x run helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name" + command: "{{BotName}} exec run helm install https://charts.bitnami.com/bitnami/postgresql-12.1.0.tgz --create-namespace -n test --generate-name" - name: "List" description: "{{BotName}} helm list -A" - command: "{{BotName}} x run helm list -A" + command: "{{BotName}} exec run helm list -A" - name: "List with filter" description: "{{BotName}} helm list -f 'p' -A" - command: "{{BotName}} x run helm list -f 'p' -A" + command: "{{BotName}} exec run helm list -f 'p' -A" - name: "Status" description: "{{BotName}} helm status psql" - command: "{{BotName}} x run helm status psql" + command: "{{BotName}} exec run helm status psql" - name: "Upgrade" description: "{{BotName}} helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'" - command: "{{BotName}} x run helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'" + command: "{{BotName}} exec run helm upgrade --repo https://charts.bitnami.com/bitnami psql postgresql --set clusterDomain='cluster.local'" - name: "History" description: "{{BotName}} helm history psql" - command: "{{BotName}} x run helm history psql" + command: "{{BotName}} exec run helm history psql" diff --git a/helm/botkube/README.md b/helm/botkube/README.md index 1b79289c7..9fb76b720 100644 --- a/helm/botkube/README.md +++ b/helm/botkube/README.md @@ -53,12 +53,12 @@ Controller for the Botkube Slack app which helps you monitor your Kubernetes clu | [sources.k8s-all-events.botkube/kubernetes.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [sources.k8s-err-events.botkube/kubernetes.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [sources.k8s-create-events.botkube/kubernetes.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | -| [executors.bins-management.botkube/x.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | +| [executors.bins-management.botkube/exec.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [executors.k8s-default-tools.botkube/helm.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [executors.ai.botkube/doctor.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [executors.k8s-default-tools.botkube/kubectl.context.rbac](./values.yaml#L126) | object | `{"group":{"prefix":"","static":{"values":["botkube-plugins-default"]},"type":"Static"}}` | RBAC configuration for this plugin. | | [sources.k8s-create-events.botkube/kubernetes.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | -| [executors.bins-management.botkube/x.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | +| [executors.bins-management.botkube/exec.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | | [sources.k8s-err-events.botkube/kubernetes.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | | [sources.k8s-all-events.botkube/kubernetes.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | | [sources.k8s-err-events-with-ai-support.botkube/kubernetes.context.rbac.group.type](./values.yaml#L129) | string | `"Static"` | Static impersonation for a given username and groups. | @@ -74,11 +74,11 @@ Controller for the Botkube Slack app which helps you monitor your Kubernetes clu | [executors.ai.botkube/doctor.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | | [sources.k8s-err-events-with-ai-support.botkube/kubernetes.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | | [sources.k8s-all-events.botkube/kubernetes.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | -| [executors.bins-management.botkube/x.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | +| [executors.bins-management.botkube/exec.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | | [sources.k8s-create-events.botkube/kubernetes.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | | [executors.k8s-default-tools.botkube/kubectl.context.rbac.group.prefix](./values.yaml#L131) | string | `""` | Prefix that will be applied to .static.value[*]. | | [sources.k8s-create-events.botkube/kubernetes.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | -| [executors.bins-management.botkube/x.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | +| [executors.bins-management.botkube/exec.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | | [sources.k8s-err-events-with-ai-support.botkube/kubernetes.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | | [executors.ai.botkube/doctor.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | | [sources.k8s-recommendation-events.botkube/kubernetes.context.rbac.group.static.values](./values.yaml#L134) | list | `["botkube-plugins-default"]` | Name of group.rbac.authorization.k8s.io the plugin will be bound to. | diff --git a/helm/botkube/values.yaml b/helm/botkube/values.yaml index c68211f54..afc5d8fb6 100644 --- a/helm/botkube/values.yaml +++ b/helm/botkube/values.yaml @@ -555,19 +555,19 @@ executors: context: *default-plugin-context bins-management: - ## X executor configuration. + ## Exec executor configuration. ## Plugin name syntax: /[@]. If version is not provided, the latest version from repository is used. - botkube/x: + botkube/exec: enabled: false context: *default-plugin-context - ## -- Custom x plugin configuration. + ## -- Custom exec plugin configuration. config: ## -- An array of templates that define how to convert the command output into an interactive message. templates: ## -- Link to templates source ## It uses the go-getter library, which supports multiple URL formats (such as HTTP, Git repositories, or S3) and is able to unpack archives. ## For more details, see the documentation at https://github.com/hashicorp/go-getter. - - ref: github.com/kubeshop/botkube//cmd/executor/x/templates?ref=main + - ref: github.com/kubeshop/botkube//cmd/executor/exec/templates?ref=main ai: ## Doctor executor configuration. diff --git a/internal/executor/x/cmd_parse_test.go b/internal/executor/x/cmd_parse_test.go index fdef13fc4..bc7ed9cd9 100644 --- a/internal/executor/x/cmd_parse_test.go +++ b/internal/executor/x/cmd_parse_test.go @@ -12,30 +12,30 @@ func TestParse(t *testing.T) { expected Command }{ { - input: "x run helm list -A", + input: "exec run helm list -A", expected: Command{ - ToExecute: "x run helm list -A", + ToExecute: "exec run helm list -A", IsRawRequired: false, }, }, { - input: "x run helm list -A @raw", + input: "exec run helm list -A @raw", expected: Command{ - ToExecute: "x run helm list -A", + ToExecute: "exec run helm list -A", IsRawRequired: true, }, }, { - input: "x run kubectl get pods @idx:123", + input: "exec run kubectl get pods @idx:123", expected: Command{ - ToExecute: "x run kubectl get pods", + ToExecute: "exec run kubectl get pods", IsRawRequired: false, }, }, { - input: "x run kubectl get pods @idx:abc", + input: "exec run kubectl get pods @idx:abc", expected: Command{ - ToExecute: "x run kubectl get pods @idx:abc", + ToExecute: "exec run kubectl get pods @idx:abc", IsRawRequired: false, PageIndex: 1, }, diff --git a/internal/executor/x/config.go b/internal/executor/x/config.go index 9ce0f0258..ae188f13d 100644 --- a/internal/executor/x/config.go +++ b/internal/executor/x/config.go @@ -7,14 +7,14 @@ import ( "github.com/kubeshop/botkube/pkg/config" ) -// Config holds x plugin configuration. +// Config holds exec plugin configuration. type Config struct { Templates []getter.Source `yaml:"templates"` TmpDir plugin.TmpDir `yaml:"tmpDir"` Logger config.Logger } -// GetPluginDependencies returns x plugin dependencies. +// GetPluginDependencies returns exec plugin dependencies. func GetPluginDependencies() map[string]api.Dependency { return map[string]api.Dependency{ "eget": { diff --git a/internal/executor/x/output/message_parser.go b/internal/executor/x/output/message_parser.go index 84981c907..216399e91 100644 --- a/internal/executor/x/output/message_parser.go +++ b/internal/executor/x/output/message_parser.go @@ -100,14 +100,14 @@ func (p *TableCommandParser) renderActions(msgCtx template.ParseMessage, table p return api.Section{ Buttons: []api.Button{ - btnBuilder.ForCommandWithoutDesc("Raw output", fmt.Sprintf("x run %s %s", cmd, x.RawOutputIndicator)), + btnBuilder.ForCommandWithoutDesc("Raw output", fmt.Sprintf("exec run %s %s", cmd, x.RawOutputIndicator)), }, Selects: api.Selects{ Items: []api.Select{ { Type: api.StaticSelect, Name: "Actions", - Command: fmt.Sprintf("%s x run", api.MessageBotNamePlaceholder), + Command: fmt.Sprintf("%s exec run", api.MessageBotNamePlaceholder), OptionGroups: []api.OptionGroup{ { Name: "Actions", @@ -209,7 +209,7 @@ func (p *TableCommandParser) selectDropdown(name, cmd, keyTpl string, table pars return nil, 0 } - dropdownID := fmt.Sprintf("x run %s", cmd) + dropdownID := fmt.Sprintf("exec run %s", cmd) idx := p.resolveSelectIdx(state, dropdownID) if idx >= len(options) { idx = len(options) - 1 diff --git a/internal/executor/x/output/message_tutorial.go b/internal/executor/x/output/message_tutorial.go index 97295fdd1..fe561d852 100644 --- a/internal/executor/x/output/message_tutorial.go +++ b/internal/executor/x/output/message_tutorial.go @@ -54,11 +54,11 @@ func (p *TutorialWrapper) getPaginationButtons(msg template.TutorialMessage, pag var out []api.Button if pageIndex > 0 { - out = append(out, btnsBuilder.ForCommandWithoutDesc("Prev", fmt.Sprintf("x run %s @page:%d", cmd, mathx.DecreaseWithMin(pageIndex, 0)))) + out = append(out, btnsBuilder.ForCommandWithoutDesc("Prev", fmt.Sprintf("exec run %s @page:%d", cmd, mathx.DecreaseWithMin(pageIndex, 0)))) } if pageIndex*msg.Paginate.Page < allItems-1 { - out = append(out, btnsBuilder.ForCommandWithoutDesc("Next", fmt.Sprintf("x run %s @page:%d", cmd, mathx.IncreaseWithMax(pageIndex, allItems-1)), api.ButtonStylePrimary)) + out = append(out, btnsBuilder.ForCommandWithoutDesc("Next", fmt.Sprintf("exec run %s @page:%d", cmd, mathx.IncreaseWithMax(pageIndex, allItems-1)), api.ButtonStylePrimary)) } return out } From b0867ffa9e4aa64dec753ae4b24a9e0de8af9c70 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 12 Jul 2023 12:52:08 +0200 Subject: [PATCH 2/2] Add alias, add missing assertion --- helm/botkube/README.md | 220 +++++++++++++------------- helm/botkube/values.yaml | 4 + internal/executor/x/cmd_parse_test.go | 5 +- 3 files changed, 117 insertions(+), 112 deletions(-) diff --git a/helm/botkube/README.md b/helm/botkube/README.md index 9fb76b720..9254462b1 100644 --- a/helm/botkube/README.md +++ b/helm/botkube/README.md @@ -149,116 +149,116 @@ Controller for the Botkube Slack app which helps you monitor your Kubernetes clu | [executors.k8s-default-tools.botkube/helm.config.helmCacheDir](./values.yaml#L529) | string | `"/tmp/helm/.cache"` | Location for storing cached files. Must be under the Helm config directory. | | [executors.k8s-default-tools.botkube/kubectl.config](./values.yaml#L538) | object | See the `values.yaml` file for full object including optional properties related to interactive builder. | Custom kubectl configuration. | | [aliases](./values.yaml#L589) | object | See the `values.yaml` file for full object. | Custom aliases for given commands. The aliases are replaced with the underlying command before executing it. Aliases can replace a single word or multiple ones. For example, you can define a `k` alias for `kubectl`, or `kgp` for `kubectl get pods`. | -| [existingCommunicationsSecretName](./values.yaml#L612) | string | `""` | Configures existing Secret with communication settings. It MUST be in the `botkube` Namespace. To reload Botkube once it changes, add label `botkube.io/config-watch: "true"`. | -| [communications](./values.yaml#L619) | object | See the `values.yaml` file for full object. | Map of communication groups. Communication group contains settings for multiple communication platforms. The property name under `communications` object is an alias for a given configuration group. You can define multiple communication groups with different names. | -| [communications.default-group.socketSlack.enabled](./values.yaml#L624) | bool | `false` | If true, enables Slack bot. | -| [communications.default-group.socketSlack.channels](./values.yaml#L628) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"name":"SLACK_CHANNEL"}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | -| [communications.default-group.socketSlack.channels.default.name](./values.yaml#L631) | string | `"SLACK_CHANNEL"` | Slack channel name without '#' prefix where you have added Botkube and want to receive notifications in. | -| [communications.default-group.socketSlack.channels.default.bindings.executors](./values.yaml#L634) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | -| [communications.default-group.socketSlack.channels.default.bindings.sources](./values.yaml#L639) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | -| [communications.default-group.socketSlack.botToken](./values.yaml#L645) | string | `""` | Slack bot token for your own Slack app. [Ref doc](https://api.slack.com/authentication/token-types). | -| [communications.default-group.socketSlack.appToken](./values.yaml#L648) | string | `""` | Slack app-level token for your own Slack app. [Ref doc](https://api.slack.com/authentication/token-types). | -| [communications.default-group.mattermost.enabled](./values.yaml#L652) | bool | `false` | If true, enables Mattermost bot. | -| [communications.default-group.mattermost.botName](./values.yaml#L654) | string | `"Botkube"` | User in Mattermost which belongs the specified Personal Access token. | -| [communications.default-group.mattermost.url](./values.yaml#L656) | string | `"MATTERMOST_SERVER_URL"` | The URL (including http/https schema) where Mattermost is running. e.g https://example.com:9243 | -| [communications.default-group.mattermost.token](./values.yaml#L658) | string | `"MATTERMOST_TOKEN"` | Personal Access token generated by Botkube user. | -| [communications.default-group.mattermost.team](./values.yaml#L660) | string | `"MATTERMOST_TEAM"` | The Mattermost Team name where Botkube is added. | -| [communications.default-group.mattermost.channels](./values.yaml#L664) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"name":"MATTERMOST_CHANNEL","notification":{"disabled":false}}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | -| [communications.default-group.mattermost.channels.default.name](./values.yaml#L668) | string | `"MATTERMOST_CHANNEL"` | The Mattermost channel name for receiving Botkube alerts. The Botkube user needs to be added to it. | -| [communications.default-group.mattermost.channels.default.notification.disabled](./values.yaml#L671) | bool | `false` | If true, the notifications are not sent to the channel. They can be enabled with `@Botkube` command anytime. | -| [communications.default-group.mattermost.channels.default.bindings.executors](./values.yaml#L674) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | -| [communications.default-group.mattermost.channels.default.bindings.sources](./values.yaml#L679) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | -| [communications.default-group.teams.enabled](./values.yaml#L687) | bool | `false` | If true, enables MS Teams bot. | -| [communications.default-group.teams.botName](./values.yaml#L689) | string | `"Botkube"` | The Bot name set while registering Bot to MS Teams. | -| [communications.default-group.teams.appID](./values.yaml#L691) | string | `"APPLICATION_ID"` | The Botkube application ID generated while registering Bot to MS Teams. | -| [communications.default-group.teams.appPassword](./values.yaml#L693) | string | `"APPLICATION_PASSWORD"` | The Botkube application password generated while registering Bot to MS Teams. | -| [communications.default-group.teams.bindings.executors](./values.yaml#L696) | list | `["k8s-default-tools","bins-management","ai"]` | Executor bindings apply to all MS Teams channels where Botkube has access to. | -| [communications.default-group.teams.bindings.sources](./values.yaml#L701) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Source bindings apply to all channels which have notification turned on with `@Botkube enable notifications` command. | -| [communications.default-group.teams.messagePath](./values.yaml#L706) | string | `"/bots/teams"` | The path in endpoint URL provided while registering Botkube to MS Teams. | -| [communications.default-group.teams.port](./values.yaml#L708) | int | `3978` | The Service port for bot endpoint on Botkube container. | -| [communications.default-group.discord.enabled](./values.yaml#L713) | bool | `false` | If true, enables Discord bot. | -| [communications.default-group.discord.token](./values.yaml#L715) | string | `"DISCORD_TOKEN"` | Botkube Bot Token. | -| [communications.default-group.discord.botID](./values.yaml#L717) | string | `"DISCORD_BOT_ID"` | Botkube Application Client ID. | -| [communications.default-group.discord.channels](./values.yaml#L721) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"id":"DISCORD_CHANNEL_ID","notification":{"disabled":false}}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | -| [communications.default-group.discord.channels.default.id](./values.yaml#L725) | string | `"DISCORD_CHANNEL_ID"` | Discord channel ID for receiving Botkube alerts. The Botkube user needs to be added to it. | -| [communications.default-group.discord.channels.default.notification.disabled](./values.yaml#L728) | bool | `false` | If true, the notifications are not sent to the channel. They can be enabled with `@Botkube` command anytime. | -| [communications.default-group.discord.channels.default.bindings.executors](./values.yaml#L731) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | -| [communications.default-group.discord.channels.default.bindings.sources](./values.yaml#L736) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | -| [communications.default-group.elasticsearch.enabled](./values.yaml#L744) | bool | `false` | If true, enables Elasticsearch. | -| [communications.default-group.elasticsearch.awsSigning.enabled](./values.yaml#L748) | bool | `false` | If true, enables awsSigning using IAM for Elasticsearch hosted on AWS. Make sure AWS environment variables are set. [Ref doc](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html). | -| [communications.default-group.elasticsearch.awsSigning.awsRegion](./values.yaml#L750) | string | `"us-east-1"` | AWS region where Elasticsearch is deployed. | -| [communications.default-group.elasticsearch.awsSigning.roleArn](./values.yaml#L752) | string | `""` | AWS IAM Role arn to assume for credentials, use this only if you don't want to use the EC2 instance role or not running on AWS instance. | -| [communications.default-group.elasticsearch.server](./values.yaml#L754) | string | `"ELASTICSEARCH_ADDRESS"` | The server URL, e.g https://example.com:9243 | -| [communications.default-group.elasticsearch.username](./values.yaml#L756) | string | `"ELASTICSEARCH_USERNAME"` | Basic Auth username. | -| [communications.default-group.elasticsearch.password](./values.yaml#L758) | string | `"ELASTICSEARCH_PASSWORD"` | Basic Auth password. | -| [communications.default-group.elasticsearch.skipTLSVerify](./values.yaml#L761) | bool | `false` | If true, skips the verification of TLS certificate of the Elastic nodes. It's useful for clusters with self-signed certificates. | -| [communications.default-group.elasticsearch.indices](./values.yaml#L765) | object | `{"default":{"bindings":{"sources":["k8s-err-events","k8s-recommendation-events"]},"name":"botkube","replicas":0,"shards":1,"type":"botkube-event"}}` | Map of configured indices. The `indices` property name is an alias for a given configuration. | -| [communications.default-group.elasticsearch.indices.default.name](./values.yaml#L768) | string | `"botkube"` | Configures Elasticsearch index settings. | -| [communications.default-group.elasticsearch.indices.default.bindings.sources](./values.yaml#L774) | list | `["k8s-err-events","k8s-recommendation-events"]` | Notification sources configuration for a given index. | -| [communications.default-group.webhook.enabled](./values.yaml#L781) | bool | `false` | If true, enables Webhook. | -| [communications.default-group.webhook.url](./values.yaml#L783) | string | `"WEBHOOK_URL"` | The Webhook URL, e.g.: https://example.com:80 | -| [communications.default-group.webhook.bindings.sources](./values.yaml#L786) | list | `["k8s-err-events","k8s-recommendation-events"]` | Notification sources configuration for the webhook. | -| [communications.default-group.slack](./values.yaml#L796) | object | See the `values.yaml` file for full object. | Settings for deprecated Slack integration. **DEPRECATED:** Legacy Slack integration has been deprecated and removed from the Slack App Directory. Use `socketSlack` instead. Read more here: https://docs.botkube.io/installation/slack/ | -| [settings.clusterName](./values.yaml#L814) | string | `"not-configured"` | Cluster name to differentiate incoming messages. | -| [settings.lifecycleServer](./values.yaml#L817) | object | `{"enabled":true,"port":2113}` | Server configuration which exposes functionality related to the app lifecycle. | -| [settings.healthPort](./values.yaml#L820) | int | `2114` | | -| [settings.upgradeNotifier](./values.yaml#L822) | bool | `true` | If true, notifies about new Botkube releases. | -| [settings.log.level](./values.yaml#L826) | string | `"info"` | Sets one of the log levels. Allowed values: `info`, `warn`, `debug`, `error`, `fatal`, `panic`. | -| [settings.log.disableColors](./values.yaml#L828) | bool | `false` | If true, disable ANSI colors in logging. | -| [settings.systemConfigMap](./values.yaml#L831) | object | `{"name":"botkube-system"}` | Botkube's system ConfigMap where internal data is stored. | -| [settings.persistentConfig](./values.yaml#L836) | object | `{"runtime":{"configMap":{"annotations":{},"name":"botkube-runtime-config"},"fileName":"_runtime_state.yaml"},"startup":{"configMap":{"annotations":{},"name":"botkube-startup-config"},"fileName":"_startup_state.yaml"}}` | Persistent config contains ConfigMap where persisted configuration is stored. The persistent configuration is evaluated from both chart upgrade and Botkube commands used in runtime. | -| [ssl.enabled](./values.yaml#L851) | bool | `false` | If true, specify cert path in `config.ssl.cert` property or K8s Secret in `config.ssl.existingSecretName`. | -| [ssl.existingSecretName](./values.yaml#L857) | string | `""` | Using existing SSL Secret. It MUST be in `botkube` Namespace. | -| [ssl.cert](./values.yaml#L860) | string | `""` | SSL Certificate file e.g certs/my-cert.crt. | -| [service](./values.yaml#L863) | object | `{"name":"metrics","port":2112,"targetPort":2112}` | Configures Service settings for ServiceMonitor CR. | -| [ingress](./values.yaml#L870) | object | `{"annotations":{"kubernetes.io/ingress.class":"nginx"},"create":false,"host":"HOST","tls":{"enabled":false,"secretName":""}}` | Configures Ingress settings that exposes MS Teams endpoint. [Ref doc](https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource). | -| [serviceMonitor](./values.yaml#L881) | object | `{"enabled":false,"interval":"10s","labels":{},"path":"/metrics","port":"metrics"}` | Configures ServiceMonitor settings. [Ref doc](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitor). | -| [deployment.annotations](./values.yaml#L891) | object | `{}` | Extra annotations to pass to the Botkube Deployment. | -| [deployment.livenessProbe](./values.yaml#L893) | object | `{"failureThreshold":5,"initialDelaySeconds":1,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":1}` | Liveness probe. | -| [deployment.livenessProbe.initialDelaySeconds](./values.yaml#L895) | int | `1` | The liveness probe initial delay seconds. | -| [deployment.livenessProbe.periodSeconds](./values.yaml#L897) | int | `15` | The liveness probe period seconds. | -| [deployment.livenessProbe.timeoutSeconds](./values.yaml#L899) | int | `1` | The liveness probe timeout seconds. | -| [deployment.livenessProbe.failureThreshold](./values.yaml#L901) | int | `5` | The liveness probe failure threshold. | -| [deployment.livenessProbe.successThreshold](./values.yaml#L903) | int | `1` | The liveness probe success threshold. | -| [deployment.readinessProbe](./values.yaml#L906) | object | `{"failureThreshold":5,"initialDelaySeconds":1,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":1}` | Readiness probe. | -| [deployment.readinessProbe.initialDelaySeconds](./values.yaml#L908) | int | `1` | The readiness probe initial delay seconds. | -| [deployment.readinessProbe.periodSeconds](./values.yaml#L910) | int | `15` | The readiness probe period seconds. | -| [deployment.readinessProbe.timeoutSeconds](./values.yaml#L912) | int | `1` | The readiness probe timeout seconds. | -| [deployment.readinessProbe.failureThreshold](./values.yaml#L914) | int | `5` | The readiness probe failure threshold. | -| [deployment.readinessProbe.successThreshold](./values.yaml#L916) | int | `1` | The readiness probe success threshold. | -| [extraAnnotations](./values.yaml#L923) | object | `{}` | Extra annotations to pass to the Botkube Pod. | -| [extraLabels](./values.yaml#L925) | object | `{}` | Extra labels to pass to the Botkube Pod. | -| [priorityClassName](./values.yaml#L927) | string | `""` | Priority class name for the Botkube Pod. | -| [nameOverride](./values.yaml#L930) | string | `""` | Fully override "botkube.name" template. | -| [fullnameOverride](./values.yaml#L932) | string | `""` | Fully override "botkube.fullname" template. | -| [resources](./values.yaml#L938) | object | `{}` | The Botkube Pod resource request and limits. We usually recommend not to specify default resources and to leave this as a conscious choice for the user. This also increases chances charts run on environments with little resources, such as Minikube. [Ref docs](https://kubernetes.io/docs/user-guide/compute-resources/) | -| [extraEnv](./values.yaml#L950) | list | `[{"name":"LOG_LEVEL_SOURCE_BOTKUBE_KUBERNETES","value":"debug"}]` | Extra environment variables to pass to the Botkube container. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#environment-variables). | -| [extraVolumes](./values.yaml#L964) | list | `[]` | Extra volumes to pass to the Botkube container. Mount it later with extraVolumeMounts. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume/#Volume). | -| [extraVolumeMounts](./values.yaml#L979) | list | `[]` | Extra volume mounts to pass to the Botkube container. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#volumes-1). | -| [nodeSelector](./values.yaml#L997) | object | `{}` | Node labels for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/user-guide/node-selection/). | -| [tolerations](./values.yaml#L1001) | list | `[]` | Tolerations for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/). | -| [affinity](./values.yaml#L1005) | object | `{}` | Affinity for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity). | -| [serviceAccount.create](./values.yaml#L1009) | bool | `true` | If true, a ServiceAccount is automatically created. | -| [serviceAccount.name](./values.yaml#L1012) | string | `""` | The name of the service account to use. If not set, a name is generated using the fullname template. | -| [serviceAccount.annotations](./values.yaml#L1014) | object | `{}` | Extra annotations for the ServiceAccount. | -| [extraObjects](./values.yaml#L1017) | list | `[]` | Extra Kubernetes resources to create. Helm templating is allowed as it is evaluated before creating the resources. | -| [analytics.disable](./values.yaml#L1045) | bool | `false` | If true, sending anonymous analytics is disabled. To learn what date we collect, see [Privacy Policy](https://docs.botkube.io/privacy#privacy-policy). | -| [configWatcher.enabled](./values.yaml#L1050) | bool | `true` | If true, restarts the Botkube Pod on config changes. | -| [configWatcher.tmpDir](./values.yaml#L1052) | string | `"/tmp/watched-cfg/"` | Directory, where watched configuration resources are stored. | -| [configWatcher.initialSyncTimeout](./values.yaml#L1055) | int | `0` | Timeout for the initial Config Watcher sync. If set to 0, waiting for Config Watcher sync will be skipped. In a result, configuration changes may not reload Botkube app during the first few seconds after Botkube startup. | -| [configWatcher.image.registry](./values.yaml#L1058) | string | `"ghcr.io"` | Config watcher image registry. | -| [configWatcher.image.repository](./values.yaml#L1060) | string | `"kubeshop/k8s-sidecar"` | Config watcher image repository. | -| [configWatcher.image.tag](./values.yaml#L1062) | string | `"in-cluster-config"` | Config watcher image tag. | -| [configWatcher.image.pullPolicy](./values.yaml#L1064) | string | `"IfNotPresent"` | Config watcher image pull policy. | -| [plugins](./values.yaml#L1067) | object | `{"cacheDir":"/tmp","repositories":{"botkube":{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}}}` | Configuration for Botkube executors and sources plugins. | -| [plugins.cacheDir](./values.yaml#L1069) | string | `"/tmp"` | Directory, where downloaded plugins are cached. | -| [plugins.repositories](./values.yaml#L1071) | object | `{"botkube":{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}}` | List of plugins repositories. | -| [plugins.repositories.botkube](./values.yaml#L1073) | object | `{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}` | This repository serves officially supported Botkube plugins. | -| [config](./values.yaml#L1077) | object | `{"provider":{"apiKey":"","endpoint":"https://api.botkube.io/graphql","identifier":""}}` | Configuration for synchronizing Botkube configuration. | -| [config.provider](./values.yaml#L1079) | object | `{"apiKey":"","endpoint":"https://api.botkube.io/graphql","identifier":""}` | Base provider definition. | -| [config.provider.identifier](./values.yaml#L1082) | string | `""` | Unique identifier for remote Botkube settings. If set to an empty string, Botkube won't fetch remote configuration. | -| [config.provider.endpoint](./values.yaml#L1084) | string | `"https://api.botkube.io/graphql"` | Endpoint to fetch Botkube settings from. | -| [config.provider.apiKey](./values.yaml#L1086) | string | `""` | Key passed as a `X-API-Key` header to the provider's endpoint. | +| [existingCommunicationsSecretName](./values.yaml#L616) | string | `""` | Configures existing Secret with communication settings. It MUST be in the `botkube` Namespace. To reload Botkube once it changes, add label `botkube.io/config-watch: "true"`. | +| [communications](./values.yaml#L623) | object | See the `values.yaml` file for full object. | Map of communication groups. Communication group contains settings for multiple communication platforms. The property name under `communications` object is an alias for a given configuration group. You can define multiple communication groups with different names. | +| [communications.default-group.socketSlack.enabled](./values.yaml#L628) | bool | `false` | If true, enables Slack bot. | +| [communications.default-group.socketSlack.channels](./values.yaml#L632) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"name":"SLACK_CHANNEL"}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | +| [communications.default-group.socketSlack.channels.default.name](./values.yaml#L635) | string | `"SLACK_CHANNEL"` | Slack channel name without '#' prefix where you have added Botkube and want to receive notifications in. | +| [communications.default-group.socketSlack.channels.default.bindings.executors](./values.yaml#L638) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | +| [communications.default-group.socketSlack.channels.default.bindings.sources](./values.yaml#L643) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | +| [communications.default-group.socketSlack.botToken](./values.yaml#L649) | string | `""` | Slack bot token for your own Slack app. [Ref doc](https://api.slack.com/authentication/token-types). | +| [communications.default-group.socketSlack.appToken](./values.yaml#L652) | string | `""` | Slack app-level token for your own Slack app. [Ref doc](https://api.slack.com/authentication/token-types). | +| [communications.default-group.mattermost.enabled](./values.yaml#L656) | bool | `false` | If true, enables Mattermost bot. | +| [communications.default-group.mattermost.botName](./values.yaml#L658) | string | `"Botkube"` | User in Mattermost which belongs the specified Personal Access token. | +| [communications.default-group.mattermost.url](./values.yaml#L660) | string | `"MATTERMOST_SERVER_URL"` | The URL (including http/https schema) where Mattermost is running. e.g https://example.com:9243 | +| [communications.default-group.mattermost.token](./values.yaml#L662) | string | `"MATTERMOST_TOKEN"` | Personal Access token generated by Botkube user. | +| [communications.default-group.mattermost.team](./values.yaml#L664) | string | `"MATTERMOST_TEAM"` | The Mattermost Team name where Botkube is added. | +| [communications.default-group.mattermost.channels](./values.yaml#L668) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"name":"MATTERMOST_CHANNEL","notification":{"disabled":false}}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | +| [communications.default-group.mattermost.channels.default.name](./values.yaml#L672) | string | `"MATTERMOST_CHANNEL"` | The Mattermost channel name for receiving Botkube alerts. The Botkube user needs to be added to it. | +| [communications.default-group.mattermost.channels.default.notification.disabled](./values.yaml#L675) | bool | `false` | If true, the notifications are not sent to the channel. They can be enabled with `@Botkube` command anytime. | +| [communications.default-group.mattermost.channels.default.bindings.executors](./values.yaml#L678) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | +| [communications.default-group.mattermost.channels.default.bindings.sources](./values.yaml#L683) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | +| [communications.default-group.teams.enabled](./values.yaml#L691) | bool | `false` | If true, enables MS Teams bot. | +| [communications.default-group.teams.botName](./values.yaml#L693) | string | `"Botkube"` | The Bot name set while registering Bot to MS Teams. | +| [communications.default-group.teams.appID](./values.yaml#L695) | string | `"APPLICATION_ID"` | The Botkube application ID generated while registering Bot to MS Teams. | +| [communications.default-group.teams.appPassword](./values.yaml#L697) | string | `"APPLICATION_PASSWORD"` | The Botkube application password generated while registering Bot to MS Teams. | +| [communications.default-group.teams.bindings.executors](./values.yaml#L700) | list | `["k8s-default-tools","bins-management","ai"]` | Executor bindings apply to all MS Teams channels where Botkube has access to. | +| [communications.default-group.teams.bindings.sources](./values.yaml#L705) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Source bindings apply to all channels which have notification turned on with `@Botkube enable notifications` command. | +| [communications.default-group.teams.messagePath](./values.yaml#L710) | string | `"/bots/teams"` | The path in endpoint URL provided while registering Botkube to MS Teams. | +| [communications.default-group.teams.port](./values.yaml#L712) | int | `3978` | The Service port for bot endpoint on Botkube container. | +| [communications.default-group.discord.enabled](./values.yaml#L717) | bool | `false` | If true, enables Discord bot. | +| [communications.default-group.discord.token](./values.yaml#L719) | string | `"DISCORD_TOKEN"` | Botkube Bot Token. | +| [communications.default-group.discord.botID](./values.yaml#L721) | string | `"DISCORD_BOT_ID"` | Botkube Application Client ID. | +| [communications.default-group.discord.channels](./values.yaml#L725) | object | `{"default":{"bindings":{"executors":["k8s-default-tools","bins-management","ai"],"sources":["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]},"id":"DISCORD_CHANNEL_ID","notification":{"disabled":false}}}` | Map of configured channels. The property name under `channels` object is an alias for a given configuration. | +| [communications.default-group.discord.channels.default.id](./values.yaml#L729) | string | `"DISCORD_CHANNEL_ID"` | Discord channel ID for receiving Botkube alerts. The Botkube user needs to be added to it. | +| [communications.default-group.discord.channels.default.notification.disabled](./values.yaml#L732) | bool | `false` | If true, the notifications are not sent to the channel. They can be enabled with `@Botkube` command anytime. | +| [communications.default-group.discord.channels.default.bindings.executors](./values.yaml#L735) | list | `["k8s-default-tools","bins-management","ai"]` | Executors configuration for a given channel. | +| [communications.default-group.discord.channels.default.bindings.sources](./values.yaml#L740) | list | `["k8s-err-events","k8s-recommendation-events","k8s-err-events-with-ai-support"]` | Notification sources configuration for a given channel. | +| [communications.default-group.elasticsearch.enabled](./values.yaml#L748) | bool | `false` | If true, enables Elasticsearch. | +| [communications.default-group.elasticsearch.awsSigning.enabled](./values.yaml#L752) | bool | `false` | If true, enables awsSigning using IAM for Elasticsearch hosted on AWS. Make sure AWS environment variables are set. [Ref doc](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html). | +| [communications.default-group.elasticsearch.awsSigning.awsRegion](./values.yaml#L754) | string | `"us-east-1"` | AWS region where Elasticsearch is deployed. | +| [communications.default-group.elasticsearch.awsSigning.roleArn](./values.yaml#L756) | string | `""` | AWS IAM Role arn to assume for credentials, use this only if you don't want to use the EC2 instance role or not running on AWS instance. | +| [communications.default-group.elasticsearch.server](./values.yaml#L758) | string | `"ELASTICSEARCH_ADDRESS"` | The server URL, e.g https://example.com:9243 | +| [communications.default-group.elasticsearch.username](./values.yaml#L760) | string | `"ELASTICSEARCH_USERNAME"` | Basic Auth username. | +| [communications.default-group.elasticsearch.password](./values.yaml#L762) | string | `"ELASTICSEARCH_PASSWORD"` | Basic Auth password. | +| [communications.default-group.elasticsearch.skipTLSVerify](./values.yaml#L765) | bool | `false` | If true, skips the verification of TLS certificate of the Elastic nodes. It's useful for clusters with self-signed certificates. | +| [communications.default-group.elasticsearch.indices](./values.yaml#L769) | object | `{"default":{"bindings":{"sources":["k8s-err-events","k8s-recommendation-events"]},"name":"botkube","replicas":0,"shards":1,"type":"botkube-event"}}` | Map of configured indices. The `indices` property name is an alias for a given configuration. | +| [communications.default-group.elasticsearch.indices.default.name](./values.yaml#L772) | string | `"botkube"` | Configures Elasticsearch index settings. | +| [communications.default-group.elasticsearch.indices.default.bindings.sources](./values.yaml#L778) | list | `["k8s-err-events","k8s-recommendation-events"]` | Notification sources configuration for a given index. | +| [communications.default-group.webhook.enabled](./values.yaml#L785) | bool | `false` | If true, enables Webhook. | +| [communications.default-group.webhook.url](./values.yaml#L787) | string | `"WEBHOOK_URL"` | The Webhook URL, e.g.: https://example.com:80 | +| [communications.default-group.webhook.bindings.sources](./values.yaml#L790) | list | `["k8s-err-events","k8s-recommendation-events"]` | Notification sources configuration for the webhook. | +| [communications.default-group.slack](./values.yaml#L800) | object | See the `values.yaml` file for full object. | Settings for deprecated Slack integration. **DEPRECATED:** Legacy Slack integration has been deprecated and removed from the Slack App Directory. Use `socketSlack` instead. Read more here: https://docs.botkube.io/installation/slack/ | +| [settings.clusterName](./values.yaml#L818) | string | `"not-configured"` | Cluster name to differentiate incoming messages. | +| [settings.lifecycleServer](./values.yaml#L821) | object | `{"enabled":true,"port":2113}` | Server configuration which exposes functionality related to the app lifecycle. | +| [settings.healthPort](./values.yaml#L824) | int | `2114` | | +| [settings.upgradeNotifier](./values.yaml#L826) | bool | `true` | If true, notifies about new Botkube releases. | +| [settings.log.level](./values.yaml#L830) | string | `"info"` | Sets one of the log levels. Allowed values: `info`, `warn`, `debug`, `error`, `fatal`, `panic`. | +| [settings.log.disableColors](./values.yaml#L832) | bool | `false` | If true, disable ANSI colors in logging. | +| [settings.systemConfigMap](./values.yaml#L835) | object | `{"name":"botkube-system"}` | Botkube's system ConfigMap where internal data is stored. | +| [settings.persistentConfig](./values.yaml#L840) | object | `{"runtime":{"configMap":{"annotations":{},"name":"botkube-runtime-config"},"fileName":"_runtime_state.yaml"},"startup":{"configMap":{"annotations":{},"name":"botkube-startup-config"},"fileName":"_startup_state.yaml"}}` | Persistent config contains ConfigMap where persisted configuration is stored. The persistent configuration is evaluated from both chart upgrade and Botkube commands used in runtime. | +| [ssl.enabled](./values.yaml#L855) | bool | `false` | If true, specify cert path in `config.ssl.cert` property or K8s Secret in `config.ssl.existingSecretName`. | +| [ssl.existingSecretName](./values.yaml#L861) | string | `""` | Using existing SSL Secret. It MUST be in `botkube` Namespace. | +| [ssl.cert](./values.yaml#L864) | string | `""` | SSL Certificate file e.g certs/my-cert.crt. | +| [service](./values.yaml#L867) | object | `{"name":"metrics","port":2112,"targetPort":2112}` | Configures Service settings for ServiceMonitor CR. | +| [ingress](./values.yaml#L874) | object | `{"annotations":{"kubernetes.io/ingress.class":"nginx"},"create":false,"host":"HOST","tls":{"enabled":false,"secretName":""}}` | Configures Ingress settings that exposes MS Teams endpoint. [Ref doc](https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource). | +| [serviceMonitor](./values.yaml#L885) | object | `{"enabled":false,"interval":"10s","labels":{},"path":"/metrics","port":"metrics"}` | Configures ServiceMonitor settings. [Ref doc](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitor). | +| [deployment.annotations](./values.yaml#L895) | object | `{}` | Extra annotations to pass to the Botkube Deployment. | +| [deployment.livenessProbe](./values.yaml#L897) | object | `{"failureThreshold":5,"initialDelaySeconds":1,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":1}` | Liveness probe. | +| [deployment.livenessProbe.initialDelaySeconds](./values.yaml#L899) | int | `1` | The liveness probe initial delay seconds. | +| [deployment.livenessProbe.periodSeconds](./values.yaml#L901) | int | `15` | The liveness probe period seconds. | +| [deployment.livenessProbe.timeoutSeconds](./values.yaml#L903) | int | `1` | The liveness probe timeout seconds. | +| [deployment.livenessProbe.failureThreshold](./values.yaml#L905) | int | `5` | The liveness probe failure threshold. | +| [deployment.livenessProbe.successThreshold](./values.yaml#L907) | int | `1` | The liveness probe success threshold. | +| [deployment.readinessProbe](./values.yaml#L910) | object | `{"failureThreshold":5,"initialDelaySeconds":1,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":1}` | Readiness probe. | +| [deployment.readinessProbe.initialDelaySeconds](./values.yaml#L912) | int | `1` | The readiness probe initial delay seconds. | +| [deployment.readinessProbe.periodSeconds](./values.yaml#L914) | int | `15` | The readiness probe period seconds. | +| [deployment.readinessProbe.timeoutSeconds](./values.yaml#L916) | int | `1` | The readiness probe timeout seconds. | +| [deployment.readinessProbe.failureThreshold](./values.yaml#L918) | int | `5` | The readiness probe failure threshold. | +| [deployment.readinessProbe.successThreshold](./values.yaml#L920) | int | `1` | The readiness probe success threshold. | +| [extraAnnotations](./values.yaml#L927) | object | `{}` | Extra annotations to pass to the Botkube Pod. | +| [extraLabels](./values.yaml#L929) | object | `{}` | Extra labels to pass to the Botkube Pod. | +| [priorityClassName](./values.yaml#L931) | string | `""` | Priority class name for the Botkube Pod. | +| [nameOverride](./values.yaml#L934) | string | `""` | Fully override "botkube.name" template. | +| [fullnameOverride](./values.yaml#L936) | string | `""` | Fully override "botkube.fullname" template. | +| [resources](./values.yaml#L942) | object | `{}` | The Botkube Pod resource request and limits. We usually recommend not to specify default resources and to leave this as a conscious choice for the user. This also increases chances charts run on environments with little resources, such as Minikube. [Ref docs](https://kubernetes.io/docs/user-guide/compute-resources/) | +| [extraEnv](./values.yaml#L954) | list | `[{"name":"LOG_LEVEL_SOURCE_BOTKUBE_KUBERNETES","value":"debug"}]` | Extra environment variables to pass to the Botkube container. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#environment-variables). | +| [extraVolumes](./values.yaml#L968) | list | `[]` | Extra volumes to pass to the Botkube container. Mount it later with extraVolumeMounts. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/volume/#Volume). | +| [extraVolumeMounts](./values.yaml#L983) | list | `[]` | Extra volume mounts to pass to the Botkube container. [Ref docs](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#volumes-1). | +| [nodeSelector](./values.yaml#L1001) | object | `{}` | Node labels for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/user-guide/node-selection/). | +| [tolerations](./values.yaml#L1005) | list | `[]` | Tolerations for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/). | +| [affinity](./values.yaml#L1009) | object | `{}` | Affinity for Botkube Pod assignment. [Ref doc](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity). | +| [serviceAccount.create](./values.yaml#L1013) | bool | `true` | If true, a ServiceAccount is automatically created. | +| [serviceAccount.name](./values.yaml#L1016) | string | `""` | The name of the service account to use. If not set, a name is generated using the fullname template. | +| [serviceAccount.annotations](./values.yaml#L1018) | object | `{}` | Extra annotations for the ServiceAccount. | +| [extraObjects](./values.yaml#L1021) | list | `[]` | Extra Kubernetes resources to create. Helm templating is allowed as it is evaluated before creating the resources. | +| [analytics.disable](./values.yaml#L1049) | bool | `false` | If true, sending anonymous analytics is disabled. To learn what date we collect, see [Privacy Policy](https://docs.botkube.io/privacy#privacy-policy). | +| [configWatcher.enabled](./values.yaml#L1054) | bool | `true` | If true, restarts the Botkube Pod on config changes. | +| [configWatcher.tmpDir](./values.yaml#L1056) | string | `"/tmp/watched-cfg/"` | Directory, where watched configuration resources are stored. | +| [configWatcher.initialSyncTimeout](./values.yaml#L1059) | int | `0` | Timeout for the initial Config Watcher sync. If set to 0, waiting for Config Watcher sync will be skipped. In a result, configuration changes may not reload Botkube app during the first few seconds after Botkube startup. | +| [configWatcher.image.registry](./values.yaml#L1062) | string | `"ghcr.io"` | Config watcher image registry. | +| [configWatcher.image.repository](./values.yaml#L1064) | string | `"kubeshop/k8s-sidecar"` | Config watcher image repository. | +| [configWatcher.image.tag](./values.yaml#L1066) | string | `"in-cluster-config"` | Config watcher image tag. | +| [configWatcher.image.pullPolicy](./values.yaml#L1068) | string | `"IfNotPresent"` | Config watcher image pull policy. | +| [plugins](./values.yaml#L1071) | object | `{"cacheDir":"/tmp","repositories":{"botkube":{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}}}` | Configuration for Botkube executors and sources plugins. | +| [plugins.cacheDir](./values.yaml#L1073) | string | `"/tmp"` | Directory, where downloaded plugins are cached. | +| [plugins.repositories](./values.yaml#L1075) | object | `{"botkube":{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}}` | List of plugins repositories. | +| [plugins.repositories.botkube](./values.yaml#L1077) | object | `{"url":"https://storage.googleapis.com/botkube-plugins-latest/plugins-index.yaml"}` | This repository serves officially supported Botkube plugins. | +| [config](./values.yaml#L1081) | object | `{"provider":{"apiKey":"","endpoint":"https://api.botkube.io/graphql","identifier":""}}` | Configuration for synchronizing Botkube configuration. | +| [config.provider](./values.yaml#L1083) | object | `{"apiKey":"","endpoint":"https://api.botkube.io/graphql","identifier":""}` | Base provider definition. | +| [config.provider.identifier](./values.yaml#L1086) | string | `""` | Unique identifier for remote Botkube settings. If set to an empty string, Botkube won't fetch remote configuration. | +| [config.provider.endpoint](./values.yaml#L1088) | string | `"https://api.botkube.io/graphql"` | Endpoint to fetch Botkube settings from. | +| [config.provider.apiKey](./values.yaml#L1090) | string | `""` | Key passed as a `X-API-Key` header to the provider's endpoint. | ### AWS IRSA on EKS support diff --git a/helm/botkube/values.yaml b/helm/botkube/values.yaml index afc5d8fb6..36fa176ae 100644 --- a/helm/botkube/values.yaml +++ b/helm/botkube/values.yaml @@ -596,6 +596,10 @@ aliases: chatgpt: command: doctor displayName: "Doctor alias" + x: + command: exec + displayName: "Exec alias" + ## Multi-word alias example: # kgp: # command: kubectl get pods diff --git a/internal/executor/x/cmd_parse_test.go b/internal/executor/x/cmd_parse_test.go index bc7ed9cd9..b5a8bdda3 100644 --- a/internal/executor/x/cmd_parse_test.go +++ b/internal/executor/x/cmd_parse_test.go @@ -33,11 +33,11 @@ func TestParse(t *testing.T) { }, }, { - input: "exec run kubectl get pods @idx:abc", + input: "exec run kubectl get pods @idx:abc @page:12", expected: Command{ ToExecute: "exec run kubectl get pods @idx:abc", IsRawRequired: false, - PageIndex: 1, + PageIndex: 12, }, }, } @@ -49,6 +49,7 @@ func TestParse(t *testing.T) { assert.Equal(t, tc.expected.ToExecute, gotCmd.ToExecute) assert.Equal(t, tc.expected.IsRawRequired, gotCmd.IsRawRequired) + assert.Equal(t, tc.expected.PageIndex, gotCmd.PageIndex) }) } }