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

adding feature to support AWS Signing and creating new index per day #302

Merged
merged 6 commits into from
Jul 1, 2020

Conversation

kartik-moolya
Copy link
Contributor

ISSUE TYPE
  • Feature Pull Request
SUMMARY

Allows user to specify if Elasticsearch is hosted on AWS

  • configuration fields have been added to specify if Elasticsearch is hosted on AWS

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

Fixes #299
Fixes #283

comm_config.yaml Outdated
awsRegion: "us-east-1" # AWS region where Elasticsearch is deployed
awsAccessKey: ""
awsSecretKey: ""
server: "" # e.g https://example.com:9243
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
server: "" # e.g https://example.com:9243
server: 'ELASTICSEARCH_ADDRESS' # e.g https://example.com:9243

Name string
Type string
Shards int
Replicas int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run go fmt. I don't think this change is required

pkg/notify/elasticsearch.go Show resolved Hide resolved
awsClient, err := aws_signing_client.New(
signer,
nil,
"es",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "es"? Please declare it as a const.

// Get credentials from environment variables and create the AWS Signature Version 4 signer
creds := credentials.NewEnvCredentials()
signer := v4.NewSigner(creds)
awsClient, err := aws_signing_client.New(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the function params in single line. It easier to read that way

@@ -78,7 +121,7 @@ func (e *ElasticSearch) SendEvent(event events.Event) (err error) {
event.Cluster = e.ClusterName

// Create index if not exists
exists, err := e.ELSClient.IndexExists(e.Index).Do(ctx)
exists, err := e.ELSClient.IndexExists(e.Index + "-" + time.Now().Format("02-01-2006")).Do(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please declare format string as a const and use that

@PrasadG193
Copy link
Collaborator

@kartik-moolya Please run hack/verify-gofmt.sh and hack/update-gofmt.sh to verify and fix gofmt issues.

@ghost ghost force-pushed the feature/support-aws-signing-for-es branch from 5f5073b to 65af86f Compare June 30, 2020 14:24
pkg/notify/elasticsearch.go Outdated Show resolved Hide resolved
pkg/notify/elasticsearch.go Outdated Show resolved Hide resolved
@PrasadG193
Copy link
Collaborator

Please fix the gofmt issues.

@ghost ghost force-pushed the feature/support-aws-signing-for-es branch from e63e711 to cf3beff Compare July 1, 2020 06:45
@mergify mergify bot merged commit 5749185 into develop Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants