File tree Expand file tree Collapse file tree 4 files changed +96
-5
lines changed
Expand file tree Collapse file tree 4 files changed +96
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ $(addsuffix -clean,$(TARGETS)):
2121# #########################################
2222# Static targets #
2323# #########################################
24- # include build/embedded /Makefile
24+ include test/k8s-canaries /Makefile
2525
2626help :
2727 @echo " ## Available targets:"
Original file line number Diff line number Diff line change 11TERRAFORM_DIR := ./terraform
2+ HELM_DIR := ./helm
3+ .DEFAULT_GOAL := all
24
3- .PHONY : sync
4- sync :
5+ # Generate a random key to add to the helm deployment annotation
6+ # This way, whenever there is a helm upgrade the pod will be recreated and its image pulled, even if the tag didn't change
7+ DEPLOYMENT_KEY := $(shell openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c 16)
8+
9+ .PHONY : all
10+ all :
11+ @echo " No default target"
12+
13+ .PHONY : test/k8s-canaries/sync
14+ test/k8s-canaries/sync :
515ifndef CANARY_DIR
616 @echo "CANARY_DIR variable must be provided to know which canary to sync"
717 exit 1
818endif
919 terraform -chdir=$(TERRAFORM_DIR)/$(CANARY_DIR) init && \
1020 terraform -chdir=$(TERRAFORM_DIR)/$(CANARY_DIR) apply -auto-approve
21+
22+ .PHONY : test/k8s-canaries/helm
23+ test/k8s-canaries/helm :
24+ ifndef NR_LICENSE_KEY
25+ @echo "NR_LICENSE_KEY variable must be provided for k8s-canaries/helm"
26+ exit 1
27+ endif
28+ ifndef CLUSTER_NAME
29+ @echo "CLUSTER_NAME variable must be provided for k8s-canaries/helm"
30+ exit 1
31+ endif
32+ ifndef IMAGE_TAG
33+ @echo "IMAGE_TAG variable must be provided for k8s-canaries/helm"
34+ exit 1
35+ endif
36+ @helm repo add newrelic https://helm-charts.newrelic.com
37+ @helm upgrade --install ac newrelic/agent-control --devel -f $(HELM_DIR)/agent-control.yml \
38+ -n newrelic --create-namespace \
39+ --set global.licenseKey=$(NR_LICENSE_KEY) \
40+ --set global.cluster=$(CLUSTER_NAME) \
41+ --set agent-control-deployment.image.tag=$(IMAGE_TAG) \
42+ --set agent-control-deployment.podAnnotations.deploymentKey="${DEPLOYMENT_KEY}"
Original file line number Diff line number Diff line change @@ -11,8 +11,38 @@ The purpose of this tool is to create the EKS Clusters to run our canaries.
1111
1212## Usage on pipelines
1313
14- There is a Make target to run the terraform init and apply in our pipelines. The idea is to call it any time there are changes in the tf files.
14+ ### Terraform init and apply
1515
16+ The idea is to call this target any time there are changes in the tf files and will apply the changes if correct.
17+ There are 2 clusters created and when calling the target the CANARY_DIR needs to be provided, the canary dirs are:
18+ - staging
19+ - production
20+
21+ The default terraform dir for where the terraform modules are taken from is:
22+ ` TERRAFORM_DIR := ./terraform `
23+
24+ ``` bash
25+ $ make CANARY_DIR=staging test/k8s-canaries/sync
26+ ```
27+
28+ If this target is called from the root of this repository, the TERRAFORM_DIR should be overwritten to point to the relative path:
29+ ``` bash
30+ $ make TERRAFORM_DIR=test/k8s-canaries/terraform CANARY_DIR=staging test/k8s-canaries/sync
31+ ```
32+
33+ ### Helm Upgrade for nightlies and prereleases
34+
35+ This target will add the helm repo if not present and upgrade (or install) the helm repo with the agent-control.yml values present on this folder.
36+ The agent-control pod will always pull the image on every upgrade because there is a random deployment-key annotation added each time.
37+
38+ The default helm dir where there is the default values file to apply is:
39+ ` HELM_DIR := ./helm `
40+
41+ ``` bash
42+ $ make NR_LICENSE_KEY=xxx CLUSTER_NAME=my-cluster IMAGE_TAG=nightly test/k8s-canaries/helm
43+ ```
44+
45+ If this target is called from the root of this repository, the HELM_DIR should be overwritten to point to the relative path:
1646``` bash
17- $ make CANARY_DIR=staging sync
47+ $ make HELM_DIR=test/k8s-canaries/helm NR_LICENSE_KEY=xxx CLUSTER_NAME=my-cluster IMAGE_TAG=nightly test/k8s-canaries/helm
1848```
Original file line number Diff line number Diff line change 1+ # Cluster and License info is set with "--set" in the e2e-spec file
2+ agent-control-deployment :
3+ image :
4+ imagePullPolicy : Always
5+ config :
6+ fleet_control :
7+ enabled : false
8+ agentControl :
9+ content :
10+ log :
11+ level : info
12+ subAgents :
13+ infra :
14+ type : newrelic/com.newrelic.infrastructure:0.1.0
15+ content :
16+ chart_version : " *" # Use latest
17+ chart_values :
18+ nri-metadata-injection :
19+ # TODO we are currently disabling the metadata injection since if enabled it breaks when installed
20+ # together with the gatewayRESE
21+ enabled : false
22+ prometheus :
23+ type : newrelic/com.newrelic.prometheus:0.1.0
24+ content :
25+ chart_version : " *" # Use latest
26+ logs :
27+ type : newrelic/io.fluentbit:0.1.0
28+ content :
29+ chart_version : " *" # Use latest
You can’t perform that action at this time.
0 commit comments