Skip to content

Commit

Permalink
Refactor metricsforwarder makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix committed Jun 11, 2024
1 parent db4e4f1 commit 219caa6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/autoscaler/metricsforwarder/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
PR_NUMBER ?= $(shell gh pr view --json number --jq '.number')
DEPLOYMENT_NAME ?= autoscaler-$(PR_NUMBER)
METIRCSFORWARDER_VM := $(shell bosh -d $(DEPLOYMENT_NAME) vms --json | jq '.Tables | .[] | .Rows | .[] | select(.instance|test("metricsforwarder")) | .instance')
POSTGRES_IP := $(shell bosh -d ${DEPLOYMENT_NAME} vms --json | jq -r '.Tables | .[] | .Rows | .[] | select(.instance|test("postgres")) | .ips' )
LOG_CACHE_IP := $(shell bosh -d cf vms --json | jq -r '.Tables | .[] | .Rows | .[] | select(.instance|test("log-cache")) | .ips' )
METRICSFORWARDER_APPNAME ?= "metricsforwarder"
METRICSFORWARDER_HOSTNAME ?= $(METRICSFORWARDER_APPNAME)
SYSTEM_DOMAIN ?= "autoscaler.app-runtime-interfaces.ci.cloudfoundry.org"
Expand All @@ -18,13 +20,9 @@ fetch-config: start-metricsforwarder-vm
# how to define variables in deployment name
mkdir -p assets/certs/policy_db assets/certs/storedprocedure_db assets/certs/syslog_client

$(eval POSTGRES_IP := $(shell bosh -d ${DEPLOYMENT_NAME} vms --json | jq -r '.Tables | .[] | .Rows | .[] | select(.instance|test("postgres")) | .ips' ))
echo "Postgres IP: $(POSTGRES_IP)"

$(eval LOG_CACHE_IP := $(shell bosh -d cf vms --json | jq -r '.Tables | .[] | .Rows | .[] | select(.instance|test("log-cache")) | .ips' ))
echo "POSTGRES IP: $(POSTGRES_IP)"
echo "LOG_CACHE IP: $(LOG_CACHE_IP)"


@echo "Pulling metricforwarder config from $(METIRCSFORWARDER_VM)..."
bosh -d $(DEPLOYMENT_NAME) scp $(METIRCSFORWARDER_VM):/var/vcap/jobs/metricsforwarder/config/metricsforwarder.yml assets/metricsforwarder.yml

Expand Down

0 comments on commit 219caa6

Please sign in to comment.