Skip to content

Commit

Permalink
Remove deprecated values-file modification for super-agent recipe in …
Browse files Browse the repository at this point in the history
…staging (#998)

* feat: modify repo and path for OTLP endpoint conf
* feat: create sub-agent directory
* fix: remove deprecated keys from config
---------
Co-authored-by: David Sánchez <[email protected]>
  • Loading branch information
alvarocabanas authored Dec 4, 2023
1 parent e4df5b7 commit 28a8e27
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
20 changes: 13 additions & 7 deletions recipes/newrelic/infrastructure/super-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: super-agent
displayName: New Relic Super Agent
description: New Relic install recipe for the Super Agent
repository: https://github.com/newrelic/newrelic-supervisor
repository: https://github.com/newrelic/newrelic-super-agent

installTargets:
- type: host
Expand Down Expand Up @@ -328,16 +328,25 @@ install:
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
fi
- |
# Remove old config location (to deprecate)
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
# Create nr_otel_collector sub-agent dir
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'otel_exporter_otlp_endpoint: "otlp.eu01.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
else
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'otel_exporter_otlp_endpoint: "otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
fi
config_supervisors:
cmds:
- |
# Remove values_file keys from config.yaml
sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -359,9 +368,6 @@ install:
else
sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml
fi
fi
config_opamp:
Expand Down
21 changes: 13 additions & 8 deletions recipes/newrelic/infrastructure/super-agent/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: super-agent
displayName: New Relic Super Agent
description: New Relic install recipe for the Super Agent
repository: https://github.com/newrelic/newrelic-supervisor
repository: https://github.com/newrelic/newrelic-super-agent

installTargets:
- type: host
Expand Down Expand Up @@ -265,16 +265,24 @@ install:
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
fi
- |
# Remove old config location (to deprecate)
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
# Create nr_otel_collector sub-agent dir
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
else
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> //etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
fi
config_supervisors:
cmds:
- |
# Remove values_file keys from config.yaml
sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -295,10 +303,7 @@ install:
sed -i '/^\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml
fi
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
fi
config_opamp:
Expand Down
21 changes: 14 additions & 7 deletions recipes/newrelic/infrastructure/super-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: super-agent
displayName: New Relic Super Agent
description: New Relic install recipe for the Super Agent
repository: https://github.com/newrelic/newrelic-supervisor
repository: https://github.com/newrelic/newrelic-super-agent

installTargets:
- type: host
Expand Down Expand Up @@ -220,16 +220,24 @@ install:
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
fi
- |
# Remove old config location (to deprecate)
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
# Create nr_otel_collector sub-agent dir
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
else
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml
fi
config_supervisors:
cmds:
- |
# Remove values_file keys from config.yaml
sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -251,9 +259,6 @@ install:
else
sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml
fi
fi
config_opamp:
Expand All @@ -271,6 +276,8 @@ install:
sed -i '/^\s*#\s*headers:/s/#//' /etc/newrelic-super-agent/config.yaml
fi
- |
# Remove old config location (to deprecate)
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"staging-service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
Expand Down

0 comments on commit 28a8e27

Please sign in to comment.