1+ #! /bin/bash
2+ set -e
3+
4+ # # This script deploys in different namespaces the helm chart of the agent control
5+ # # You need to have the following files in ~/.fleet-control:
6+ # # - client_id: the client id of the system identity
7+ # # - e2e_key: the private key of the system identity
8+ # # - license_key: your new relic license key
9+
10+
11+ echo " Starting deployment of all namespaces..."
12+
13+ helm upgrade --install flux -n load-test newrelic/agent-control-cd --set flux2.watchAllNamespaces=true
14+
15+ cat << EOF > local/load-test.yaml
16+ systemIdentity:
17+ create: false #<-- you need to pre-create it in your cluster
18+ secretName: "sys-identity"
19+
20+ config:
21+ acRemoteUpdate: false
22+ cdRemoteUpdate: false
23+ fleet_control:
24+ enabled: true
25+ # Fleet with name 'load-test'. The sub-agent reports data to the 'Agent Control Canaries' account.
26+ fleet_id: "NjQyNTg2NXxOR0VQfEZMRUVUfDAxOThjODA5LTlmMWEtNzM4Zi1iMDBjLTVmNDAwZWQ4YTJjZA"
27+ override:
28+ fleet_control:
29+ signature_validation:
30+ enabled: false
31+ log:
32+ level: warn
33+ agents:
34+ infra:
35+ agent_type: "newrelic/com.newrelic.infrastructure:0.1.0"
36+ infra-2:
37+ agent_type: "newrelic/com.newrelic.infrastructure:0.1.0"
38+ agentsConfig:
39+ infra:
40+ chart_values:
41+ newrelic-infrastructure:
42+ enabled: false
43+ nri-metadata-injection:
44+ enabled: false
45+ kube-state-metrics:
46+ enabled: false
47+ nri-kube-events:
48+ enabled: false
49+ chart_version: "*"
50+ infra-2:
51+ chart_values:
52+ newrelic-infrastructure:
53+ enabled: false
54+ nri-metadata-injection:
55+ enabled: false
56+ kube-state-metrics:
57+ enabled: false
58+ nri-kube-events:
59+ enabled: false
60+ chart_version: "*"
61+ EOF
62+ echo " [$( date) ] saved config file"
63+
64+
65+ for i in {1..150}; do
66+ NAMESPACE=" load-test-release-$i "
67+ RELEASE_NAME=" load-test-release-$i "
68+ CLUSTER_NAME=" load-test-release-$i "
69+
70+
71+ echo " [$( date) ] Creating namespace: $NAMESPACE "
72+ kubectl create namespace $NAMESPACE || true
73+
74+ echo " [$( date) ] Creating identity: $NAMESPACE " -n $NAMESPACE
75+ kubectl create secret generic sys-identity --namespace $NAMESPACE --from-literal=CLIENT_ID=" $( cat ~ /.agent-control/client_id) " --from-literal=private_key=" $( cat ~ /.agent-control/e2e_key) " || true
76+ echo " [$( date) ] Installing helm chart in $NAMESPACE "
77+
78+ helm upgrade $RELEASE_NAME newrelic/agent-control-deployment --install \
79+ --namespace $NAMESPACE --values local/load-test.yaml --set cluster=$CLUSTER_NAME --set subAgentsNamespace=$NAMESPACE --set licenseKey=" $( cat ~ /.agent-control/license_key) "
80+
81+ echo " [$( date) ] Completed $NAMESPACE ($i /150)"
82+ done
83+
84+ echo " All 150 namespaces deployed successfully!"
0 commit comments