Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
aa43057
update integration to 1.1.1
ofiriro3 Feb 7, 2023
8163f42
Adding only elastic stack
ofiriro3 Feb 7, 2023
212965d
update working directory
ofiriro3 Feb 7, 2023
061b309
update working directory
ofiriro3 Feb 7, 2023
4bb7688
adding the ec provider
ofiriro3 Feb 7, 2023
050aeb7
Fixing gitignore files + adding github actions that uses the new bash…
ofiriro3 Feb 12, 2023
d6b9978
Moving scripts to the weekly directory
ofiriro3 Feb 12, 2023
b06001e
Updating executing permissions
ofiriro3 Feb 12, 2023
e615ee6
Update local variable to lower_case
ofiriro3 Feb 12, 2023
cf80da8
updating path
ofiriro3 Feb 12, 2023
bfc4c0a
Updating path
ofiriro3 Feb 12, 2023
4c18e6d
Fixing path
ofiriro3 Feb 12, 2023
5a78456
Updating to full path
ofiriro3 Feb 12, 2023
e3ad992
Updating to full path
ofiriro3 Feb 12, 2023
fc81e64
Updating CI to full path
ofiriro3 Feb 12, 2023
18fd270
using variable
ofiriro3 Feb 12, 2023
7c324e6
using variable
ofiriro3 Feb 12, 2023
bfe4eb3
flow without agent deployment
ofiriro3 Feb 12, 2023
f781ffb
Fixing integration
ofiriro3 Feb 12, 2023
2b6346a
Update CI to full E2E
ofiriro3 Feb 12, 2023
6c18d50
Fixing show manifest file step
ofiriro3 Feb 12, 2023
48050c6
update ci
ofiriro3 Feb 12, 2023
2e63a33
Deploy yaml file
ofiriro3 Feb 12, 2023
ae06992
Another try
ofiriro3 Feb 12, 2023
52b55ac
updating deployment file
ofiriro3 Feb 12, 2023
9adc67c
Remove image replacement
ofiriro3 Feb 12, 2023
a14ad1d
Remove secret echo to file
ofiriro3 Feb 13, 2023
1006b22
Trying to solve ssh issue
ofiriro3 Feb 13, 2023
d0b9bc7
Trying to solve ssh issue
ofiriro3 Feb 13, 2023
d71688f
Adding the entire flow
ofiriro3 Feb 13, 2023
4ab1da7
Comment out terraform
ofiriro3 Feb 13, 2023
e821839
Remove echo
ofiriro3 Feb 13, 2023
93ef663
Strict host checking false
ofiriro3 Feb 13, 2023
1c0e323
Trying to use package for copy the file
ofiriro3 Feb 13, 2023
b4ebb27
Remove working directory
ofiriro3 Feb 13, 2023
7c85402
Remove working directory
ofiriro3 Feb 13, 2023
8f99aee
Update scp use
ofiriro3 Feb 13, 2023
7987fcc
Update scp use
ofiriro3 Feb 13, 2023
fa40cdf
Fixing Ci
ofiriro3 Feb 13, 2023
8e5e4ae
Fixing Ci
ofiriro3 Feb 13, 2023
af3a2a5
Remove package
ofiriro3 Feb 13, 2023
39e9f59
Updating ssh command
ofiriro3 Feb 13, 2023
394bb47
Only echo the ssh key
ofiriro3 Feb 13, 2023
0ce7e07
Print only head
ofiriro3 Feb 13, 2023
6674a35
Comment out slack
ofiriro3 Feb 13, 2023
c94464f
adding ll
ofiriro3 Feb 13, 2023
3d784c1
adding ls
ofiriro3 Feb 13, 2023
52e28a1
adding ssh command
ofiriro3 Feb 13, 2023
cef93c4
Fixing script
ofiriro3 Feb 13, 2023
9b0896e
Changing permissions
ofiriro3 Feb 13, 2023
fcf35f2
change file to pem suffix
ofiriro3 Feb 13, 2023
15ef7ad
Fixing script
ofiriro3 Feb 13, 2023
bdf3bdc
Remove strict host
ofiriro3 Feb 13, 2023
f70e055
Adding StrictHost
ofiriro3 Feb 13, 2023
5ae401a
Adding public Ip
ofiriro3 Feb 13, 2023
c35f22e
Adding public Ip
ofiriro3 Feb 13, 2023
18d7eb3
trying to use scp-action
ofiriro3 Feb 13, 2023
b940661
Copy single file to remote
ofiriro3 Feb 13, 2023
f1ec376
Copy single file to remote
ofiriro3 Feb 13, 2023
5181f79
Change to key
ofiriro3 Feb 13, 2023
65e6f67
update flow
ofiriro3 Feb 13, 2023
9127534
adding command
ofiriro3 Feb 13, 2023
72f8423
print pwd
ofiriro3 Feb 13, 2023
8aef1c1
print pwd
ofiriro3 Feb 13, 2023
b8c2ef2
Remove spaces
ofiriro3 Feb 13, 2023
6de42c4
updating flow to ll the file
ofiriro3 Feb 13, 2023
ebfc4d8
updating flow to ll the file
ofiriro3 Feb 13, 2023
0d09ab8
updating flow to ll the file
ofiriro3 Feb 13, 2023
5335de3
only pwd
ofiriro3 Feb 13, 2023
b31d585
adding ll
ofiriro3 Feb 13, 2023
4067dcd
adding ls
ofiriro3 Feb 13, 2023
2a846af
adding cat
ofiriro3 Feb 13, 2023
ea9e924
fixing the secret to be evaluated
ofiriro3 Feb 13, 2023
441c80d
new example
ofiriro3 Feb 13, 2023
e93adcd
remote authenticatioin
ofiriro3 Feb 13, 2023
02019bb
Trying to add echo -e
ofiriro3 Feb 13, 2023
090edfa
SCP help
ofiriro3 Feb 13, 2023
727477b
SCP help
ofiriro3 Feb 13, 2023
3bfe72c
updating command to verbose
ofiriro3 Feb 13, 2023
3ba1564
updating command to verbose
ofiriro3 Feb 13, 2023
427bea3
removing host verification
ofiriro3 Feb 13, 2023
e93b6a5
Adding base 64 decoding
ofiriro3 Feb 13, 2023
e3f5ec6
mm
ofiriro3 Feb 13, 2023
590c2c5
update flow to use public ip variable
ofiriro3 Feb 13, 2023
b55ce48
update flow to use public ip variable
ofiriro3 Feb 13, 2023
850dee5
updating id of flow
ofiriro3 Feb 13, 2023
0008f61
first end to end flow
ofiriro3 Feb 13, 2023
2f09957
Fixing CI scp command
ofiriro3 Feb 13, 2023
3e5a3da
Fixing deployment
ofiriro3 Feb 13, 2023
a4170e8
Working version with no snapshot
ofiriro3 Feb 13, 2023
fe66278
Adding input validation and using 8.6.1 version
ofiriro3 Feb 13, 2023
a2efb02
Adding all old files
ofiriro3 Feb 13, 2023
dfe71ea
Merge branch 'main' into vanilla_poc
ofiriro3 Feb 13, 2023
ed4ea56
Update the git ignore
ofiriro3 Feb 13, 2023
008f3e3
Refined version
ofiriro3 Feb 13, 2023
74c9a40
Edit environment variables
ofiriro3 Feb 14, 2023
592bfd1
removing flow
ofiriro3 Feb 14, 2023
819615d
reverting changes
ofiriro3 Feb 14, 2023
b727e5d
Update weekly-enviroment.yml EC parameter name
ofiriro3 Feb 15, 2023
d02a1ba
Merge branch 'main' into vanilla_poc
ofiriro3 Feb 15, 2023
65a8a33
Update weekly-enviroment.yml EC2 Private key parameter name
ofiriro3 Feb 15, 2023
0426cd7
Merge remote-tracking branch 'origin/vanilla_poc' into vanilla_poc
ofiriro3 Feb 15, 2023
2c64595
apply review comments
ofiriro3 Feb 20, 2023
e726da8
Trying to use Hermit without Terraform setup step
ofiriro3 Feb 21, 2023
7694167
Updating hermit path
ofiriro3 Feb 21, 2023
2f337e7
using Hermit
ofiriro3 Feb 21, 2023
b46b90e
Run terraform format
ofiriro3 Feb 21, 2023
eab79a4
Adding lint for terraform
ofiriro3 Feb 21, 2023
8a18f5c
Merge branch 'main' into vanilla_poc
ofiriro3 Feb 23, 2023
fac6d42
Merge branch 'main' into vanilla_poc
ofiriro3 Feb 23, 2023
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
14 changes: 14 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version-file: .go-version

- name: Check out the repo
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -156,3 +157,16 @@ jobs:
run: |
cfn-lint --version
cfn-lint -I -t ./deploy/cloudformation/elastic-agent-ec2.yml

terraform-linter:
name: terraform-lint
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV

- name: Terraform fmt
run: terraform fmt -check -recursive
126 changes: 126 additions & 0 deletions .github/workflows/weekly-enviroment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Weekly environment deployment

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
type: choice
options:
- weekly environment
logLevel:
description: 'Log level'
required: true
default: 'INFO'
type: choice
options:
- TRACE
- DEBUG
- INFO
- WARN
- ERROR

env:
WORKING_DIR: deploy/weekly-environment
SCRIPTS_DIR: deploy/weekly-environment/scripts/benchmarks/kspm_vanilla
TF_VAR_ec_api_key: ${{ secrets.WEEKLY_ENVIRONMENT_EC_API_KEY }}
TF_VAR_environment: ${{ github.event.inputs.logLevel }}
TF_LOG: ${{ github.event.inputs.logLevel }}
TF_VAR_stack_version: 8.6.1

jobs:
terraform:
name: Deploy KSPM cloud environment
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
working-directory: ./

- name: Terraform Init
run: terraform init -no-color

- name: Terraform Validate
run: terraform validate -no-color

- name: Deploy Elastic Cloud
run: terraform apply --auto-approve

- name: Set terraform output as env variable
run: |
echo "KIBANA_URL=$(terraform output kibana_url)" >> $GITHUB_ENV

- name: Set sensitive terraform output as env variable
run: |
export ELASTICSEARCH_USERNAME=$(terraform output elasticsearch_username)
echo "::add-mask::$ELASTICSEARCH_USERNAME"
echo "ELASTICSEARCH_USERNAME=$ELASTICSEARCH_USERNAME" >> $GITHUB_ENV

export ELASTICSEARCH_PASSWORD=$(terraform output elasticsearch_password)
echo "::add-mask::$ELASTICSEARCH_PASSWORD"
echo "ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_PASSWORD" >> $GITHUB_ENV

- name: Install KSPM vanilla integration
working-directory: ${{ env.SCRIPTS_DIR }}
run: |
./install-kspm-vanilla-integration.sh ${{ env.KIBANA_URL }} ${{ env.ELASTICSEARCH_PASSWORD }}

- name: Deploy agent on EC2
working-directory: ${{ env.SCRIPTS_DIR }}
run: |
echo -e "${{ secrets.WEEKLY_ENVIRONMENT_EC2_PRIVATE_KEY }}" > weekly-key.pem
chmod 600 weekly-key.pem
# Copy the manifest file to the EC2 instance
scp -o StrictHostKeyChecking=no -v -i weekly-key.pem manifest.yaml "ubuntu@${{ secrets.WEEKLY_ENVIRONMENT_EC2_PUBLIC_IP }}:~/."
# Apply the manifest file
ssh -o StrictHostKeyChecking=no -v -i weekly-key.pem "ubuntu@${{ secrets.WEEKLY_ENVIRONMENT_EC2_PUBLIC_IP }}" "kubectl apply -f manifest.yaml"

# Once https://github.com/slackapi/slack-github-action/issues/84 will be resolved we can push the payload to a different file
- name: Send custom JSON data to Slack workflow
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"text": "A new deployment job has been triggered",
"attachments": [
{
"color": "#36a64f",
"fields": [
{
"title": "Environment",
"value": "${{ github.event.inputs.environment }}",
"short": true
},
{
"title": "Log level",
"value": "${{ github.event.inputs.logLevel }}",
"short": true
},
{
"title": "Kibana URL",
"value": ${{ env.KIBANA_URL }},
"short": false
},
{
"title": "ElasticSearch username",
"value": ${{ env.ELASTICSEARCH_USERNAME }},
"short": false
},
{
"title": "ElasticSearch password",
"value": ${{ env.ELASTICSEARCH_PASSWORD }},
"short": false
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
32 changes: 28 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,31 @@ bundle.tar.gz
/deploy/k8s/cloudbeat-ds.yaml

# terraform
deploy/cloud/.terraform
deploy/cloud/.terraform.lock.hcl
deploy/cloud/terraform.tfstate
deploy/cloud/terraform.tfstate.backup
.terraform
.terraform.lock.hcl
.tfstate.backup

# .tfstate files
*.tfstate
*.tfstate.*
*.tfplan

# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc
27 changes: 0 additions & 27 deletions deploy/cloud/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/cloud/modules/api/terraform.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
terraform {
required_providers {
restapi = {
source = "mastercard/restapi"
source = "mastercard/restapi"
version = "~> 1.18.0"
}
http = {
source = "hashicorp/http"
source = "hashicorp/http"
version = "~> 3.2.1"
}
}
Expand Down
8 changes: 4 additions & 4 deletions deploy/cloud/modules/provision-apps/aws-ebs-csi-driver.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
resource "helm_release" "aws_ebs_csi_driver" {
chart = "aws-ebs-csi-driver"
name = "aws-ebs-csi-driver"
namespace = var.namespace
chart = "aws-ebs-csi-driver"
name = "aws-ebs-csi-driver"
namespace = var.namespace
repository = "https://kubernetes-sigs.github.io/aws-ebs-csi-driver"


set {
name = "controller.serviceAccount.name"
name = "controller.serviceAccount.name"
value = "ebs-csi-controller-sa"
}

Expand Down
10 changes: 5 additions & 5 deletions deploy/cloud/modules/provision-apps/nginx-ingress.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
resource "helm_release" "nginx_ingress" {
chart = "nginx-ingress-controller"
name = "nginx-ingress-controller"
chart = "nginx-ingress-controller"
name = "nginx-ingress-controller"

repository = "https://charts.bitnami.com/bitnami"
timeout = 600
namespace = var.namespace
timeout = 600
namespace = var.namespace

set {
name = "service.type"
value = "ClusterIP"
}

set {
name = "replicaCount"
name = "replicaCount"
value = var.replica_count
}
}
2 changes: 1 addition & 1 deletion deploy/cloud/modules/provision-apps/terraform.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
source = "hashicorp/helm"
version = ">=2.8.0"
}

Expand Down
4 changes: 2 additions & 2 deletions deploy/cloud/modules/provision-apps/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
variable "namespace" {
type = string
type = string
default = "default"
}

variable "replica_count" {
type = string
type = string
default = "2"
}
25 changes: 25 additions & 0 deletions deploy/weekly-environment/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
provider "ec" {
apikey = var.ec_api_key
}

module "ec_deployment" {
source = "github.com/elastic/apm-server/testing/infra/terraform/modules/ec_deployment"

region = var.ess_region
stack_version = var.stack_version

deployment_template = var.deployment_template
deployment_name_prefix = "${var.deployment_name_prefix}-${formatdate("MMM DD, YYYY", timestamp())}"

integrations_server = true

elasticsearch_size = var.elasticsearch_size
elasticsearch_zone_count = var.elasticsearch_zone_count

docker_image = var.docker_image_override
docker_image_tag_override = {
"elasticsearch" : "",
"kibana" : "",
"apm" : ""
}
}
26 changes: 26 additions & 0 deletions deploy/weekly-environment/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
output "elasticsearch_url" {
value = module.ec_deployment.elasticsearch_url
description = "The secure Elasticsearch URL"
}

output "elasticsearch_username" {
value = module.ec_deployment.elasticsearch_username
description = "The Elasticsearch username"
sensitive = true
}

output "elasticsearch_password" {
value = module.ec_deployment.elasticsearch_password
description = "The Elasticsearch password"
sensitive = true
}

output "kibana_url" {
value = module.ec_deployment.kibana_url
description = "The secure Kibana URL"
}

output "admin_console_url" {
value = module.ec_deployment.admin_console_url
description = "The admin console URL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "weekly-environment-vanilla-policy",
"namespace": "default",
"monitoring_enabled": [
"logs",
"metrics"
]
}
Loading