##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
This fixes a panic when running a command with an allowed verb but without a resource. For example: `@Botkube get`.
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
* Allow skipping certs validation of Elastic
Allow user to skip certificate validation when connecting to the
Elasticsearch cluster (opt-in). It permits to use botkube with clusters
that don't have certificates signed by a CA that is trusted by the
botkube image, it often happens with clusters that are for internal use
only.
See #485
Co-Authored-By: Carmine Di Monaco <carmine.dimonaco@computer.org>
* Update go.sum
* Add the default value of skipTLSVerify in deploy manifests
Co-authored-by: David Costa <david@zarel.net>
* Add skipTLSVerify elasticsearch option to helm chart
Co-authored-by: David Costa <david@zarel.net>
* Bool instead of boolean in helm chart docs for skipTLSVerify elastic
Co-authored-by: David Costa <david@zarel.net>
Co-authored-by: Carmine Di Monaco <carmine.dimonaco@computer.org>
Co-authored-by: Carmine Di Monaco <carmine.dimonaco@gmail.com>
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Docs Pull Request
##### SUMMARY
We wanted to add `updateSetting` for an annotation from the Kubernetes Apps SIG. This annotation contains dots and slashes. I wasn't sure which field to use, so I've updated the test to make it very clear that it requires the syntax of number 1:
1. `metadata.annotations.app\.kubernetes\.io\/version`
2. `metadata.annotations["app.kubernetes.io/version"]`
<!--- Please list dependencies added with your change also -->
Fixes #XXX
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
Allow Configuration of Mattermost user and fixes BUG with getUser() if its not the "BotKube" default user.
Fixes#245
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Capability to fetch AWS credentials from the EKS OIDC provider
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes#462
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
When clustername is passed to botkube from command and if that clustername contains valid domain then slack automatically adds <http:// to the url
eg.
if command is `@BotKube get pods --cluster-name xyz.alpha-sense.org` then in botkube we get cluster name as `<http://xyz.alpha-sense.org|xyz.alpha-sense.org>`
#### Solution:
Added small logic in executor code to remove the unwanted string
Fixes https://github.com/infracloudio/botkube/issues/460
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Resolved issue of DefaultNamespace value is not getting populated in config and appending default namespace if another namespace is already passed
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
Apparently the wrong member was used to check the resource name. I don't
know how resillient this patch is, but it works for most of the part.
<!--- Please list dependencies added with your change also -->
Fixes#419
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Elasticsearch Indices will be created with timestamp suffix
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
The empty command `@BotKube` is managed in the executor.go file for having a identic behaviour on all intergrations but the Slack bot is handling it differently.
So I proposed a cleanup in this PR.
##### ISSUE TYPE
- Feature Pull Request
##### SUMMARY
adding support for botkube to interact in slack threads
I did update the test bash script that would not run on my zsh shell on my mac.
I Also wanted to add some unit tests but the Slack test server does not support thread messages.
Fixes#422
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Docs Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Corrected spelling mistakes in documentation comments, changed cases for references to BotKube for consistency across docs, and added code markdown to kubectl reference for consistency
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
Added skip delete event test case that should be skipped if event occurred for a resource which is not added in test configuration.
Modified AllowedEventKindsMap to removed the v1/services resource
<!--- Please list dependencies added with your change also -->
Fixes test case - Validate that delete events are skipped when an event occurs for a resource which is not added in resource_config of issue #354
This Commit,
- Adds Debug logs to slack and matter most bot to log the valid request sent to the bot and the corresponding responses generated.
- removes the logging to all events, to avoid capture of sensitive data.
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Created this as a separate PR, as it not connected with Discord Integration.
added these features there as well.
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
#### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
**Add support for Discord:**
This PR,
- adds discord bot
- adds discord notifier
- adds required discord configurations into comm_config.yaml
- adds discordgo module into go.mod
- adds discord configs into all yaml files
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes#97
### Steps For Creation and Integration:
1. Reach https://discordapp.com/developers/applications
2. Create New Application named Botkube and add a bot named **Botkube** into the Application
3. Copy the Application **CLIENT ID** and place it under _Dischord.botid_ in comm-config.yaml
4. Copy Bot **TOKEN** and place it under _Dischord.token_ in comm-config.yaml
5. Generate the URL with suitable permissions using the OAuth2 URL Generator available under OAuth2 section to the add bot to your Discord server
```
https://discordapp.com/oauth2/authorize?&client_id=<YOUR_CLIENT_ID>&scope=bot&permissions=<SET_OF_PERMISSIONS>
```
6. Paste the generated URL in a new tab, select the discord sever to which you want to add the bot and Authorise Bot addition.
7. Create a new channel and/or copy the **CHANNEL ID** of an existing one that you want to use and place it under _Dischord.channel_
```yaml
# Settings for Discord
discord:
enabled: true
token: 'DISCORD_TOKEN' # BotKube Bot Token
botid: 'DISCORD_BOT_ID' # BotKube Application Client ID
channel: 'DISCORD_CHANNEL_ID' # Discord Channel id for receiving BotKube alerts
notiftype: short # Change notification type short/long you want to receive. notiftype is optional and Default notification type is short (if not specified)
```
#### Note: Follow the first 4 mins of this [Video Tutorial](https://youtu.be/8o25pRbXdFw) to understand the process visually.
### Preview:
![ping](https://user-images.githubusercontent.com/30741615/80600577-3931cf00-8a4a-11ea-9215-a725a0b17256.png)
![pod-create-short](https://user-images.githubusercontent.com/30741615/80600638-55357080-8a4a-11ea-976f-b91e823c93bd.png)
![pod-error-long](https://user-images.githubusercontent.com/30741615/80600803-8dd54a00-8a4a-11ea-90e4-a205e93aba5f.png)
![file-attachment](https://user-images.githubusercontent.com/30741615/80600724-75fdc600-8a4a-11ea-9b10-1b5ac0e79548.png)
This Commit,
- Fixes build failure due to e2e tests
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes#384
Fixes issue #295
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
This change allows to ignore whole sets of namespaces using the asterix expansion. It still does the exact match check for all the namespaces (separated by comma in config), but if it contains a `*`, it's actually replaced with `.*` and passed to `regexp.MatchString` to do the job.
PR also contains couple of very simple test cases.
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
deps:
`namespace_checker.go` now imports also `regexp`
Fixes#295
It's my very first golang code, so please let me know if it's not idiomatic go 🍪
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Added tests for Update Events, here added a pod and then updated its specifications to verify the updated message in the generated event. Also, the diff method is verified for the updated change
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Modification : Changed resource_config.yaml for Integration Testing, Added update Event for POD
Fixes part of #341
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
Jsonpath eval fails if fields are not set in old obj by the time event issued. Ignore error in that case and continue message construction
Signed-off-by: Rahul M Chheda <rchheda@infracloud.io>
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Bug fix Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes#333
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
- Bug fix Pull Request
- Docs Pull Request
Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
- Added creation of Dynamic ClientSet
- Replaced the current k8s resources to DynamicInformer
- Added logic to create metav1.ObjectMeta/ metav1.TypeMeta from obj interface{}
- Added GKE auth pkg
- Modified fns to get ObjectMeta, and ObjectTypeMeta
- Added function to create *coreV1.Event from the obj interface{}
- Improved switch case for event.New()
- Added for loop to create informer
- Changed Name for fn GetAnnotaion to GetAnnotationFromEvent
- Changed Parsing Logic for GCR (using '/')
- Added logic in FilterEngine, to get the appropriate data
- Full deprecate kubeClient init
- Added logic to fetch resources from DynamicKubeClient
- Added a fn to transform a object form ibj interface{}
- Added REST Mapper to map all resources present on the cluster
- Declared this REST Mapper as global for further use
- Removed logic to filter out the Kubernetes resources according to Involved Object kind
- Removed constants from utils.go
In the latest commit:
- To pass the e2e tests, just replaced all kubernetes resources informer, with dynamic informer.
- Unable to pass the e2e test suite (will paste the error in the comments.)
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes https://github.com/infracloudio/botkube/issues/200
##### ISSUE TYPE
- Feature Pull Request
##### SUMMARY
Added new botkube command to list all the supported commands, @botkube commands list
Below are the changes
made changes in executor.go to handle newly added command
added common method in utils.go to format the allowed commands
Fixes https://github.com/infracloudio/botkube/issues/312
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
This should fix panic on empty command.
Bot will send the default message for the executor Platform (in my case its mattermost)
##### What did you do?
Sent empty command to botkube via mattermost (type @botkube)
##### What did you expect to see?
> Command not supported. Please run /botkubehelp to see supported commands.
or at least nothing
##### What did you see?
`panic: runtime error: index out of range [0] with length 0
goroutine 28 [running]:
github.com/infracloudio/botkube/pkg/execute.(*DefaultExecutor).Execute(0xc000a11020, 0x0, 0x0)
go/src/github.com/gohumble/botkube/pkg/execute/executor.go:191 +0xe13
github.com/infracloudio/botkube/pkg/bot.(*mattermostMessage).handleMessage(0xc000b75de8, 0xc0003d1940, 0x1a, 0xc00046b7c0, 0x5, 0xc00046b7cc, 0x4, 0xc00046b120, 0xd, 0x1, ...)
go/src/github.com/gohumble/botkube/pkg/bot/mattermost.go:154 +0x54e
github.com/infracloudio/botkube/pkg/bot.MMBot.listen(0xc0003d1940, 0x1a, 0xc00046b7c0, 0x5, 0xc00046b7cc, 0x4, 0xc00046b120, 0xd, 0x1, 0xc0003d1880, ...)
go/src/github.com/gohumble/botkube/pkg/bot/mattermost.go:253 +0x4d1
github.com/infracloudio/botkube/pkg/bot.(*MMBot).Start.func1(0xc00058f4d0)
go/src/github.com/gohumble/botkube/pkg/bot/mattermost.go:125 +0x2c7
created by github.com/infracloudio/botkube/pkg/bot.(*MMBot).Start
src/github.com/gohumble/botkube/pkg/bot/mattermost.go:113 +0x712
Exiting.`
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
- Add support for Microsoft Teams
- Multicluster support not available yet for Teams
Integration tests will be addressed with a separate issue. Blocked by https://github.com/infracloudio/msbotbuilder-go/issues/46Fixes#60
##### ISSUE TYPE
- Feature Pull Request
##### SUMMARY
In the notifier, we send events by creating a new connection to the communication medium on every new event. We can reduce the number of connections by sending messages via the Bot interface.
Fixes#270
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Allow using AWS role or EC2 Instance role to generate session tokens for AWS credentials.
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
Allows user to specify if Elasticsearch is hosted on AWS
- configuration fields have been added to specify if Elasticsearch is hosted on AWS
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
Includes feature which would allow botkube to send Kubernetes events to Elasticsearch hosted on AWS
* Uses AWS V4 signature to sign the http request
* Uses environment variables to pick AWS configurations
Secondly creates new index per day with index name suffixed as -DD-MM-YYYY
<!--- Please list dependencies added with your change also -->
Fixes#299Fixes#283
##### ISSUE TYPE
- Bug fix Pull Request
##### SUMMARY
Default executor is expecting more than 2 arguments.
Fixed number of arguments needed to 1.
Fixes#300
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
Added configuration in resource_config.yaml for limiting kubectl commands as per the discussion given in ticket 183
The configuration added is used in
slack.go and mattermost.go to pass it to executor.go and used to limit the commands execution
Fixes#183
##### ISSUE TYPE
- Refactor Pull Request (#262)
##### SUMMARY
Refactor logging package to make log statements simpler. Current format logging.Logger.Info() doesn't look good. We can embed Logrus into pkg/log to import and use it as log.Info()
Fixes #
- Embed Logrus into pkg/log
- Update the reference to new log package
- Change the reference everywhere form
`logging.Logger.Function() --> log.Function()`
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
Refactor notifier and bot to pass config
Simplify ElasticSearch client creation
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
- Feature Pull Request
##### SUMMARY
<!--- Describe the change, including rationale and design decisions -->
This Commit,
- Adds `kubectl.Enabled`, `Kubectl.DefaultNamespace` to `Config.Settings` to configure default namespace, under which all botkube kubectl commands will be executed by default.
- changes `Settings.RestrictAccess` into `Settings. Kubectl.RestrictAccess`
- updates all config.yaml files
<!---
If you are fixing an existing issue, please include "Fixes #nnn" in your
PR comment; and describe briefly what the change does.
-->
<!--- Please list dependencies added with your change also -->
Fixes#176
**Preview**:
```yaml
settings:
# Kubectl executor configs
kubectl:
# Set true to enable kubectl commands execution
enabled: false
# set Namespace to execute botkube kubectl commands by default
defaultNamespace: default
# Set true to enable commands execution from configured channel only
restrictAccess: false
```
##### ISSUE TYPE
- Feature Pull Request
##### SUMMARY
Enable auto merge using Mergify on approval
Workflow:
- Developer opens a PR
- Reviewer approves the changes and adds `ready-to-merge` label
- Mergify runs CI again and merges the PR
- Mergify holds the auto merge if `hold-off-merging` label is set